21 _buf =
new unsigned char[size];
27 _buf =
new unsigned char[rhs._buf_sz];
28 _buf_sz = rhs._buf_sz;
29 memcpy(_buf, rhs._buf, rhs._buf_sz);
34 _buf =
new unsigned char[rhs._buf_sz];
35 _buf_sz = rhs._buf_sz;
36 memcpy(_buf, rhs._buf, rhs._buf_sz);
42 if (_buf)
delete[] _buf;
45 void *
GetBuf()
const {
return (_buf); }
86COMMON_API size_t LinearizeCoords(
const std::vector<size_t> &coords,
const std::vector<size_t> &min,
const std::vector<size_t> &max);
96COMMON_API std::vector<size_t>
IncrementCoords(
const std::vector<size_t> &min,
const std::vector<size_t> &max, std::vector<size_t> counter,
int dim = 0);
102COMMON_API std::vector<size_t>
Dims(
const std::vector<size_t> &min,
const std::vector<size_t> &max);
127COMMON_API void Transpose(
const float *a,
float *b,
size_t p1,
size_t m1,
size_t s1,
size_t p2,
size_t m2,
size_t s2);
157COMMON_API bool NearlyEqual(
float a,
float b,
float epsilon = std::numeric_limits<float>::epsilon(),
float abs_th = std::numeric_limits<float>::epsilon());
void * Alloc(size_t size)
SmartBuf & operator=(const SmartBuf &rhs)
SmartBuf(const SmartBuf &rhs)
size_t GetBufSize() const
COMMON_API void Transpose(const float *a, float *b, size_t p1, size_t m1, size_t s1, size_t p2, size_t m2, size_t s2)
COMMON_API bool BinarySearchRange(const std::vector< double > &sorted, double x, size_t &i)
COMMON_API void IncrementCoords(const size_t *min, const size_t *max, size_t *counter, size_t n, int dim)
COMMON_API size_t VProduct(const size_t *a, size_t n)
COMMON_API size_t LinearizeCoords(const size_t *coords, const size_t *dims, size_t n)
COMMON_API void VectorizeCoords(size_t offset, const size_t *min, const size_t *max, size_t *coords, size_t n)
COMMON_API std::vector< size_t > Dims(const std::vector< size_t > &min, const std::vector< size_t > &max)
COMMON_API bool NearlyEqual(float a, float b, float epsilon=std::numeric_limits< float >::epsilon(), float abs_th=std::numeric_limits< float >::epsilon())