SHOGUN
4.2.0
|
shogun n-dimensional array
Definition at line 25 of file SGNDArray.h.
Public Member Functions | |
SGNDArray () | |
SGNDArray (T *a, index_t *d, index_t nd, bool ref_counting=true) | |
SGNDArray (index_t *d, index_t nd, bool ref_counting=true) | |
SGNDArray (SGVector< index_t > d, bool ref_counting=true) | |
SGNDArray (const SGNDArray &orig) | |
virtual | ~SGNDArray () |
SGNDArray< T > | clone () const |
T * | get_matrix (index_t matIdx) const |
void | transpose_matrix (index_t matIdx) const |
const T & | operator[] (index_t index) const |
T & | operator[] (index_t index) |
SGVector< index_t > | get_dimensions () const |
void | set_const (T const_elem) |
SGNDArray< T > & | operator*= (T val) |
SGNDArray< T > & | operator+= (SGNDArray &ndarray) |
SGNDArray< T > & | operator-= (SGNDArray &ndarray) |
T | max_element (index_t &max_at) |
void | expand (SGNDArray &big_array, SGVector< index_t > &axes) |
T | get_value (SGVector< index_t > index) const |
void | next_index (SGVector< index_t > &curr_index) const |
template<> | |
SGNDArray< bool > & | operator*= (bool val) |
template<> | |
SGNDArray< char > & | operator*= (char val) |
template<> | |
SGNDArray< bool > & | operator+= (SGNDArray &ndarray) |
template<> | |
SGNDArray< char > & | operator+= (SGNDArray &ndarray) |
template<> | |
SGNDArray< bool > & | operator-= (SGNDArray &ndarray) |
template<> | |
SGNDArray< char > & | operator-= (SGNDArray &ndarray) |
template<> | |
bool | max_element (int32_t &max_at) |
template<> | |
char | max_element (int32_t &max_at) |
int32_t | ref_count () |
Public Attributes | |
T * | array |
index_t * | dims |
index_t | num_dims |
index_t | len_array |
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 () |
SGNDArray | ( | ) |
default constructor
Definition at line 20 of file SGNDArray.cpp.
constructor for setting params
a | data of the array |
d | dimentions of the array |
nd | number of dimentions |
ref_counting | if true, count the reference |
Definition at line 26 of file SGNDArray.cpp.
constructor to create new ndarray in memory
d | dimentions of the array |
nd | number of dimentions |
ref_counting | if true, count the reference |
Definition at line 39 of file SGNDArray.cpp.
constructor to create new ndarray of given bases
d | dimentions of the array |
ref_counting | if true, count the reference |
Definition at line 50 of file SGNDArray.cpp.
|
virtual |
empty destructor
Definition at line 73 of file SGNDArray.cpp.
SGNDArray< T > clone | ( | ) | const |
Definition at line 105 of file SGNDArray.cpp.
|
protectedvirtual |
|
protectedinherited |
copy refcount
Definition at line 55 of file SGReferencedData.cpp.
expand to a big size array
big_array | the target big size array |
axes | the axis where the current ndarray will be replicated |
Definition at line 303 of file SGNDArray.cpp.
|
protectedvirtual |
Definition at line 112 of file SGNDArray.cpp.
T* get_matrix | ( | index_t | matIdx | ) | const |
get a matrix formed by the two first dimensions
matIdx | matrix index |
Definition at line 72 of file SGNDArray.h.
get the value at index
index | vector of indices where the value to retrieve of the array is located |
Definition at line 266 of file SGNDArray.cpp.
|
protectedvirtual |
T max_element | ( | index_t & | max_at | ) |
find the maximum value of the elements
max_at | the index of the maximum element, index is in 1-d flattend array. If there are multiple maximum element, return the last index. |
Definition at line 232 of file SGNDArray.cpp.
bool max_element | ( | int32_t & | max_at | ) |
Definition at line 252 of file SGNDArray.cpp.
char max_element | ( | int32_t & | max_at | ) |
Definition at line 259 of file SGNDArray.cpp.
get the next index from the current one
curr_index | the current index |
Definition at line 286 of file SGNDArray.cpp.
SGNDArray< T > & operator*= | ( | T | val | ) |
operator overload of multiplication assignment
val | a scalar value to multiply |
Definition at line 153 of file SGNDArray.cpp.
SGNDArray< bool > & operator*= | ( | bool | val | ) |
Definition at line 162 of file SGNDArray.cpp.
SGNDArray< char > & operator*= | ( | char | val | ) |
Definition at line 169 of file SGNDArray.cpp.
operator overload of addition assignment
ndarray | N-d array to add |
Definition at line 176 of file SGNDArray.cpp.
Definition at line 190 of file SGNDArray.cpp.
Definition at line 197 of file SGNDArray.cpp.
operator overload of subtruction assignment
ndarray | N-d array to add |
Definition at line 204 of file SGNDArray.cpp.
Definition at line 218 of file SGNDArray.cpp.
Definition at line 225 of file SGNDArray.cpp.
const T& operator[] | ( | index_t | index | ) | const |
operator overload for ndarray read only access
index | to access |
Definition at line 88 of file SGNDArray.h.
T& operator[] | ( | index_t | index | ) |
operator overload for ndarray r/w access
index | to access |
Definition at line 97 of file SGNDArray.h.
|
protectedinherited |
increase reference counter
Definition at line 64 of file SGReferencedData.cpp.
|
inherited |
display reference counter
Definition at line 41 of file SGReferencedData.cpp.
void set_const | ( | T | const_elem | ) |
set N-d array to a constant
const_elem | constant value to set N-d array to |
Definition at line 146 of file SGNDArray.cpp.
void transpose_matrix | ( | index_t | matIdx | ) | const |
transposes a matrix formed by the two first dimensions
matIdx | matrix index |
Definition at line 122 of file SGNDArray.cpp.
|
protectedinherited |
decrement reference counter and deallocate object if refcount is zero before or after decrementing it
Definition at line 84 of file SGReferencedData.cpp.
T* array |
array
Definition at line 174 of file SGNDArray.h.
index_t* dims |
dimension sizes
Definition at line 177 of file SGNDArray.h.
index_t len_array |
the flatten length of the N-d array
Definition at line 183 of file SGNDArray.h.
index_t num_dims |
number of dimensions
Definition at line 180 of file SGNDArray.h.