A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/bmstrsparsevec_8h_source.html below:

NCBI C++ ToolKit: include/util/bitset/bmstrsparsevec.h Source File

1 #ifndef BMSTRSPARSEVEC__H__INCLUDED__ 2 #define BMSTRSPARSEVEC__H__INCLUDED__ 30 #include <string_view> 33 #ifndef BM__H__INCLUDED__ 36 # error missing include (bm.h or bm64.h) 70 template

<

typename

CharType,

typename

BV,

unsigned

STR_SIZE>

79  typedef typename

bvector_type::size_type

size_type

;

151

{

return bool

(*

this

) ==

bool

(ref); }

180  const

value_type* v = this->

buf_

.

data

();

197

{

return bool

(*

this

) ==

bool

(ref); }

261

{

return

(

pos_

== it.pos_) && (

sv_

== it.sv_); }

265

{

return pos_

< it.pos_; }

267

{

return pos_

<= it.pos_; }

269

{

return pos_

> it.pos_; }

271

{

return pos_

>= it.pos_; }

275 

{

return

this->

value

(); }

279

{ this->

advance

();

return

*

this

; }

287  const

value_type*

value

()

const

;

367

bi.buf_matrix_.rows(), bi.buf_matrix_.cols());

397

{ this->

add

(v);

return

*

this

; }

401  template

<

typename

StrType>

404

this->

add

(v.c_str());

return

*

this

;

471

bvector_type::optmode

opt_mode_

= bvector_type::opt_compress;

515  if

(

this

!= &str_sv)

536  if

(

this

!= &str_sv)

537

this->

swap

(str_sv);

613  template

<

typename

StrType>

648  template

<

typename

StrType>

651  if

(idx >= this->

size

())

652

this->

size_

= idx+1;

662

CharType ch =

str

[

i

];

667

ch = CharType(remap_value);

675

bv_null->set_bit_no_check(idx);

683  template

<

typename

StrType>

710  template

<

typename

StrType>

726  template

<

typename

StrType>

730  for

(

unsigned i

= 0;

true

; ++

i

)

738  unsigned char

remap_value = remap_row[unsigned(ch)];

745

ch = CharType(remap_value);

800  template

<

bool

USE_PREFIX_BUF = false>

1119  template

<

typename

CharMatrix>

1123  bool

zero_mem =

true

)

const 1127

0,

unsigned

(str_len-1), zero_mem);

1143  template

<

typename

CharMatrix>

1147  unsigned

substr_from,

1149  bool

zero_mem =

true

)

const 1155  struct

sv_decode_visitor_func

1157

sv_decode_visitor_func(CharMatrix& cmatr)

BMNOEXCEPT2 1170  const unsigned i

= substr_i_;

1177

}

while

(++j < bits_size);

1185  auto

base = bv_offset - sv_off_;

1187  const unsigned i

= substr_i_;

1200  unsigned

substr_i_= 0;

1213  if

(max_sz < dec_size)

1215  if

(rows < dec_size)

1220

sv_decode_visitor_func func(cmatr);

1222  for

(

unsigned i

= substr_from;

i

<= substr_to; ++

i

)

1225

func.substr_i_ =

i

- substr_from;

1228  for

(

unsigned

k =

i

* 8; k < (

i

* 8) + 8; ++k, ++bi)

1238

func.sv_off_ = idx_from;

1249  for

(

unsigned i

= 0;

i

< dec_size; ++

i

)

1267  template

<

typename

CharMatrix>

1272  if

(idx_from < this->

size_

)

1275

this->

clear_range

(idx_from, idx_from + imp_size - 1);

1288  template

<

typename

CharMatrix>

1379  template

<

typename

CharMatrix,

size_t

BufSize = ins_buf_size>

1382  bool

set_not_null =

true

)

1386  unsigned

max_str_size = 0;

1388  for

(

unsigned

j = 0; j < imp_size; ++j)

1391  typename

CharMatrix::size_type

i

;

1392  typename

CharMatrix::size_type cols = cmatr.cols();

1393  for

(

i

= 0;

i

< cols; ++

i

)

1399

(unsigned)((

i

> max_str_size) ?

i

: max_str_size);

1404  unsigned char

remap_value =

1410  str

[

i

] = CharType(remap_value);

1418

unsigned_value_type ch_slice[BufSize];

1419  for

(

unsigned i

= 0;

i

< max_str_size; ++

i

)

1421  unsigned

ch_acc = 0;

1422 #if defined(BMVECTOPT) || defined(BM_USE_GCC_BUILD) 1425  for

(

size_type

j = 0; j < imp_size; j+=4)

1433

ch_slice[j] =

ch0

; ch_slice[j+1] =

ch1

;

1434

ch_slice[j+2] =

ch2

; ch_slice[j+3] =

ch3

;

1440  for

(

size_type

j = 0; j < imp_size; ++j)

1450  size_type

idx_to = idx_from + imp_size - 1;

1454

bv_null->set_range(idx_from, idx_to);

1456  if

(idx_to >= this->

size

())

1457

this->

size_

= idx_to+1;

1461 #pragma warning( push ) 1462 #pragma warning( disable : 4146 ) 1465  template

<

size_t

BufSize = ins_buf_size>

1472  for

( ;ch_acc; ch_acc &= ch_acc - 1)

1474  unsigned

n_bits = 0;

1476  unsigned mask

= 1u << bi;

1477 #if defined(BMVECTOPT) || defined(BM_USE_GCC_BUILD) 1481  for

