SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
SGVector< T > Class Template Reference

Detailed Description

template<class T>
class shogun::SGVector< T >

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

Constructor & Destructor Documentation

SGVector ( )

default constructor

Definition at line 35 of file DataType.h.

SGVector ( T *  v,
index_t  len,
bool  free_vec = false 
)

constructor for setting params

Definition at line 38 of file DataType.h.

SGVector ( index_t  len,
bool  free_vec = false 
)

constructor to create new vector in memory

Definition at line 42 of file DataType.h.

SGVector ( const SGVector< T > &  orig)

copy constructor

Definition at line 49 of file DataType.h.

virtual ~SGVector ( )
virtual

empty destructor

Definition at line 53 of file DataType.h.

Member Function Documentation

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

Parameters
indexindex
Returns
vector element at index

Definition at line 159 of file DataType.h.

static SGVector get_vector ( SGVector< T > &  src,
bool  own = true 
)
static

get vector

Parameters
srcvector to get
owntrue if should be owned

Definition at line 61 of file DataType.h.

const T& operator[] ( index_t  index) const

operator overload for vector read only access

Parameters
indexdimension to access

Definition at line 196 of file DataType.h.

T& operator[] ( index_t  index)

operator overload for vector r/w access

Parameters
indexdimension to access

Definition at line 206 of file DataType.h.

static void permute ( VT *  perm,
int32_t  n 
)
static

permute

Definition at line 148 of file DataType.h.

void random ( min_value,
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.

void randperm ( )

random permutate

Definition at line 97 of file DataType.h.

static void randperm ( VT *  perm,
int32_t  n 
)
static

random permatutaion

Definition at line 139 of file DataType.h.

void range_fill ( 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

Parameters
nnew size
Returns
if resizing was successful

Definition at line 182 of file DataType.h.

void set_const ( 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

Parameters
p_elementvector element to set
indexindex
Returns
if setting was successful

Definition at line 171 of file DataType.h.

void zero ( )

fill vector with zeros

Definition at line 71 of file DataType.h.

Member Data Documentation

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.

index_t vlen

length of vector

Definition at line 248 of file DataType.h.


The documentation for this class was generated from the following file:

SHOGUN Machine Learning Toolbox - Documentation