{
return equal(lhs); }
73 if(
size_!= lhs.size_)
88 template<
typenameBVAlloc>
120in_buf.byte_buf_ = 0;
121this->
size_= in_buf.size_;
123in_buf.size_ = in_buf.capacity_ = 0;
156other.byte_buf_ = btmp;
169this->
byte_buf_= other.byte_buf_; other.byte_buf_ = 0;
170this->
size_= other.size_;
185 void copy_from(
const unsigned char* in_buf,
size_tin_size)
192this->
size_= in_size;
200 unsigned char*
resize(
size_tnew_size,
boolcopy_content =
true)
204this->
size_= new_size;
209tmp_buffer = *
this;
210this->
swap(tmp_buffer);
211this->
size_= new_size;
218 unsigned char*
shrink(
size_tnew_size)
223this->
size_= new_size;
227 throwstd::logic_error(
"BM: shrink ALLOC size >= capacity");
229BM_THROW(BM_ERR_BADALLOC););
237this->
size_= new_size;
252tmp_buffer = *
this;
253this->
swap(tmp_buffer);
279this->
swap(tmp_buffer);
323 bm::word_t* p = allocator_type::allocate(words, 0);
340 template<
typenameVal,
typenameBVAlloc,
booltrivial_type>
361 unsigned char*p = this_data + (
i* v_size);
378 unsigned char*p = this_data + (
i* v_size);
393 unsigned char*p = this_data + (
i* v_size);
468 ifconstexpr (trivial_type)
488 ifconstexpr (!trivial_type)
493 unsigned char*p = this_data + (
i* v_size);
502 ifconstexpr (!trivial_type)
507 unsigned char*p = this_data + (
i* v_size);
544 unsigned char*p =
buffer_.
data() + (sz * v_size);
557 unsigned char*p =
buffer_.
data() + (sz * v_size);
572 unsigned char*p =
buffer_.
data() + (sz * v_size);
597 throwstd::range_error(err_msg);
616 template<
typenameVal,
size_tROWS,
size_tCOLS,
typenameBVAlloc>
656(void) rows_in; (void) cols_in; (void) copy_content;
662 void init(
boolset_z=
false)
736 template<
typenameVal,
typenameBVAlloc>
758 void init(
boolset_z=
false)
779 if(copy_content && this->
is_init())
782tmp_matrix(rows_in, cols_in);
783tmp_matrix.
init(
true);
785this->
swap(tmp_matrix);
810 for(size_type j = 0; j < csize; ++j)
811 r[j] = other_row[j];
912 if(
cols() != dhm.cols())
914 if(
rows() != dhm.rows())
931 return equal_sz(dhm, dim_rows, dim_cols);
937 template<
typenameVECT_TYPE>
944VECT_TYPE v0 = vect[
i];
947vect[
i] = VECT_TYPE(remap_v);
951 template<
typenameVECT_TYPE>
958VECT_TYPE v0 = vect[
i];
963vect[
i] = VECT_TYPE(remap_v);
972 template<
typenameACC>
1023 template<
typenameValue,
typenameBVAlloc,
booltrivial_type>
#define BM_ASSERT_THROW(x, xerrcode)
Bit manipulation primitives (internal)
unsigned char * byte_buf_
byte buffer pointer to hold data
bool equal(const byte_buffer_ptr &lhs) const noexcept
return true if content and size is the same
bool operator==(const byte_buffer_ptr &lhs) const noexcept
const unsigned char * data() const noexcept
const access to buffer memory
void set_buf(unsigned char *in_buf, size_t in_size) noexcept
Set buffer pointer.
byte_buffer_ptr() 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.
size_t size_
current buffer size
byte_buffer_ptr(unsigned char *in_buf, size_t in_size) noexcept
construct byte buffer pointer
Byte buffer template, extention of byte_buffer_ptr memory management.
size_t alloc_factor_
number of blocks allocated for buffer
static size_t compute_words(size_t capacity) noexcept
compute number of words for the desired capacity
void swap(byte_buffer &other) noexcept
swap content with another buffer
size_t capacity() const noexcept
Get buffer capacity.
unsigned char * resize(size_t new_size, bool copy_content=true)
adjust current size (buffer content can be preserved)
void optimize()
try to shrink the capacity to more optimal size
byte_buffer(size_t in_capacity)
void reinit(size_t new_capacity)
reserve new capacity (buffer content NOT preserved, size set to 0)
byte_buffer(const byte_buffer &lhs)
byte_buffer & operator=(byte_buffer &&lhs) noexcept
Move assignment operator.
BVAlloc bv_allocator_type
void resize_no_check(size_t new_size) noexcept
adjust current size (no need to reallocate)
size_t capacity_
current capacity
void reallocate(size_t new_capacity)
reserve new capacity (buffer content NOT preserved, size set to 0)
void release()
Free underlying memory.
void move_from(byte_buffer &other) noexcept
take/move content from another buffer
void set_buf(unsigned char *buf, size_t size)
Override from the base class.
void allocate(size_t new_capacity)
void reserve(size_t new_capacity)
reserve new capacity (buffer content preserved)
byte_buffer(byte_buffer &&in_buf) noexcept
Move constructor.
void copy_from(const unsigned char *in_buf, size_t in_size)
copy data from an external buffer
void free_buffer()
Free mmemory.
size_t mem_usage() const noexcept
return memory consumtion
byte_buffer & operator=(const byte_buffer &lhs)
unsigned char * shrink(size_t new_size)
shrink current size without reallocation (buffer content preserved)
bv_allocator_type::block_allocator_type allocator_type
Heap allocated dynamic resizable scalar-type matrix.
bool equal_overlap(const dynamic_heap_matrix< Val, BVAlloc > &dhm) const noexcept
Approximate equals on the rows-columns overlap area.
void set(size_type row_idx, size_type col_idx, value_type v) noexcept
const value_type * row(size_type row_idx) const noexcept
buffer_type & get_buffer() noexcept
Get low-level buffer access.
const value_type & get(size_type row_idx, size_type col_idx) const noexcept
void swap(dynamic_heap_matrix &other) noexcept
bool equal(const dynamic_heap_matrix< Val, BVAlloc > &dhm) const noexcept
Check if two matrix objects matches on the content.
value_type get(size_type row_idx, size_type col_idx) noexcept
void move_from(dynamic_heap_matrix &other) noexcept
void free() noexcept
Free memory.
size_type rows() const noexcept
const buffer_type & get_buffer() const noexcept
Get low-level buffer access.
size_type cols() const noexcept
void remapz(VECT_TYPE *vect) const noexcept
void remap(VECT_TYPE *vect, size_type size) const noexcept
value_type * row(size_type row_idx) noexcept
BVAlloc bv_allocator_type
void set_zero() noexcept
memset all buffer to all zeroes
void replicate_triange() noexcept
copy values of the left triangle elements to the right triangle (operation specific to matrices with ...
static size_type size_in_bytes(size_type rows, size_type cols) noexcept
void init_resize(size_type rows_in, size_type cols_in)
bool is_init() const noexcept
void resize(size_type rows_in, size_type cols_in, bool copy_content=true)
dynamic_heap_matrix(size_type rows_in=0, size_type cols_in=0) noexcept
By default object is constructed but NOT allocated.
void copy_from(const dynamic_heap_matrix< value_type, bv_allocator_type > &other) noexcept
bm::byte_buffer< bv_allocator_type > buffer_type
size_type size_in_bytes() const noexcept
size_type row_size_in_bytes() const noexcept
void sum(ACC &acc, size_type row_idx) const noexcept
Sum of row elements.
bool equal_sz(const dynamic_heap_matrix< Val, BVAlloc > &dhm, size_type dim_rows, size_type dim_cols) const noexcept
void init(bool set_z=false)
Post construction allocation, initialization.
Heap allocated scalar-type matrix.
BVAlloc bv_allocator_type
buffer_type & get_buffer() noexcept
Get low-level buffer access.
void resize(size_type rows_in, size_type cols_in, bool copy_content=true)
value_type * row(size_type row_idx) noexcept
const buffer_type & get_buffer() const noexcept
Get low-level buffer access.
heap_matrix(bool init_buf)
bm::byte_buffer< bv_allocator_type > buffer_type
value_type get(size_type row_idx, size_type col_idx) const noexcept
heap_matrix() noexcept
By default object is constructed NOT allocated.
bool is_init() const noexcept
const value_type * row(size_type row_idx) const noexcept
void swap(heap_matrix &other) noexcept
void set_zero() noexcept
memset all buffer to all zeroes
void init(bool set_z=false)
Post construction allocation, initialization.
static size_t cols() noexcept
void move_from(heap_matrix &other) noexcept
static size_t rows() noexcept
Simple heap allocated vector based on bvector allocator.
value_type * data() const noexcept
void resize(size_type new_size)
vector resize
void resize_no_check(size_type new_size)
resize without content preservation or capacity verification
heap_vector(const heap_vector< Val, BVAlloc, trivial_type > &hv)
value_type & at(size_type pos)
size_type capacity() const noexcept
value_type & add()
Add element to the end of the vector, return reference.
size_type size() const noexcept
const value_type * begin() const noexcept
bm::byte_buffer< bv_allocator_type > buffer_type
void reset() noexcept
Quick resize to zero.
void push_back_no_check(const value_type &v) noexcept
Push back value without capacity check.
void push_back(const value_type &v)
push new element to the back of the vector
static size_type value_size() noexcept
void swap(heap_vector< Val, BVAlloc, trivial_type > &other) noexcept
const value_type & at(size_type pos) const
BVAlloc bv_allocator_type
bool empty() const noexcept
void reserve(size_type new_size)
heap_vector & operator=(const heap_vector< Val, BVAlloc, trivial_type > &hv)
value_type * resize_no_copy(size_type new_size)
resize without content preservation
const value_type & operator[](size_type pos) const noexcept
value_type & operator[](size_type pos) noexcept
buffer_type::size_type size_type
void throw_range_error(const char *err_msg) const
void resize_internal(size_type new_size)
Simple queue based on memory controlled dynamic vector.
heap_vector_type::size_type size_type
void reserve(size_type capacity)
Capacity reservation.
bool empty() const noexcept
Return true if queue has no elements.
bm::heap_vector< Value, bv_allocator_type, trivial_type > heap_vector_type
simple_queue & operator=(const simple_queue &)=delete
size_type size() const noexcept
bool try_pop(value_type &front_value) noexcept
Try to extract the front element from the queue.
const value_type & front() const noexcept
Return front element.
heap_vector_type queue_vector_
bool try_push(const value_type &v) noexcept
Try push into the queue if capacity allows.
BVAlloc bv_allocator_type
void push(const value_type &v)
Push value into the queue (with re-allocation)
void pop() noexcept
Pop the front element.
simple_queue(const simple_queue &)=delete
size_type front_idx_
index of the front element
void xor_swap(W &x, W &y) noexcept
XOR swap two variables.
const struct ncbi::grid::netcache::search::fields::SIZE size
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static const sljit_gpr r1
static const sljit_gpr r2
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