(

size_type

j = 0; j < imp_size; j+=4)

1483  unsigned ch0

= ((unsigned)ch_slice[j+0]) |

1484

((unsigned)ch_slice[j+1] << 8) |

1485

((unsigned)ch_slice[j+2] << 16) |

1486

((unsigned)ch_slice[j+3] << 24);

1489

(

ch0

>> (bi+14)) | (

ch0

>> (bi+21));

1494  const unsigned

bit_idx =

1496  bit_list

[n_bits++] = base_idx + bit_idx;

1503  for

(

size_type

j = 0; j < imp_size; ++j)

1505  unsigned

ch = unsigned(ch_slice[j]);

1507  bit_list

[n_bits++] = idx_from + j;

1515

bv->import_sorted(&

bit_list

[0], n_bits,

false

);

1520 #pragma warning( pop ) 1573

*idx_from = from; *idx_to = to;

return true

;

1584  void remap

(back_insert_iterator& iit);

1607 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1616

static_assert(STR_SIZE > 1,

1617  "BM:: String vector size must be > 1 (to accomodate 0 terminator)"

);

1623 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1627

remap_flags_(str_sv.remap_flags_),

1628

remap_matrix1_(str_sv.remap_matrix1_),

1629

remap_matrix2_(str_sv.remap_matrix2_)

1631

static_assert(STR_SIZE > 1,

1632  "BM:: String vector size must be > 1 (to accomodate 0 terminator)"

);

1637 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1641

remap_flags_(str_sv.remap_flags_),

1642

remap_matrix1_(str_sv.remap_matrix1_),

1643

remap_matrix2_(str_sv.remap_matrix2_)

1647

static_assert(STR_SIZE > 1,

1648  "BM:: String vector size must be > 1 (to accomodate 0 terminator)"

);

1654 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1660

remap_matrix1_.swap(str_sv.remap_matrix1_);

1661

remap_matrix2_.swap(str_sv.remap_matrix2_);

1666 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1670  if

(idx >= this->

size

())

1671

this->size_ = idx+1;

1672

set_value(idx,

str

);

1677 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1681  if

(idx >= this->

size

())

1683

this->size_ = idx+1;

1684

set_value(idx,

str

);

1687

insert_value(idx,

str

);

1693 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1700

this->swap_elements(idx1, idx2);

1705 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1709  if

(idx >= this->size_)

1711

this->erase_column(idx,

true

);

1717 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1720  if

(idx >= this->size_)

1721

this->size_ = idx + 1;

1723

this->bmatr_.clear_column(idx, 0);

1727 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1734

this->size_ +=

count

;

1739 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1743

set_value_no_null(idx,

str

);

1745

bv_null->set_bit_no_check(idx);

1750 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1754  for

(

unsigned i

= 0;

true

; ++

i

)

1756

CharType ch =

str

[

i

];

1759

this->clear_value_planes_from(

i

*8, idx);

1764  auto r

= remap_matrix2_.rows();

1767

remap_matrix1_.resize(

i

+ 1, remap_matrix1_.cols(),

true

);

1768

remap_matrix2_.resize(

i

+ 1, remap_matrix2_.cols(),

true

);

1770  unsigned char

remap_value = remap_matrix2_.get(

i

,

unsigned

(ch));

1774

this->clear_value_planes_from(

i

*8, idx);

1777

ch = CharType(remap_value);

1779

this->bmatr_.set_octet(idx,

i

, (

unsigned char

)ch);

1785 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1789

insert_value_no_null(idx,

str

);

1790

this->insert_null(idx,

true

);

1795 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1799  for

(

unsigned i

= 0;

true

; ++

i

)

1801

CharType ch =

str

[

i

];

1804

this->insert_clear_value_planes_from(

i

*8, idx);

1810  unsigned char

remap_value = remap_matrix2_.get(

i

,

unsigned

(ch));

1814

this->insert_clear_value_planes_from(

i

*8, idx);

1817

ch = CharType(remap_value);

1819

this->bmatr_.insert_octet(idx,

i

, (

unsigned char

)ch);

1826 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1832  for

(;

true

; ++

i

)

1836

CharType ch = CharType(this->bmatr_.get_octet(idx,

i

));

1842

remap_matrix1_.remap(

str

,

i

);

1848 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1851  typename

bvector_type::optmode opt_mode,

1854  typename

bvector_type::statistics stbv;

1855

parent_type::optimize(temp_block, opt_mode, &stbv);

1863 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1869  typename

bvector_type::statistics stbv;

1870

parent_type::calc_stat(&stbv);

1874  st

->bit_blocks += stbv.bit_blocks;

1875  st

->gap_blocks += stbv.gap_blocks;

1876  st

->ptr_sub_blocks += stbv.ptr_sub_blocks;

1877  st

->bv_count += stbv.bv_count;

1878  st

->max_serialize_mem += stbv.max_serialize_mem + 8;

1879  st

->memory_used += stbv.memory_used;

1880  st

->gap_cap_overhead += stbv.gap_cap_overhead;

1882  size_t

remap_mem_usage =

sizeof

(remap_flags_);

1883

remap_mem_usage += remap_matrix1_.get_buffer().mem_usage();

1884

remap_mem_usage += remap_matrix2_.get_buffer().mem_usage();

1886  st

->memory_used += remap_mem_usage;

1889  st

->max_serialize_mem += (remap_mem_usage * 2);

1895 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1901  for

(

unsigned i

= 0;

true

; ++

i

)

1903

CharType octet2 = str2[

i

];

1904

