SHOGUN
v3.2.0
|
shogun vector
Definition at line 29 of file SGVector.h.
Public Member Functions | |
SGVector () | |
SGVector (T *v, index_t len, bool ref_counting=true) | |
SGVector (index_t len, bool ref_counting=true) | |
SGVector (const SGVector &orig) | |
void | set (SGVector< T > orig) |
virtual | ~SGVector () |
int32_t | size () const |
operator T * () | |
void | zero () |
void | set_const (T const_elem) |
void | range_fill (T start=0) |
void | random (T min_value, T max_value) |
void | randperm () |
index_t | find_position_to_insert (T element) |
void | qsort () |
SGVector< index_t > | argsort () |
bool | is_sorted () const |
SGVector< T > | clone () const |
SGVector< T > | get () |
const T & | get_element (index_t index) |
void | set_element (const T &p_element, index_t index) |
void | resize_vector (int32_t n) |
const T & | operator[] (uint64_t index) const |
const T & | operator[] (int64_t index) const |
const T & | operator[] (uint32_t index) const |
const T & | operator[] (int32_t index) const |
T & | operator[] (uint64_t index) |
T & | operator[] (int64_t index) |
T & | operator[] (uint32_t index) |
T & | operator[] (int32_t index) |
void | add (const SGVector< T > x) |
void | add (const SGSparseVector< T > &x) |
void | add (const T x) |
SGVector< T > | operator+ (SGVector< T > x) |
SGVector< T > | operator+= (SGVector< T > x) |
SGVector< T > | operator+= (SGSparseVector< T > &x) |
bool | equals (SGVector< T > &other) |
void | permute () |
void | permute (CRandom *rand) |
T | product () |
return product(vec) | |
void | display_size () const |
void | display_vector (const char *name="vector", const char *prefix="") const |
SGVector< index_t > | find (T elem) |
template<typename Predicate > | |
SGVector< index_t > | find_if (Predicate p) |
void | scale (T alpha) |
scale vector inplace | |
float64_t | mean () const |
void | load (CFile *loader) |
void | save (CFile *saver) |
void | abs () |
absolute value of vector elements | |
void | acos () |
arc cosine of vector elements | |
void | asin () |
arc sine of vector elements | |
void | atan () |
arc tangent of vector elements | |
void | atan2 (T x) |
atan2 of vector elements | |
void | cos () |
cosine of vector elements | |
void | cosh () |
hyperbolic cosine of vector elements | |
void | exp () |
exponential of vector elements | |
void | log () |
natural logarithm of vector elements | |
void | log10 () |
common logarithm of vector elements | |
void | pow (T q) |
power of vector elements | |
void | sin () |
sine of vector elements | |
void | sinh () |
hyperbolic sine of vector elements | |
void | sqrt () |
square root of vector elements | |
void | tan () |
tangent of vector elements | |
void | tanh () |
hyperbolic tangent of vector elements | |
SGVector< float64_t > | get_real () |
SGVector< float64_t > | get_imag () |
template<> | |
void | zero () |
template<> | |
SGVector< index_t > | argsort () |
template<> | |
bool | is_sorted () const |
template<> | |
index_t | find_position_to_insert (complex128_t element) |
template<> | |
void | range_fill_vector (complex128_t *vec, int32_t len, complex128_t start) |
template<> | |
void | display_vector (const bool *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const uint8_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const int8_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const uint16_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const int16_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const int32_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const uint32_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const int64_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const uint64_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const float32_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const float64_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const floatmax_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | display_vector (const complex128_t *vector, int32_t n, const char *name, const char *prefix) |
template<> | |
void | vec1_plus_scalar_times_vec2 (float64_t *vec1, float64_t scalar, const float64_t *vec2, int32_t n) |
template<> | |
void | vec1_plus_scalar_times_vec2 (float32_t *vec1, float32_t scalar, const float32_t *vec2, int32_t n) |
template<> | |
void | random_vector (complex128_t *vec, int32_t len, complex128_t min_value, complex128_t max_value) |
template<> | |
SGVector< complex128_t > | randperm_vec (int32_t n) |
template<> | |
complex128_t * | randperm (int32_t n) |
template<> | |
void | randperm (complex128_t *perm, int32_t n) |
template<> | |
bool | twonorm (const bool *x, int32_t len) |
template<> | |
char | twonorm (const char *x, int32_t len) |
template<> | |
int8_t | twonorm (const int8_t *x, int32_t len) |
template<> | |
uint8_t | twonorm (const uint8_t *x, int32_t len) |
template<> | |
int16_t | twonorm (const int16_t *x, int32_t len) |
template<> | |
uint16_t | twonorm (const uint16_t *x, int32_t len) |
template<> | |
int32_t | twonorm (const int32_t *x, int32_t len) |
template<> | |
uint32_t | twonorm (const uint32_t *x, int32_t len) |
template<> | |
int64_t | twonorm (const int64_t *x, int32_t len) |
template<> | |
uint64_t | twonorm (const uint64_t *x, int32_t len) |
template<> | |
float32_t | twonorm (const float32_t *x, int32_t len) |
template<> | |
float64_t | twonorm (const float64_t *v, int32_t n) |
template<> | |
floatmax_t | twonorm (const floatmax_t *x, int32_t len) |
template<> | |
complex128_t | twonorm (const complex128_t *x, int32_t len) |
template<> | |
complex128_t | qsq (complex128_t *x, int32_t len, float64_t q) |
template<> | |
complex128_t | qnorm (complex128_t *x, int32_t len, float64_t q) |
template<> | |
float64_t | max_abs (float64_t *vec, int32_t len) |
template<> | |
float32_t | max_abs (float32_t *vec, int32_t len) |
template<> | |
complex128_t | max_abs (complex128_t *vec, int32_t len) |
template<> | |
int32_t | arg_max_abs (float64_t *vec, int32_t inc, int32_t len, float64_t *maxv_ptr) |
template<> | |
int32_t | arg_max_abs (float32_t *vec, int32_t inc, int32_t len, float32_t *maxv_ptr) |
template<> | |
int32_t | arg_max_abs (complex128_t *vec, int32_t inc, int32_t len, complex128_t *maxv_ptr) |
template<> | |
int32_t | arg_max (complex128_t *vec, int32_t inc, int32_t len, complex128_t *maxv_ptr) |
template<> | |
int32_t | arg_min (complex128_t *vec, int32_t inc, int32_t len, complex128_t *minv_ptr) |
template<> | |
float64_t | sum_abs (float64_t *vec, int32_t len) |
template<> | |
float32_t | sum_abs (float32_t *vec, int32_t len) |
template<> | |
int32_t | unique (complex128_t *output, int32_t size) |
template<> | |
void | scale_vector (float64_t alpha, float64_t *vec, int32_t len) |
template<> | |
void | scale_vector (float32_t alpha, float32_t *vec, int32_t len) |
template<> | |
float64_t | mean () const |
template<> | |
void | load (CFile *loader) |
template<> | |
void | save (CFile *saver) |
template<> | |
float64_t * | linspace (complex128_t start, complex128_t end, int32_t n) |
template<> | |
void | pow (complex128_t q) |
int32_t | ref_count () |
Static Public Member Functions | |
static SGVector< T > | randperm_vec (int32_t n) |
static T * | randperm (int32_t n) |
static SGVector< float64_t > | linspace_vec (T start, T end, int32_t n) |
static float64_t * | linspace (T start, T end, int32_t n) |
static T * | clone_vector (const T *vec, int32_t len) |
static void | fill_vector (T *vec, int32_t len, T value) |
static void | range_fill_vector (T *vec, int32_t len, T start=0) |
static void | random_vector (T *vec, int32_t len, T min_value, T max_value) |
static void | randperm (T *perm, int32_t n) |
static void | permute (T *vec, int32_t n) |
static void | permute (T *vec, int32_t n, CRandom *rand) |
static void | permute_vector (SGVector< T > vec) |
static T | twonorm (const T *x, int32_t len) |
|| x ||_2 | |
static float64_t | onenorm (T *x, int32_t len) |
|| x ||_1 | |
static T | qsq (T *x, int32_t len, float64_t q) |
|| x ||_q^q | |
static T | qnorm (T *x, int32_t len, float64_t q) |
|| x ||_q | |
static void | vec1_plus_scalar_times_vec2 (T *vec1, const T scalar, const T *vec2, int32_t n) |
x=x+alpha*y | |
static float64_t | dot (const bool *v1, const bool *v2, int32_t n) |
compute dot product between v1 and v2 (blas optimized) | |
static floatmax_t | dot (const floatmax_t *v1, const floatmax_t *v2, int32_t n) |
compute dot product between v1 and v2 (blas optimized) | |
static float64_t | dot (const float64_t *v1, const float64_t *v2, int32_t n) |
compute dot product between v1 and v2 (blas optimized) | |
static float32_t | dot (const float32_t *v1, const float32_t *v2, int32_t n) |
compute dot product between v1 and v2 (blas optimized) | |
static float64_t | dot (const uint64_t *v1, const uint64_t *v2, int32_t n) |
compute dot product between v1 and v2 (for 64bit unsigned ints) | |
static float64_t | dot (const int64_t *v1, const int64_t *v2, int32_t n) |
compute dot product between v1 and v2 (for 64bit ints) | |
static float64_t | dot (const int32_t *v1, const int32_t *v2, int32_t n) |
compute dot product between v1 and v2 (for 32bit ints) | |
static float64_t | dot (const uint32_t *v1, const uint32_t *v2, int32_t n) |
compute dot product between v1 and v2 (for 32bit unsigned ints) | |
static float64_t | dot (const uint16_t *v1, const uint16_t *v2, int32_t n) |
compute dot product between v1 and v2 (for 16bit unsigned ints) | |
static float64_t | dot (const int16_t *v1, const int16_t *v2, int32_t n) |
compute dot product between v1 and v2 (for 16bit unsigned ints) | |
static float64_t | dot (const char *v1, const char *v2, int32_t n) |
compute dot product between v1 and v2 (for 8bit (un)signed ints) | |
static float64_t | dot (const uint8_t *v1, const uint8_t *v2, int32_t n) |
compute dot product between v1 and v2 (for 8bit (un)signed ints) | |
static float64_t | dot (const int8_t *v1, const int8_t *v2, int32_t n) |
compute dot product between v1 and v2 (for 8bit (un)signed ints) | |
static float64_t | dot (const float64_t *v1, const char *v2, int32_t n) |
compute dot product between v1 and v2 | |
static void | vector_multiply (T *target, const T *v1, const T *v2, int32_t len) |
compute vector multiplication | |
static void | add (T *target, T alpha, const T *v1, T beta, const T *v2, int32_t len) |
target=alpha*vec1 + beta*vec2 | |
static void | add_scalar (T alpha, T *vec, int32_t len) |
add scalar to vector inplace | |
static void | scale_vector (T alpha, T *vec, int32_t len) |
scale vector inplace | |
static T | sum (T *vec, int32_t len) |
return sum(vec) | |
static T | sum (SGVector< T > vec) |
return sum(vec) | |
static T | product (T *vec, int32_t len) |
return the product of the vectors elements | |
static T | min (T *vec, int32_t len) |
static T | max_abs (T *vec, int32_t len) |
static T | max (T *vec, int32_t len) |
static int32_t | arg_max (T *vec, int32_t inc, int32_t len, T *maxv_ptr=NULL) |
return arg_max(vec) | |
static int32_t | arg_max_abs (T *vec, int32_t inc, int32_t len, T *maxv_ptr=NULL) |
return arg_max_abs(vec) | |
static int32_t | arg_min (T *vec, int32_t inc, int32_t len, T *minv_ptr=NULL) |
return arg_min(vec) | |
static T | sum_abs (T *vec, int32_t len) |
return sum(abs(vec)) | |
static bool | fequal (T x, T y, float64_t precision=1e-6) |
return sum(abs(vec)) | |
static int32_t | unique (T *output, int32_t size) |
static void | display_vector (const T *vector, int32_t n, const char *name="vector", const char *prefix="") |
display vector (useful for debugging) | |
static void | display_vector (const SGVector< T >, const char *name="vector", const char *prefix="") |
display vector (useful for debugging) | |
static SGMatrix< T > | convert_to_matrix (SGVector< T > vector, index_t nrows, index_t ncols, bool fortran_order) |
static void | convert_to_matrix (T *&matrix, index_t nrows, index_t ncols, const T *vector, int32_t vlen, bool fortran_order) |
Public Attributes | |
T * | vector |
index_t | vlen |
Protected Member Functions | |
virtual void | copy_data (const SGReferencedData &orig) |
virtual void | init_data () |
virtual void | free_data () |
void | copy_refcount (const SGReferencedData &orig) |
int32_t | ref () |
int32_t | unref () |
SGVector | ( | ) |
default constructor
Definition at line 73 of file SGVector.cpp.
constructor for setting params
Definition at line 79 of file SGVector.cpp.
constructor to create new vector in memory
Definition at line 85 of file SGVector.cpp.
copy constructor
Definition at line 92 of file SGVector.cpp.
~SGVector | ( | ) | [virtual] |
empty destructor
Definition at line 104 of file SGVector.cpp.
void abs | ( | ) |
absolute value of vector elements
void acos | ( | ) |
arc cosine of vector elements
add vector to current vector
x | add vector x to current vector |
Definition at line 329 of file SGVector.cpp.
void add | ( | const SGSparseVector< T > & | x | ) |
add sparse vector to current vector
x | add sparse vector x to current vector |
Definition at line 348 of file SGVector.cpp.
void add | ( | const T | x | ) |
add scalar to current vector
x | add vector x to current vector |
Definition at line 339 of file SGVector.cpp.
static void add | ( | T * | target, |
T | alpha, | ||
const T * | v1, | ||
T | beta, | ||
const T * | v2, | ||
int32_t | len | ||
) | [static] |
target=alpha*vec1 + beta*vec2
Definition at line 487 of file SGVector.h.
static void add_scalar | ( | T | alpha, |
T * | vec, | ||
int32_t | len | ||
) | [static] |
add scalar to vector inplace
Definition at line 496 of file SGVector.h.
int32_t arg_max | ( | T * | vec, |
int32_t | inc, | ||
int32_t | len, | ||
T * | maxv_ptr = NULL |
||
) | [static] |
return arg_max(vec)
Definition at line 1048 of file SGVector.cpp.
int32_t arg_max | ( | complex128_t * | vec, |
int32_t | inc, | ||
int32_t | len, | ||
complex128_t * | maxv_ptr | ||
) |
Definition at line 1068 of file SGVector.cpp.
int32_t arg_max_abs | ( | T * | vec, |
int32_t | inc, | ||
int32_t | len, | ||
T * | maxv_ptr = NULL |
||
) | [static] |
return arg_max_abs(vec)
Definition at line 1019 of file SGVector.cpp.
int32_t arg_max_abs | ( | float64_t * | vec, |
int32_t | inc, | ||
int32_t | len, | ||
float64_t * | maxv_ptr | ||
) |
Definition at line 994 of file SGVector.cpp.
int32_t arg_max_abs | ( | float32_t * | vec, |
int32_t | inc, | ||
int32_t | len, | ||
float32_t * | maxv_ptr | ||
) |
Definition at line 1006 of file SGVector.cpp.
int32_t arg_max_abs | ( | complex128_t * | vec, |
int32_t | inc, | ||
int32_t | len, | ||
complex128_t * | maxv_ptr | ||
) |
Definition at line 1039 of file SGVector.cpp.
int32_t arg_min | ( | T * | vec, |
int32_t | inc, | ||
int32_t | len, | ||
T * | minv_ptr = NULL |
||
) | [static] |
return arg_min(vec)
Definition at line 1079 of file SGVector.cpp.
int32_t arg_min | ( | complex128_t * | vec, |
int32_t | inc, | ||
int32_t | len, | ||
complex128_t * | minv_ptr | ||
) |
Definition at line 1099 of file SGVector.cpp.
get sorted index.
idx = v.argsort() is similar to Matlab [~, idx] = sort(v)
Definition at line 194 of file SGVector.cpp.
Definition at line 207 of file SGVector.cpp.
void asin | ( | ) |
arc sine of vector elements
void atan | ( | ) |
arc tangent of vector elements
void atan2 | ( | T | x | ) |
atan2 of vector elements
Definition at line 1314 of file SGVector.cpp.
clone vector
Definition at line 257 of file SGVector.cpp.
T * clone_vector | ( | const T * | vec, |
int32_t | len | ||
) | [static] |
clone vector
Definition at line 263 of file SGVector.cpp.
SGMatrix< T > convert_to_matrix | ( | SGVector< T > | vector, |
index_t | nrows, | ||
index_t | ncols, | ||
bool | fortran_order | ||
) | [static] |
create SGMatrix from linear vector
vector | source vector |
nrows | number of rows |
ncols | number of cols |
fortran_order | order of stroing matrix in linear vector true - column-major order (FORTRAN, MATLAB, R) false - row-major order (C, Python) |
Definition at line 1376 of file SGVector.cpp.
void convert_to_matrix | ( | T *& | matrix, |
index_t | nrows, | ||
index_t | ncols, | ||
const T * | vector, | ||
int32_t | vlen, | ||
bool | fortran_order | ||
) | [static] |
create matrix from linear vector
matrix | destination memory |
nrows | number of rows |
ncols | number of cols |
vector | source vector |
vlen | lenght of source vector |
fortran_order | order of stroing matrix in linear vector true - column-major order (FORTRAN, MATLAB, R) false - row-major order (C, Python) |
Definition at line 1390 of file SGVector.cpp.
void copy_data | ( | const SGReferencedData & | orig | ) | [protected, virtual] |
needs to be overridden to copy data
Implements SGReferencedData.
Definition at line 368 of file SGVector.cpp.
void copy_refcount | ( | const SGReferencedData & | orig | ) | [protected, inherited] |
copy refcount
Definition at line 58 of file SGReferencedData.cpp.
void cos | ( | ) |
cosine of vector elements
void cosh | ( | ) |
hyperbolic cosine of vector elements
void display_size | ( | ) | const |
display array size
Definition at line 362 of file SGVector.cpp.
void display_vector | ( | const bool * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 419 of file SGVector.cpp.
void display_vector | ( | const char * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 430 of file SGVector.cpp.
void display_vector | ( | const uint8_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 441 of file SGVector.cpp.
void display_vector | ( | const int8_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 452 of file SGVector.cpp.
void display_vector | ( | const uint16_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 463 of file SGVector.cpp.
void display_vector | ( | const int16_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 474 of file SGVector.cpp.
void display_vector | ( | const int32_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 485 of file SGVector.cpp.
void display_vector | ( | const uint32_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 496 of file SGVector.cpp.
void display_vector | ( | const int64_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 508 of file SGVector.cpp.
void display_vector | ( | const uint64_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 519 of file SGVector.cpp.
void display_vector | ( | const float32_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 530 of file SGVector.cpp.
void display_vector | ( | const float64_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 541 of file SGVector.cpp.
void display_vector | ( | const floatmax_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 552 of file SGVector.cpp.
void display_vector | ( | const complex128_t * | vector, |
int32_t | n, | ||
const char * | name, | ||
const char * | prefix | ||
) |
Definition at line 566 of file SGVector.cpp.
void display_vector | ( | const char * | name = "vector" , |
const char * | prefix = "" |
||
) | const |
display vector
Definition at line 405 of file SGVector.cpp.
static void display_vector | ( | const T * | vector, |
int32_t | n, | ||
const char * | name = "vector" , |
||
const char * | prefix = "" |
||
) | [static] |
display vector (useful for debugging)
void display_vector | ( | const SGVector< T > | vector, |
const char * | name = "vector" , |
||
const char * | prefix = "" |
||
) | [static] |
display vector (useful for debugging)
Definition at line 412 of file SGVector.cpp.
compute dot product between v1 and v2 (blas optimized)
Definition at line 344 of file SGVector.h.
static floatmax_t dot | ( | const floatmax_t * | v1, |
const floatmax_t * | v2, | ||
int32_t | n | ||
) | [static] |
compute dot product between v1 and v2 (blas optimized)
Definition at line 353 of file SGVector.h.
compute dot product between v1 and v2 (blas optimized)
Definition at line 614 of file SGVector.cpp.
compute dot product between v1 and v2 (blas optimized)
Definition at line 632 of file SGVector.cpp.
compute dot product between v1 and v2 (for 64bit unsigned ints)
Definition at line 369 of file SGVector.h.
compute dot product between v1 and v2 (for 64bit ints)
Definition at line 379 of file SGVector.h.
compute dot product between v1 and v2 (for 32bit ints)
Definition at line 390 of file SGVector.h.
compute dot product between v1 and v2 (for 32bit unsigned ints)
Definition at line 401 of file SGVector.h.
compute dot product between v1 and v2 (for 16bit unsigned ints)
Definition at line 412 of file SGVector.h.
compute dot product between v1 and v2 (for 16bit unsigned ints)
Definition at line 423 of file SGVector.h.
compute dot product between v1 and v2 (for 8bit (un)signed ints)
Definition at line 434 of file SGVector.h.
compute dot product between v1 and v2 (for 8bit (un)signed ints)
Definition at line 445 of file SGVector.h.
compute dot product between v1 and v2 (for 8bit (un)signed ints)
Definition at line 456 of file SGVector.h.
compute dot product between v1 and v2
Definition at line 467 of file SGVector.h.
equals method up to precision for vectors (element-wise)
other | vector to compare with |
Definition at line 390 of file SGVector.cpp.
void exp | ( | ) |
exponential of vector elements
return sum(abs(vec))
Definition at line 1138 of file SGVector.cpp.
void fill_vector | ( | T * | vec, |
int32_t | len, | ||
T | value | ||
) | [static] |
fill vector
Definition at line 271 of file SGVector.cpp.
find index for occurance of an element
elem | the element to find |
Definition at line 1166 of file SGVector.cpp.
find index for elements where the predicate returns true
p | the predicate, it should accept the value of the element and return a bool |
Definition at line 592 of file SGVector.h.
index_t find_position_to_insert | ( | T | element | ) |
For a sorted (ascending) vector, gets the index after the first element that is smaller than the given one
element | element to find index for |
Definition at line 237 of file SGVector.cpp.
index_t find_position_to_insert | ( | complex128_t | element | ) |
Definition at line 249 of file SGVector.cpp.
void free_data | ( | ) | [protected, virtual] |
needs to be overridden to free data
Implements SGReferencedData.
Definition at line 382 of file SGVector.cpp.
get the vector (no copying is done here)
Definition at line 169 of file SGVector.h.
const T & get_element | ( | index_t | index | ) |
get vector element at index
index | index |
Definition at line 293 of file SGVector.cpp.
imag part of a complex128_t vector
Definition at line 1367 of file SGVector.cpp.
real part of a complex128_t vector
Definition at line 1359 of file SGVector.cpp.
void init_data | ( | ) | [protected, virtual] |
needs to be overridden to initialize empty data
Implements SGReferencedData.
Definition at line 375 of file SGVector.cpp.
bool is_sorted | ( | ) | const |
check if vector is sorted
Definition at line 215 of file SGVector.cpp.
bool is_sorted | ( | ) | const |
Definition at line 230 of file SGVector.cpp.
Returns an array with n linearly spaced elements between start and end.
start | beginning of the interval to divide |
end | upper bound of the interval to divide |
n | number of elements used to divide the interval |
Definition at line 1336 of file SGVector.cpp.
float64_t * linspace | ( | complex128_t | start, |
complex128_t | end, | ||
int32_t | n | ||
) |
Definition at line 1345 of file SGVector.cpp.
SGVector< float64_t > linspace_vec | ( | T | start, |
T | end, | ||
int32_t | n | ||
) | [static] |
Returns a vector with n linearly spaced elements between start and end.
start | beginning of the interval to divide |
end | upper bound of the interval to divide |
n | number of elements used to divide the interval |
Definition at line 1330 of file SGVector.cpp.
load vector from file
loader | File object via which to load data |
Definition at line 1222 of file SGVector.cpp.
Definition at line 1237 of file SGVector.cpp.
void log | ( | ) |
natural logarithm of vector elements
void log10 | ( | ) |
common logarithm of vector elements
T max | ( | T * | vec, |
int32_t | len | ||
) | [static] |
Definition at line 981 of file SGVector.cpp.
T max_abs | ( | T * | vec, |
int32_t | len | ||
) | [static] |
Definition at line 961 of file SGVector.cpp.
Definition at line 939 of file SGVector.cpp.
Definition at line 949 of file SGVector.cpp.
complex128_t max_abs | ( | complex128_t * | vec, |
int32_t | len | ||
) |
Definition at line 973 of file SGVector.cpp.
compute the mean value of the vector
Definition at line 1205 of file SGVector.cpp.
Definition at line 1216 of file SGVector.cpp.
T min | ( | T * | vec, |
int32_t | len | ||
) | [static] |
Definition at line 926 of file SGVector.cpp.
|| x ||_1
Definition at line 882 of file SGVector.cpp.
operator T * | ( | ) |
cast to pointer
Definition at line 57 of file SGVector.h.
addition operator
Definition at line 318 of file SGVector.cpp.
inplace addition operator
Definition at line 298 of file SGVector.h.
SGVector<T> operator+= | ( | SGSparseVector< T > & | x | ) |
inplace addition operator for sparse vector
Definition at line 305 of file SGVector.h.
const T& operator[] | ( | uint64_t | index | ) | const |
operator overload for vector read only access
index | dimension to access |
Definition at line 201 of file SGVector.h.
const T& operator[] | ( | int64_t | index | ) | const |
operator overload for vector read only access
index | dimension to access |
Definition at line 211 of file SGVector.h.
const T& operator[] | ( | uint32_t | index | ) | const |
operator overload for vector read only access
index | dimension to access |
Definition at line 221 of file SGVector.h.
const T& operator[] | ( | int32_t | index | ) | const |
operator overload for vector read only access
index | dimension to access |
Definition at line 231 of file SGVector.h.
T& operator[] | ( | uint64_t | index | ) |
operator overload for vector r/w access
index | dimension to access |
Definition at line 241 of file SGVector.h.
T& operator[] | ( | int64_t | index | ) |
operator overload for vector r/w access
index | dimension to access |
Definition at line 251 of file SGVector.h.
T& operator[] | ( | uint32_t | index | ) |
operator overload for vector r/w access
index | dimension to access |
Definition at line 261 of file SGVector.h.
T& operator[] | ( | int32_t | index | ) |
operator overload for vector r/w access
index | dimension to access |
Definition at line 271 of file SGVector.h.
void permute | ( | T * | vec, |
int32_t | n | ||
) | [static] |
permute
Definition at line 710 of file SGVector.cpp.
permute with given CRandom state
Definition at line 717 of file SGVector.cpp.
void permute | ( | ) |
create a random permutation in place
Definition at line 724 of file SGVector.cpp.
create a random permutation with given CRandom state
Definition at line 730 of file SGVector.cpp.
void permute_vector | ( | SGVector< T > | vec | ) | [static] |
permute vector
Definition at line 736 of file SGVector.cpp.
void pow | ( | T | q | ) |
power of vector elements
Definition at line 1323 of file SGVector.cpp.
void pow | ( | complex128_t | q | ) |
Definition at line 1353 of file SGVector.cpp.
static T product | ( | T * | vec, |
int32_t | len | ||
) | [static] |
return the product of the vectors elements
Definition at line 522 of file SGVector.h.
T product | ( | ) |
return product(vec)
Definition at line 532 of file SGVector.h.
|| x ||_q
Definition at line 911 of file SGVector.cpp.
complex128_t qnorm | ( | complex128_t * | x, |
int32_t | len, | ||
float64_t | q | ||
) |
Definition at line 918 of file SGVector.cpp.
void qsort | ( | ) |
quicksort the vector it is sorted from in ascending (for type T)
Definition at line 169 of file SGVector.cpp.
|| x ||_q^q
Definition at line 893 of file SGVector.cpp.
complex128_t qsq | ( | complex128_t * | x, |
int32_t | len, | ||
float64_t | q | ||
) |
Definition at line 903 of file SGVector.cpp.
void random | ( | T | min_value, |
T | max_value | ||
) |
create random vector
min_value | [min_value,max_value] |
max_value |
Definition at line 153 of file SGVector.cpp.
void random_vector | ( | T * | vec, |
int32_t | len, | ||
T | min_value, | ||
T | max_value | ||
) | [static] |
random vector
Definition at line 650 of file SGVector.cpp.
void random_vector | ( | complex128_t * | vec, |
int32_t | len, | ||
complex128_t | min_value, | ||
complex128_t | max_value | ||
) |
Definition at line 657 of file SGVector.cpp.
void randperm | ( | ) |
Returns a random permutation of number from 0 to len-1
Definition at line 161 of file SGVector.cpp.
T * randperm | ( | int32_t | n | ) | [static] |
Returns a random permutation of number from 0 to n-1. Caller has to free memory.
n | range of permutation |
Definition at line 678 of file SGVector.cpp.
void randperm | ( | T * | perm, |
int32_t | n | ||
) | [static] |
random permatutaion
Definition at line 695 of file SGVector.cpp.
complex128_t * randperm | ( | int32_t | n | ) |
Definition at line 687 of file SGVector.cpp.
void randperm | ( | complex128_t * | perm, |
int32_t | n | ||
) |
Definition at line 703 of file SGVector.cpp.
SGVector< T > randperm_vec | ( | int32_t | n | ) | [static] |
Returns a random permutation of number from 0 to n-1
Definition at line 664 of file SGVector.cpp.
SGVector< complex128_t > randperm_vec | ( | int32_t | n | ) |
Definition at line 670 of file SGVector.cpp.
void range_fill | ( | T | start = 0 | ) |
range fill a vector with start...start+len-1
start | - value to be assigned to first element of vector |
Definition at line 145 of file SGVector.cpp.
void range_fill_vector | ( | T * | vec, |
int32_t | len, | ||
T | start = 0 |
||
) | [static] |
range fill vector
Definition at line 278 of file SGVector.cpp.
void range_fill_vector | ( | complex128_t * | vec, |
int32_t | len, | ||
complex128_t | start | ||
) |
Definition at line 285 of file SGVector.cpp.
int32_t ref | ( | ) | [protected, inherited] |
increase reference counter
Definition at line 67 of file SGReferencedData.cpp.
int32_t ref_count | ( | ) | [inherited] |
display reference counter
Definition at line 44 of file SGReferencedData.cpp.
void resize_vector | ( | int32_t | n | ) |
resize vector
n | new size |
Definition at line 307 of file SGVector.cpp.
save vector to file
saver | File object via which to save data |
Definition at line 1242 of file SGVector.cpp.
Definition at line 1252 of file SGVector.cpp.
void scale | ( | T | alpha | ) |
scale vector inplace
Definition at line 1200 of file SGVector.cpp.
void scale_vector | ( | T | alpha, |
T * | vec, | ||
int32_t | len | ||
) | [static] |
scale vector inplace
Definition at line 1179 of file SGVector.cpp.
void scale_vector | ( | float64_t | alpha, |
float64_t * | vec, | ||
int32_t | len | ||
) |
Definition at line 1187 of file SGVector.cpp.
void scale_vector | ( | float32_t | alpha, |
float32_t * | vec, | ||
int32_t | len | ||
) |
Definition at line 1193 of file SGVector.cpp.
wrapper for the copy constructor useful for SWIG interfaces
orig | vector to set |
Definition at line 98 of file SGVector.cpp.
void set_const | ( | T | const_elem | ) |
set vector to a constant
const_elem | - value to set vector to |
Definition at line 124 of file SGVector.cpp.
void set_element | ( | const T & | p_element, |
index_t | index | ||
) |
set vector element at index 'index' return false in case of trouble
p_element | vector element to set |
index | index |
Definition at line 300 of file SGVector.cpp.
void sin | ( | ) |
sine of vector elements
void sinh | ( | ) |
hyperbolic sine of vector elements
int32_t size | ( | ) | const |
size
Definition at line 54 of file SGVector.h.
void sqrt | ( | ) |
square root of vector elements
static T sum | ( | T * | vec, |
int32_t | len | ||
) | [static] |
return sum(vec)
Definition at line 506 of file SGVector.h.
return sum(vec)
Definition at line 516 of file SGVector.h.
T sum_abs | ( | T * | vec, |
int32_t | len | ||
) | [static] |
return sum(abs(vec))
Definition at line 1109 of file SGVector.cpp.
Definition at line 1120 of file SGVector.cpp.
Definition at line 1128 of file SGVector.cpp.
void tan | ( | ) |
tangent of vector elements
void tanh | ( | ) |
hyperbolic tangent of vector elements
static T twonorm | ( | const T * | x, |
int32_t | len | ||
) | [static] |
|| x ||_2
bool twonorm | ( | const bool * | x, |
int32_t | len | ||
) |
Definition at line 746 of file SGVector.cpp.
char twonorm | ( | const char * | x, |
int32_t | len | ||
) |
Definition at line 753 of file SGVector.cpp.
int8_t twonorm | ( | const int8_t * | x, |
int32_t | len | ||
) |
Definition at line 760 of file SGVector.cpp.
uint8_t twonorm | ( | const uint8_t * | x, |
int32_t | len | ||
) |
Definition at line 770 of file SGVector.cpp.
int16_t twonorm | ( | const int16_t * | x, |
int32_t | len | ||
) |
Definition at line 780 of file SGVector.cpp.
uint16_t twonorm | ( | const uint16_t * | x, |
int32_t | len | ||
) |
Definition at line 790 of file SGVector.cpp.
int32_t twonorm | ( | const int32_t * | x, |
int32_t | len | ||
) |
Definition at line 800 of file SGVector.cpp.
uint32_t twonorm | ( | const uint32_t * | x, |
int32_t | len | ||
) |
Definition at line 810 of file SGVector.cpp.
int64_t twonorm | ( | const int64_t * | x, |
int32_t | len | ||
) |
Definition at line 820 of file SGVector.cpp.
uint64_t twonorm | ( | const uint64_t * | x, |
int32_t | len | ||
) |
Definition at line 830 of file SGVector.cpp.
Definition at line 840 of file SGVector.cpp.
Definition at line 850 of file SGVector.cpp.
floatmax_t twonorm | ( | const floatmax_t * | x, |
int32_t | len | ||
) |
Definition at line 862 of file SGVector.cpp.
complex128_t twonorm | ( | const complex128_t * | x, |
int32_t | len | ||
) |
Definition at line 872 of file SGVector.cpp.
int32_t unique | ( | T * | output, |
int32_t | size | ||
) | [static] |
performs a inplace unique of a vector of type T using quicksort returns the new number of elements
Definition at line 1144 of file SGVector.cpp.
int32_t unique | ( | complex128_t * | output, |
int32_t | size | ||
) |
Definition at line 1158 of file SGVector.cpp.
int32_t unref | ( | ) | [protected, inherited] |
decrement reference counter and deallocate object if refcount is zero before or after decrementing it
Definition at line 87 of file SGReferencedData.cpp.
void vec1_plus_scalar_times_vec2 | ( | T * | vec1, |
const T | scalar, | ||
const T * | vec2, | ||
int32_t | n | ||
) | [static] |
x=x+alpha*y
Definition at line 580 of file SGVector.cpp.
void vec1_plus_scalar_times_vec2 | ( | float64_t * | vec1, |
float64_t | scalar, | ||
const float64_t * | vec2, | ||
int32_t | n | ||
) |
Definition at line 588 of file SGVector.cpp.
void vec1_plus_scalar_times_vec2 | ( | float32_t * | vec1, |
float32_t | scalar, | ||
const float32_t * | vec2, | ||
int32_t | n | ||
) |
Definition at line 601 of file SGVector.cpp.
static void vector_multiply | ( | T * | target, |
const T * | v1, | ||
const T * | v2, | ||
int32_t | len | ||
) | [static] |
compute vector multiplication
Definition at line 478 of file SGVector.h.
void zero | ( | ) |
fill vector with zeros
Definition at line 110 of file SGVector.cpp.
void zero | ( | ) |
Definition at line 117 of file SGVector.cpp.
T* vector |
vector
Definition at line 704 of file SGVector.h.
length of vector
Definition at line 706 of file SGVector.h.