shogun vector
Definition at line 31 of file DataType.h.
Public Member Functions | |
SGVector () | |
SGVector (T *v, index_t len, bool free_vec=false) | |
SGVector (index_t len, bool free_vec=false) | |
SGVector (const SGVector &orig) | |
virtual | ~SGVector () |
void | zero () |
void | set_const (T const_elem) |
void | range_fill (T start=0) |
void | random (T min_value, T max_value) |
void | randperm () |
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[] (index_t index) const |
T & | operator[] (index_t index) |
virtual void | free_vector () |
virtual void | destroy_vector () |
void | display_size () const |
void | display_vector () const |
Static Public Member Functions | |
static SGVector | get_vector (SGVector &src, bool own=true) |
template<class VT > | |
static VT * | clone_vector (const VT *vec, int32_t len) |
template<class VT > | |
static void | fill_vector (VT *vec, int32_t len, VT value) |
template<class VT > | |
static void | range_fill_vector (VT *vec, int32_t len, VT start=0) |
template<class VT > | |
static void | random_vector (VT *vec, int32_t len, VT min_value, VT max_value) |
template<class VT > | |
static void | randperm (VT *perm, int32_t n) |
template<class VT > | |
static void | permute (VT *perm, int32_t n) |
Public Attributes | |
T * | vector |
index_t | vlen |
bool | do_free |
SGVector | ( | ) |
default constructor
Definition at line 35 of file DataType.h.
constructor for setting params
Definition at line 38 of file DataType.h.
constructor to create new vector in memory
Definition at line 42 of file DataType.h.
copy constructor
Definition at line 49 of file DataType.h.
virtual ~SGVector | ( | ) | [virtual] |
empty destructor
Definition at line 53 of file DataType.h.
static VT* clone_vector | ( | const VT * | vec, | |
int32_t | len | |||
) | [static] |
clone vector
Definition at line 104 of file DataType.h.
virtual void destroy_vector | ( | ) | [virtual] |
destroy vector
Definition at line 223 of file DataType.h.
void display_size | ( | ) | const |
display array size
Definition at line 230 of file DataType.h.
void display_vector | ( | ) | const |
display array
Definition at line 236 of file DataType.h.
static void fill_vector | ( | VT * | vec, | |
int32_t | len, | |||
VT | value | |||
) | [static] |
fill vector
Definition at line 115 of file DataType.h.
virtual void free_vector | ( | ) | [virtual] |
free vector
Definition at line 212 of file DataType.h.
const T& get_element | ( | index_t | index | ) |
get vector element at index
index | index |
Definition at line 159 of file DataType.h.
get vector
src | vector to get | |
own | true if should be owned |
Definition at line 61 of file DataType.h.
T& operator[] | ( | index_t | index | ) |
operator overload for vector r/w access
index | dimension to access |
Definition at line 206 of file DataType.h.
const T& operator[] | ( | index_t | index | ) | const |
operator overload for vector read only access
index | dimension to access |
Definition at line 196 of file DataType.h.
static void permute | ( | VT * | perm, | |
int32_t | n | |||
) | [static] |
permute
Definition at line 148 of file DataType.h.
void random | ( | T | min_value, | |
T | max_value | |||
) |
random
Definition at line 91 of file DataType.h.
static void random_vector | ( | VT * | vec, | |
int32_t | len, | |||
VT | min_value, | |||
VT | max_value | |||
) | [static] |
random vector
Definition at line 131 of file DataType.h.
static void randperm | ( | VT * | perm, | |
int32_t | n | |||
) | [static] |
random permatutaion
Definition at line 139 of file DataType.h.
void randperm | ( | ) |
random permutate
Definition at line 97 of file DataType.h.
void range_fill | ( | T | start = 0 |
) |
range fill
Definition at line 85 of file DataType.h.
static void range_fill_vector | ( | VT * | vec, | |
int32_t | len, | |||
VT | start = 0 | |||
) | [static] |
range fill vector
Definition at line 123 of file DataType.h.
void resize_vector | ( | int32_t | n | ) |
resize vector
n | new size |
Definition at line 182 of file DataType.h.
void set_const | ( | T | const_elem | ) |
set vector to a constant
Definition at line 78 of file DataType.h.
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 171 of file DataType.h.
void zero | ( | ) |
fill vector with zeros
Definition at line 71 of file DataType.h.
bool do_free |
whether vector needs to be freed
Definition at line 250 of file DataType.h.
T* vector |
vector
Definition at line 246 of file DataType.h.
length of vector
Definition at line 248 of file DataType.h.