CharType octet1 = str1[

i

];

1910

res = (octet1 > octet2) - (octet1 < octet2);

1919 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

1928

CharType octet2, octet1;

1931  for

(;

i

< min_len-3;

i

+=4)

1934

::memcpy(&i2, &str2[

i

],

sizeof

(i2));

1935

::memcpy(&i1, &str1[

i

],

sizeof

(i1));

1941

res = (octet1 > octet2) - (octet1 < octet2);

1944

octet2 = str2[

i

+1];

1945

octet1 = str1[

i

+1];

1946

res = (octet1 > octet2) - (octet1 < octet2);

1949

octet2 = str2[

i

+2];

1950

octet1 = str1[

i

+2];

1951

res = (octet1 > octet2) - (octet1 < octet2);

1954

octet2 = str2[

i

+3];

1955

octet1 = str1[

i

+3];

1956

res = (octet1 > octet2) - (octet1 < octet2);

1966  for

(;

i

< min_len; ++

i

)

1971

res = (octet1 > octet2) - (octet1 < octet2);

1976  for

(;

true

; ++

i

)

1985

res = (octet1 > octet2) - (octet1 < octet2);

1995 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2003  for

(

unsigned i

= 0;

true

; ++

i

)

2005

CharType octet2 =

str

[

i

];

2006

CharType octet1 = (CharType)this->bmatr_.get_octet(idx,

i

);

2012  const unsigned char

* remap_row = remap_matrix1_.row(

i

);

2013

CharType remap_value1 = (CharType)remap_row[

unsigned

(octet1)];

2015

res = (remap_value1 > octet2) - (remap_value1 < octet2);

2024 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2032  for

(

unsigned i

= 0;

true

; ++

i

)

2034

CharType octet2 =

str

[

i

];

2035

CharType octet1 = (CharType)this->bmatr_.get_octet(idx,

i

);

2041

res = (octet1 > octet2) - (octet1 < octet2);

2051 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2057  int

res = remap_flags_ ? compare_remap(idx,

str

)

2058

: compare_nomap(idx,

str

);

2064 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2075  for

(

unsigned i

= 0;

true

; ++

i

)

2078

CharType octet2 = (CharType)this->bmatr_.get_octet(idx2,

i

);

2079

CharType octet1 = (CharType)this->bmatr_.get_octet(idx1,

i

);

2085  const unsigned char

* remap_row = remap_matrix1_.row(

i

);

2086  unsigned char

remap_value1 = remap_row[unsigned(octet1)];

2088  unsigned char

remap_value2 = remap_row[unsigned(octet2)];

2090

res = (remap_value1 > remap_value2) - (remap_value1 < remap_value2);

2097  for

(

unsigned i

= 0;

true

; ++

i

)

2099

CharType octet2 = (CharType)this->bmatr_.get_octet(idx2,

i

);

2100

CharType octet1 = (CharType)this->bmatr_.get_octet(idx1,

i

);

2106

res = (octet1 > octet2) - (octet1 < octet2);

2117 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2118 template

<

bool

USE_PREFIX_BUF>

2123  BM_ASSERT

(!(prefix_buf && !USE_PREFIX_BUF));

2125

CharType

ch1

= CharType(this->bmatr_.get_octet(idx1,

i

));

2126

CharType

ch2

= CharType(this->bmatr_.get_octet(idx2,

i

));

2129  if

constexpr(USE_PREFIX_BUF)

2132

*prefix_buf++ =

ch1

;

2134  for

(++

i

;

true

; ++

i

)

2136  ch1

= CharType(this->bmatr_.get_octet(idx1,

i

));

2137  ch2

= CharType(this->bmatr_.get_octet(idx2,

i

));

2140  if

constexpr(USE_PREFIX_BUF)

2141

*prefix_buf++ =

ch1

;

2150 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2163 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2168  return

this->bmatr_.octet_size();

2173 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2177  size_type

max_str_len = effective_max_str();

2178

octet_matrix.

resize

(max_str_len, 256,

false

);

2182  for

(; it.

valid

(); ++it)

2187  for

(

unsigned i

= 0;

true

; ++

i

)

2194  unsigned

ch_idx = (

unsigned

char)ch;

2203 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2209  size_type

max_str_len = effective_max_str();

2210

octet_remap_matrix1.

resize

(max_str_len, 256,

false

);

2212

octet_remap_matrix2.

resize

(max_str_len, 256,

false

);

2215  for

(

unsigned i

= 0;

i

< octet_occupancy_matrix.

rows

(); ++

i

)

2218

octet_occupancy_matrix.

row

(

i

);

2220  unsigned char

* remap_row1 = octet_remap_matrix1.

row

(

i

);

2221  unsigned char

* remap_row2 = octet_remap_matrix2.

row

(

i

);

2224

octet_occupancy_matrix.

cols

();

2225  for

(

unsigned

remap_code = 1;

true

; ++remap_code)

2235  unsigned char

ch = (

unsigned

char)char_idx;

2236

remap_row1[remap_code] = ch;

2237

remap_row2[ch] = (

unsigned

char)remap_code;

2238

frq_row[char_idx] = 0;

2245 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2250  auto

rows = remap_matrix1_.rows();

2251

remap_matrix2_.resize(rows, remap_matrix1_.cols(),

false

);

2254

remap_matrix2_.set_zero();

2256  for

(

unsigned i

= 0;

i

< remap_matrix1_.rows(); ++

i

)

2258  const unsigned char

* remap_row1 = remap_matrix1_.row(

i

);

2259  unsigned char

* remap_row2 = remap_matrix2_.row(

i

);

2260  for

(

unsigned

j = 1; j < remap_matrix1_.cols(); ++j)

2264  unsigned

ch_code = remap_row1[j];

2265

remap_row2[ch_code] = (

unsigned

char)j;

2275 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2282  if

(!octet_remap_matrix2.rows())

2285  const unsigned char

* remap_row = octet_remap_matrix2.row(0);

2286  for

(

unsigned i

= 0;

i

< buf_size; ++

i

, remap_row += 256)

2288

CharType ch =

str

[

i

];

2294  unsigned char

remap_value = remap_row[unsigned(ch)];

2295

sv_str[

i

] = CharType(remap_value);

2304 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2313  BM_ASSERT

(in_len <= buf_size); (void) buf_size;

2315  const unsigned char

* remap_row = octet_remap_matrix2.row(0);

2316  for

(

unsigned i

= 0;

i

< in_len; ++

i

, remap_row += 256)

2318

CharType ch =

str

[

i

];

2321  unsigned char

remap_value = remap_row[unsigned(ch)];

2322

sv_str[

i

] = CharType(remap_value);

2326

sv_str[in_len] = str_cp[in_len] = 0;

2333 template

<

class

CharType,

class

BV,

unsigned

MAX_STR_SIZE>

2341  const unsigned char

* remap_row = octet_remap_matrix1.row(0);

2342  for

(

unsigned i

= 0;

i

< buf_size; ++

i

, remap_row += 256)

2344

CharType ch = sv_str[

i

];

2350  unsigned char

remap_value = remap_row[unsigned(ch)];

2351  str

[

i

] = CharType(remap_value);

2360 template

<

class

CharType,

class

BV,

unsigned

MAX_STR_SIZE>

2364

sv_tmp(this->get_null_support());

2366

sv_tmp.

swap

(*

this

);

2371 template

<

class

CharType,

class

BV,

unsigned

MAX_STR_SIZE>

2378

sv_tmp(this->get_null_support());

2380

sv_tmp.

swap

(*

this

);

2388 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2394

remap_from_impl(str_sv, omatrix,

false

);

2399 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2406  const unsigned

buffer_size = ins_buf_size;

2414  typename

bvector_type::allocator_pool_type pool;

2424

pool.set_block_limit(

r

+ 10);

2427

this->clear_all(

true

);

2428  if

(str_sv.

empty

())

2435

omatrix = &occ_matrix;

2443

buffer_matrix_type cmatr(buffer_size, str_len);

2448

dsize = str_sv.

decode

(cmatr,

i

, buffer_size,

true

);

2451  if

(move_data && (dsize == ins_buf_size))

2460

this->

import

(cmatr,

i

, dsize);

2472

*bv_null = *bv_null_arg;

2483 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2488

recalc_remap_matrix2();

2494 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2504  if

(remap_flags_ != sv.remap_flags_)

2512  b

= remap_matrix1_.equal_overlap(sv.remap_matrix1_);

2515  b

= remap_matrix2_.equal_overlap(sv.remap_matrix2_);

2519  return

parent_type::equal(sv, null_able);

2524 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2532

this->clear_all(

true

);

2538

this->copy_range_slices(sv, left, right, slice_null);

2544 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2550  if

(this->size_ < arg_size)

2565

this->merge_matr(str_sv.

bmatr_

);

2569

bv_null->set_range(0, arg_size-1);

2577 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2584

this->keep_range_no_check(left, right, slice_null);

2589 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2595  return

it_type(

this

);

2600 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2604

parent_type::clear_all(free_mem);

2605  if

(remap_flags_ && (remap == 0))

2608

remap_matrix1_.free();

2609

remap_matrix2_.free();

2615 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2617  const char

* err_msg)

2620  throw

std::range_error(err_msg);

2628 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2630  const char

* err_msg)

2634

err_msg =

"Unknown/incomparable dictionary character"

;

2635  throw

std::domain_error(err_msg);

2647 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2649

: sv_(0), substr_from_(0), substr_to_(STR_SIZE),

2656 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2660

substr_from_(it.substr_from_), substr_to_(it.substr_to_),

2661

pos_(it.pos_), pos_in_buf_(~

size_type

(0))

2667 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2673

substr_to_ = (unsigned) sv_->effective_max_str();

2674

buf_matrix_.resize(n_rows, substr_to_+1);

2679 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2686

substr_to_ = (unsigned) sv_->effective_max_str();

2687

buf_matrix_.resize(n_rows, substr_to_+1);

2692 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2696  unsigned max_str

= sv_->effective_max_str();

2697

substr_from_ = from;

2701

substr_to_ = from +

len

;

2706

substr_to_ = substr_from_ + (

len

- 1);

2710

buf_matrix_.resize(n_rows,

len

+1,

false

);

2715 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2724  if

(!buf_matrix_.is_init())

2727  size_type

d = sv_->decode_substr(buf_matrix_, pos_, n_rows,

2728

substr_from_, substr_to_);

2737  return

buf_matrix_.row(pos_in_buf_);

2742 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2751  if

(!buf_matrix_.is_init())

2754  size_type

d = sv_->decode_substr(buf_matrix_, pos_, n_rows,

2755

substr_from_, substr_to_);

2770 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2776

pos_ = (!sv_ || pos >= sv_->size()) ?

bm::id_max

: pos;

2782 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2790  if

(pos_ >= sv_->size())

2797  if

(pos_in_buf_ >= n_rows)

2807 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2809

: sv_(0), bv_null_(0), pos_in_buf_(~

size_type

(0))

2814 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2822

bv_null_ = sv_->get_null_bvect();

2823  unsigned

esize = (unsigned) sv_->effective_max_str();

2824  if

(esize < STR_SIZE)

2826

buf_matrix_.init_resize(n_buf_size, esize);

2830

bv_null_ = 0; prev_nb_ = 0;

2836 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2839

: sv_(bi.sv_), bv_null_(bi.bv_null_), buf_matrix_(bi.buf_matrix_.rows(), bi.buf_matrix_.cols()),

2840

pos_in_buf_(~

size_type

(0)), prev_nb_(bi.prev_nb_), opt_mode_(bi.opt_mode_),

2848 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2856 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2861  return

(pos_in_buf_ == ~

size_type

(0) || !sv_);

2866 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2873

sv_->remap(*

this

);

2880 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2883  if

(this->

empty

())

2886

size_type imp_idx = sv_->size();

2887

sv_->import_no_check(buf_matrix_, imp_idx, pos_in_buf_+1,

false

);

2892

sv_->optimize_block(prev_nb_, opt_mode_);

2900 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2914

bv_null_->set_bit_no_check(sz + buf_idx + 1);

2919 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2922 

this->add_value(

""

);

2927 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2932

this->add_value(

""

);

2938 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2945  size_t

slen = ::strlen(v);

2947  auto

orows = omatrix_.rows();

2952

omatrix_.resize(slen, 256,

false

);

2953

omatrix_.set_zero();

2957

omatrix_.resize(slen, 256,

true

);

2958  for

(; orows < omatrix_.rows(); ++orows)

2962

::memset(

r

, 0, 256 *

sizeof

(

r

[0]));

2966  for

(

size_t i

= 0;

i

< slen; ++

i

)

2971  unsigned

ch_idx = (

unsigned

char)ch;

2978 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

2987  if

(pos_in_buf_ >= buf_matrix_.rows()-1)

2989  if

(pos_in_buf_ == ~

size_type

(0) && (!buf_matrix_.is_init()))

2993

pos_in_buf_ = 0; buf_matrix_.set_zero();

3007  for

(

i

= 0;

i

< cols; ++

i

)

3015  for

(cols =

i

;

true

; ++cols)

3022

buf_matrix_.

resize

(buf_matrix_.rows(), cols + 1);

3024  r

= buf_matrix_.row(pos_in_buf_);

3025

cols = buf_matrix_.cols();

3026  for

(;

i

< cols; ++

i

)

3037 template

<

class

CharType,

class

BV,

unsigned

STR_SIZE>

3043  bool

found = bv_null->find_reverse(this->

size_

);

3044

this->

size_

+= found;

ncbi::TMaskedQueryRegions mask

Algorithms for bvector<> (main include)

basic bit-matrix class and utilities

Constants, lookup tables and typedefs.

#define BM_ASSERT_THROW(x, xerrcode)

Utilities for bit transposition (internal) (experimental!)

void assign_if_not_set(POOL &pool, PCLASS &obj) BMNOEXCEPT

check if vector has no assigned allocator and set one

Base class for bit-transposed(bit-sliced) sparse vector construction.

void freeze_matr()

Turn on RO mode.

void resize(size_type new_size, bool set_null)

const bmatrix_type & get_bmatrix() const noexcept

const value_type & const_reference

void copy_from(const base_sparse_vector< CharType, BV, MAX_SIZE > &bsv)

void clear_range(size_type left, size_type right, bool set_null)

bvector_type_ptr get_create_slice(unsigned i)

get access to bit-plain, function checks and creates a plane

bool is_nullable() const noexcept

check if container supports NULL(unassigned) values

bool is_null(size_type idx) const noexcept

test if specified element is NULL

bmatrix_type bmatr_

bit-transposed matrix

void swap(base_sparse_vector< CharType, BV, MAX_SIZE > &bsv) noexcept

size_type size_

array size

void bit_and_rows(const bvector_type &bv)

Set AND (intersect) operation on all existing bit-slices.

std::make_unsigned< value_type >::type unsigned_value_type

void bit_sub_rows(const bvector_type &bv, bool use_null)

Set SUB (MINUS) operation on all existing bit-slices.

const bvector_type * get_null_bvector() const noexcept

Get bit-vector of assigned values or NULL (if not constructed that way)

bvector_type * get_null_bvect() noexcept

void clear_value_planes_from(unsigned plane_idx, size_type idx)

Basic dense bit-matrix class.

bool is_ro() const noexcept

return true if matrix is in read-only mode

unsigned char get_octet(size_type pos, size_type octet_idx) const noexcept

size_type rows_not_null() const noexcept

void allocate_rows(size_type rsize)

allocate matrix rows of bit-vectors (new rows are NULLs)

bvector_type_const_ptr get_row(size_type i) const noexcept

void set_octet(size_type pos, size_type octet_idx, unsigned char octet)

size_type rows() const noexcept

unsigned char * data() noexcept

Get write access to buffer memory.

size_t size() const noexcept

Get buffer size.

const unsigned char * buf() const noexcept

Get read access to buffer memory.

const value_type * row(size_type row_idx) const noexcept

buffer_type & get_buffer() noexcept

Get low-level buffer access.

void swap(dynamic_heap_matrix &other) noexcept

value_type get(size_type row_idx, size_type col_idx) noexcept

size_type rows() const noexcept

size_type cols() const noexcept

void remapz(VECT_TYPE *vect) const noexcept

void set_zero() noexcept

memset all buffer to all zeroes

void init_resize(size_type rows_in, size_type cols_in)

void resize(size_type rows_in, size_type cols_in, bool copy_content=true)

void init(bool set_z=false)

Post construction allocation, initialization.

value_type * data() const noexcept

void resize(size_type new_size)

vector resize

sparse vector de-serializer

Serialize sparse vector into a memory buffer(s) structure.

Back insert iterator implements buffered insert, faster than generic access assignment.

bvector_type * bv_null_

!< pointer on the parent vector

back_insert_iterator & operator*()

noop

void add_remap_stat(const value_type *v)

account new value as remap statistics

void add(const value_type *v)

add value to the container

size_type pos_in_buf_

!< value buffer

octet_freq_matrix_type omatrix_

octet frequency matrix

void add_value(const value_type *v)

add value to the buffer without changing the NULL vector

back_insert_iterator & operator++()

noop

void flush()

flush the accumulated buffer.

unsigned remap_flags_

target remapping

void set_remap(bool flag) noexcept

Method to configure back inserter to collect statistics on optimal character codes.

buffer_matrix_type buf_matrix_

!< not NULL vector pointer

back_insert_iterator & operator++(int)

noop

str_sparse_vector_type * str_sparse_vector_type_ptr

bvector_type::block_idx_type block_idx_type

str_sparse_vector_type::value_type value_type

str_sparse_vector_type::size_type size_type

void add_null()

add NULL (no-value) to the container

back_insert_iterator() noexcept

bvector_type::allocator_type allocator_type

back_insert_iterator & operator=(const value_type *v)

push value to the vector

bvector_type::optmode opt_mode_

!< previous block added

bm::dynamic_heap_matrix< CharType, allocator_type > buffer_matrix_type

block_idx_type prev_nb_

!< buffer position

str_sparse_vector< CharType, BV, STR_SIZE > str_sparse_vector_type

std::output_iterator_tag iterator_category

unsigned get_remap() const noexcept

Get curent remap state flags.

void set_optimize(typename bvector_type::optmode opt_mode) noexcept

Set optimization on load option (deafult: false)

const octet_freq_matrix_type & get_octet_matrix() const noexcept

Get octet frequence matrix.

void add_null(size_type count)

add a series of consequitve NULLs (no-value) to the container

str_sparse_vector_type * sv_

allocator_type::allocator_pool_type allocator_pool_type

bool empty() const noexcept

return true if insertion buffer is empty

back_insert_iterator & operator=(const StrType &v)

push value to the vector

str_sparse_vector_type::bvector_type bvector_type

Const iterator to do quick traverse of the sparse vector.

str_sparse_vector_type * str_sparse_vector_type_ptr

std::input_iterator_tag iterator_category

dynamic_heap_matrix< CharType, allocator_type > buffer_matrix_type

bool operator==(const const_iterator &it) const noexcept

bool operator!=(const const_iterator &it) const noexcept

const value_type * operator*() const

Get current position (value)

bool operator<=(const const_iterator &it) const noexcept

const value_type * value() const

Get zero terminated string value at the current position.

allocator_type::allocator_pool_type allocator_pool_type

size_type pos_in_buf_

!< decode value buffer

const_iterator() noexcept

Construct iterator (not attached to any particular vector)

bvector_type::allocator_type allocator_type

void invalidate() noexcept

Invalidate current iterator.

buffer_matrix_type buf_matrix_

!< Position

size_type pos() const noexcept

Current position (index) in the vector.

unsigned substr_from_

!< ptr to parent

unsigned substr_to_

!< substring from

size_type pos_

!< substring to

bool is_null() const noexcept

Get NULL status.

str_sparse_vector< CharType, BV, STR_SIZE > str_sparse_vector_type

void go_to(size_type pos) noexcept

re-position to a specified position

str_sparse_vector_type::bvector_type bvector_type

void set_substr(unsigned from, unsigned len=0) noexcept

setup iterator to retrieve a sub-string of a string

bool operator>=(const const_iterator &it) const noexcept

long long difference_type

const str_sparse_vector_type * sv_

bool operator<(const const_iterator &it) const noexcept

str_sparse_vector_type::size_type size_type

str_sparse_vector_type::value_type value_type

string_view_type get_string_view() const

Get current string as string_view.

void advance() noexcept

advance iterator forward by one

bool valid() const noexcept

Returns true if iterator is at a valid position.

bool operator>(const const_iterator &it) const noexcept

const_iterator & operator++(int) noexcept

Advance to the next available value.

std::basic_string_view< CharType > string_view_type

const_iterator & operator++() noexcept

Advance to the next available value.

Reference class to access elements via common [] operator.

const_reference(const str_sparse_vector< CharType, BV, STR_SIZE > &str_sv, size_type idx)

const str_sparse_vector< CharType, BV, STR_SIZE > & str_sv_

const value_type * get() const noexcept

bool operator==(const const_reference &ref) const noexcept

bool is_null() const noexcept

bm::heap_vector< CharType, typename bvector_type::allocator_type, true > bufffer_type

Reference class to access elements via common [] operator.

str_sparse_vector< CharType, BV, STR_SIZE > & str_sv_

reference(str_sparse_vector< CharType, BV, STR_SIZE > &str_sv, size_type idx)

bool is_null() const noexcept

reference & operator=(const value_type *str)

const value_type * get() const noexcept

bool operator==(const reference &ref) const noexcept

reference & operator=(const reference &ref)

succinct sparse vector for strings with compression using bit-slicing ( transposition) method

void insert(size_type idx, const value_type *str)

insert the specified element

static bool remap_n_tosv_2way(value_type *sv_str, value_type *str_cp, size_type buf_size, const value_type *str, size_t in_len, const slice_octet_matrix_type &octet_remap_matrix2) noexcept

void calc_octet_stat(octet_freq_matrix_type &octet_matrix) const

void clear() noexcept

resize to zero, free memory, reset remapping

void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename str_sparse_vector< CharType, BV, STR_SIZE >::statistics *stat=0)

run memory optimization for all vector planes

size_type get(size_type idx, value_type *str, size_type buf_size) const noexcept

get specified element

void set_value(size_type idx, const value_type *str)

set value without checking boundaries

void resize(size_type sz)

resize vector

bool empty() const

return true if vector is empty

static bool remap_tosv(value_type *sv_str, size_type buf_size, const value_type *str, const slice_octet_matrix_type &octet_remap_matrix2) noexcept

void recalc_remap_matrix2()

const_iterator get_const_iterator(size_type idx) const noexcept

Get const_itertor re-positioned to specific element.

int compare_remap(size_type idx, const value_type *str) const noexcept

Variant of compare for remapped vectors.

static constexpr bool is_str() noexcept

bool is_ro() const noexcept

Returns true if vector is read-only.

static size_type max_str()

get maximum string length capacity

unsigned char * init_remap_buffer()

void set_null(size_type idx)

set NULL status for the specified element Vector is resized automatically

void set_null(const bvector_type &bv_idx)

Set NULL all elements set as 1 in the argument vector.

void remap_from_impl(const str_sparse_vector &str_sv, octet_freq_matrix_type *omatrix, bool move_data)

Remap from implementation, please note that move_data flag can violate cosnt-ness.

slice_octet_matrix_type remap_matrix1_

octet remap table 1

const bvector_type * bvector_type_const_ptr

str_sparse_vector< CharType, BV, STR_SIZE > & merge(str_sparse_vector< CharType, BV, STR_SIZE > &str_sv)

merge with another sparse vector using OR operation Merge is different from join(),...

void assign(size_type idx, const StrType &str)

set specified element with bounds checking and automatic resize

bool remap_tosv(value_type *sv_str, size_type buf_size, const value_type *str) const noexcept

str_sparse_vector(bm::null_support null_able=bm::no_null, allocation_policy_type ap=allocation_policy_type(), size_type bv_max_size=bm::id_max, const allocator_type &alloc=allocator_type())

Sparse vector constructor.

bm::dynamic_heap_matrix< unsigned char, allocator_type > slice_octet_matrix_type

Matrix of character remappings.

void remap_from(const str_sparse_vector &str_sv, octet_freq_matrix_type *omatrix=0)

Build remapping profile and load content from another sparse vector Remapped vector likely saves memo...

void sync_size() noexcept

recalculate size to exclude tail NULL elements After this call size() will return the true size of th...

size_type size() const

return size of the vector

void build_octet_remap(slice_octet_matrix_type &octet_remap_matrix1, slice_octet_matrix_type &octet_remap_matrix2, octet_freq_matrix_type &octet_occupancy_matrix) const

void keep(const bvector_type &bv_idx)

Set NULL all elements NOT set as 1 in the argument vector.

void import_char_slice(const unsigned_value_type *ch_slice, unsigned ch_acc, size_type char_slice_idx, size_type idx_from, size_type imp_size)

bool is_remap() const noexcept

Get character remapping status (true | false)

void sync(bool force, bool sync_size)

syncronize internal structures

bm::basic_bmatrix< BV > bmatrix_type

unsigned common_prefix_length(size_type idx1, size_type idx2, value_type *prefix_buf=0) const noexcept

Find size of common prefix between two vector elements in octets.

void insert_value(size_type idx, const value_type *str)

insert value without checking boundaries

CharType * value_type_prt

void push_back(const StrType &str)

push back a string

void import_no_check(CharMatrix &cmatr, size_type idx_from, size_type imp_size, bool set_not_null=true)

bvector_type::allocation_policy allocation_policy_type

void clear(const bvector_type &bv_idx)

Set vector elements spcified by argument bit-vector to empty Note that set to empty elements are NOT ...

void freeze()

Turn sparse vector into immutable mode Read-only (immutable) vector uses less memory and allows faste...

BV::allocator_type allocator_type

void insert_value_no_null(size_type idx, const value_type *str)

insert value without checking boundaries or support of NULL

bm::dynamic_heap_matrix< size_t, allocator_type > octet_freq_matrix_type

Matrix of character frequencies (for optimal code remap)

slice_octet_matrix_type remap_matrix2_

octet remap table 2

bool resolve_range(size_type from, size_type to, size_type *idx_from, size_type *idx_to) const

parent_type::unsigned_value_type unsigned_value_type

void import_back(CharMatrix &cmatr, size_type imp_size)

Bulk push-back import of strings from a C-style matrix of chars.

static int compare_str(const value_type *str1, const value_type *str2) noexcept

size_type decode(CharMatrix &cmatr, size_type idx_from, size_type dec_size, bool zero_mem=true) const

Bulk export strings to a C-style matrix of chars.

void resize_internal(size_type sz)

bool try_get(size_type idx, StrType &str) const

get specified string element if NOT NULL Template method expects an STL-compatible type basic_string<...

bool remap_n_tosv_2way(value_type *sv_str, value_type *str_cp, size_type buf_size, const value_type *str, size_t in_len) const noexcept

void erase(size_type idx)

erase the specified element

size_type effective_size() const noexcept

size of sparse vector (may be different for RSC)

const unsigned char * get_remap_buffer() const

bvector_type * bvector_type_ptr

void insert(size_type idx, const StrType &str)

insert STL string

static void throw_bad_value(const char *err_msg)

throw domain error

void get(size_type idx, StrType &str) const

get specified string element Template method expects an STL-compatible type basic_string<>

reference operator[](size_type idx)

Operator to get write access to an element.

void push_back(const value_type *str)

push back a string (zero terminated)

str_sparse_vector< CharType, BV, STR_SIZE > & operator=(const str_sparse_vector< CharType, BV, STR_SIZE > &str_sv)

static constexpr bool is_compressed() noexcept

various type traits

size_type decode_substr(CharMatrix &cmatr, size_type idx_from, size_type dec_size, unsigned substr_from, unsigned substr_to, bool zero_mem=true) const

Bulk export strings to a C-style matrix of chars.

const remap_matrix_type * get_remap_matrix() const

base_sparse_vector< CharType, BV, STR_SIZE > parent_type

void push_back_null()

push back NULL value

size_type effective_vector_max() const

get effective string length used in vector

static bool remap_fromsv(value_type *str, size_type buf_size, const value_type *sv_str, const slice_octet_matrix_type &octet_remap_matrix1) noexcept

int compare_nomap(size_type idx, const value_type *str) const noexcept

Variant of compare for non-mapped vectors.

void remap()

Build remapping profile and re-load content to save memory.

back_insert_iterator get_back_inserter()

Provide back insert iterator Back insert iterator implements buffered insertion, which is faster,...

const_iterator begin() const noexcept

Provide const iterator access to container content.

void calc_stat(struct str_sparse_vector< CharType, BV, STR_SIZE >::statistics *st) const noexcept

Calculates memory statistics.

slice_octet_matrix_type remap_matrix_type

bvector_type::enumerator bvector_enumerator_type

void set_value_no_null(size_type idx, const value_type *str)

set value without checking boundaries or support of NULL

void copy_range(const str_sparse_vector< CharType, BV, STR_SIZE > &sv, size_type left, size_type right, bm::null_support slice_null=bm::use_null)

copy range of values from another sparse vector

size_t remap_size() const

bool equal(const str_sparse_vector< CharType, BV, STR_SIZE > &sv, bm::null_support null_able=bm::use_null) const noexcept

check if another sparse vector has the same content and size

static void throw_range_error(const char *err_msg)

throw range error

str_sparse_vector< CharType, BV, STR_SIZE > & clear_range(size_type left, size_type right, bool set_null=false)

clear range (assign bit 0 for all planes)

void swap(size_type idx1, size_type idx2)

swap two vector elements between each other

size_type size_internal() const

void set(size_type idx, const value_type *str)

set specified element with bounds checking and automatic resize

const_iterator end() const noexcept

Provide const iterator access to the end.

unsigned remap_flags_

remapping status

size_type effective_max_str() const noexcept

get effective string length used in vector Calculate and returns efficiency, how close are we to the ...

static bool find_rank(size_type rank, size_type &pos) noexcept

find position of compressed element by its rank

remap_matrix_type * get_remap_matrix()

int compare(size_type idx, const value_type *str) const noexcept

Compare vector element with argument lexicographically.

const const_reference operator[](size_type idx) const

Operator to get read access to an element.

void keep_range(size_type left, size_type right, bm::null_support slice_null=bm::use_null)

Keep only specified interval in the sparse vector, clear all other elements.

str_sparse_vector(str_sparse_vector< CharType, BV, STR_SIZE > &&str_sv) noexcept

allocator_type::allocator_pool_type allocator_pool_type

bvector_type::size_type size_type

void clear_all(bool free_mem, unsigned remap=0) noexcept

resize to zero, free memory

static const char * str(char *buf, int n)

void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)

bm::id_t word_bitcount(bm::id_t w) noexcept

unsigned bit_list(T w, B *bits) noexcept

Unpacks word into list of ON bit indexes.

null_support

NULL-able value support.

@ use_null

support "non-assigned" or "NULL" logic

@ no_null

do not support NULL values

void xor_swap(W &x, W &y) noexcept

XOR swap two variables.

int for_each_bit_range_no_check(const BV &bv, typename BV::size_type left, typename BV::size_type right, Func &bit_functor)

Implementation of for_each_bit_range without boilerplave checks.

bool find_first_nz(const VT *arr, SZ arr_size, SZ *found_idx) noexcept

Find max non-zero value in an array.

bool find_max_nz(const VT *arr, SZ arr_size, SZ *found_idx) noexcept

Find max non-zero value in an array.

unsigned long long int id64_t

@ COPY_RTABLES

copy remap tables only (without data)

const unsigned gap_max_bits

const unsigned set_block_shift

bool has_zero_byte_u64(bm::id64_t v) noexcept

Returns true if INT64 contains 0 octet.

double value_type

The numeric datatype used by the parser.

const struct ncbi::grid::netcache::search::fields::SIZE size

void resize(vector< SMethodDef > &container)

static const BitmapCharRec ch3

static const BitmapCharRec ch1

static const BitmapCharRec ch0

static const BitmapCharRec ch2

double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)

static SLJIT_INLINE sljit_ins st(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

#define row(bind, expected)

Structure with statistical information about memory allocation footprint, serialization projection,...


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4