SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
所有成员列表 | Public 成员函数 | Public 属性 | Protected 成员函数
SGNDArray< T > 模板类 参考

详细描述

template<class T>
class shogun::SGNDArray< T >

shogun n-dimensional array

在文件 SGNDArray.h25 行定义.

类 SGNDArray< T > 继承关系图:
Inheritance graph
[图例]

Public 成员函数

 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_tget_dimensions () const
 
void set_const (T const_elem)
 
SGNDArray< T > & operator*= (T val)
 
SGNDArray< T > & operator+= (SGNDArray &ndarray)
 
SGNDArray< T > & operator-= (SGNDArray &ndarray)
 
max_element (index_t &max_at)
 
void expand (SGNDArray &big_array, SGVector< index_t > &axes)
 
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 属性

T * array
 
index_tdims
 
index_t num_dims
 
index_t len_array
 

Protected 成员函数

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

在文件 SGNDArray.cpp20 行定义.

SGNDArray ( T *  a,
index_t d,
index_t  nd,
bool  ref_counting = true 
)

constructor for setting params

参数
adata of the array
ddimentions of the array
ndnumber of dimentions
ref_countingif true, count the reference

在文件 SGNDArray.cpp26 行定义.

SGNDArray ( index_t d,
index_t  nd,
bool  ref_counting = true 
)

constructor to create new ndarray in memory

参数
ddimentions of the array
ndnumber of dimentions
ref_countingif true, count the reference

在文件 SGNDArray.cpp39 行定义.

SGNDArray ( SGVector< index_t d,
bool  ref_counting = true 
)

constructor to create new ndarray of given bases

参数
ddimentions of the array
ref_countingif true, count the reference

在文件 SGNDArray.cpp50 行定义.

SGNDArray ( const SGNDArray< T > &  orig)

copy constructor

参数
origthe original N-d array

在文件 SGNDArray.cpp67 行定义.

~SGNDArray ( )
virtual

empty destructor

在文件 SGNDArray.cpp73 行定义.

成员函数说明

SGNDArray< T > clone ( ) const
返回
the cloned N-d array

在文件 SGNDArray.cpp105 行定义.

void copy_data ( const SGReferencedData orig)
protectedvirtual

copy data

实现了 SGReferencedData.

在文件 SGNDArray.cpp78 行定义.

void copy_refcount ( const SGReferencedData orig)
protectedinherited

copy refcount

在文件 SGReferencedData.cpp55 行定义.

void expand ( SGNDArray< T > &  big_array,
SGVector< index_t > &  axes 
)

expand to a big size array

参数
big_arraythe target big size array
axesthe axis where the current ndarray will be replicated

在文件 SGNDArray.cpp303 行定义.

void free_data ( )
protectedvirtual

free data

实现了 SGReferencedData.

在文件 SGNDArray.cpp94 行定义.

SGVector< index_t > get_dimensions ( ) const
返回
dimentions of the N-d array

在文件 SGNDArray.cpp112 行定义.

T* get_matrix ( index_t  matIdx) const

get a matrix formed by the two first dimensions

参数
matIdxmatrix index
返回
pointer to the matrix

在文件 SGNDArray.h72 行定义.

T get_value ( SGVector< index_t index) const

get the value at index

参数
indexvector of indices where the value to retrieve of the array is located
返回
the value at index

在文件 SGNDArray.cpp266 行定义.

void init_data ( )
protectedvirtual

init data

实现了 SGReferencedData.

在文件 SGNDArray.cpp86 行定义.

T max_element ( index_t max_at)

find the maximum value of the elements

参数
max_atthe index of the maximum element, index is in 1-d flattend array. If there are multiple maximum element, return the last index.
返回
the maximum value

在文件 SGNDArray.cpp232 行定义.

bool max_element ( int32_t &  max_at)

在文件 SGNDArray.cpp252 行定义.

char max_element ( int32_t &  max_at)

在文件 SGNDArray.cpp259 行定义.

void next_index ( SGVector< index_t > &  curr_index) const

get the next index from the current one

参数
curr_indexthe current index

在文件 SGNDArray.cpp286 行定义.

SGNDArray< T > & operator*= ( val)

operator overload of multiplication assignment

参数
vala scalar value to multiply
返回
the result N-d array

在文件 SGNDArray.cpp153 行定义.

SGNDArray< bool > & operator*= ( bool  val)

在文件 SGNDArray.cpp162 行定义.

SGNDArray< char > & operator*= ( char  val)

在文件 SGNDArray.cpp169 行定义.

SGNDArray< T > & operator+= ( SGNDArray< T > &  ndarray)

operator overload of addition assignment

参数
ndarrayN-d array to add
返回
the result N-d array

在文件 SGNDArray.cpp176 行定义.

SGNDArray< bool > & operator+= ( SGNDArray< T > &  ndarray)

在文件 SGNDArray.cpp190 行定义.

SGNDArray< char > & operator+= ( SGNDArray< T > &  ndarray)

在文件 SGNDArray.cpp197 行定义.

SGNDArray< T > & operator-= ( SGNDArray< T > &  ndarray)

operator overload of subtruction assignment

参数
ndarrayN-d array to add
返回
the result N-d array

在文件 SGNDArray.cpp204 行定义.

SGNDArray< bool > & operator-= ( SGNDArray< T > &  ndarray)

在文件 SGNDArray.cpp218 行定义.

SGNDArray< char > & operator-= ( SGNDArray< T > &  ndarray)

在文件 SGNDArray.cpp225 行定义.

const T& operator[] ( index_t  index) const

operator overload for ndarray read only access

参数
indexto access

在文件 SGNDArray.h88 行定义.

T& operator[] ( index_t  index)

operator overload for ndarray r/w access

参数
indexto access

在文件 SGNDArray.h97 行定义.

int32_t ref ( )
protectedinherited

increase reference counter

返回
reference count

在文件 SGReferencedData.cpp64 行定义.

int32_t ref_count ( )
inherited

display reference counter

返回
reference count

在文件 SGReferencedData.cpp41 行定义.

void set_const ( const_elem)

set N-d array to a constant

参数
const_elemconstant value to set N-d array to

在文件 SGNDArray.cpp146 行定义.

void transpose_matrix ( index_t  matIdx) const

transposes a matrix formed by the two first dimensions

参数
matIdxmatrix index

在文件 SGNDArray.cpp122 行定义.

int32_t unref ( )
protectedinherited

decrement reference counter and deallocate object if refcount is zero before or after decrementing it

返回
reference count

在文件 SGReferencedData.cpp84 行定义.

类成员变量说明

T* array

array

在文件 SGNDArray.h174 行定义.

index_t* dims

dimension sizes

在文件 SGNDArray.h177 行定义.

index_t len_array

the flatten length of the N-d array

在文件 SGNDArray.h183 行定义.

index_t num_dims

number of dimensions

在文件 SGNDArray.h180 行定义.


该类的文档由以下文件生成:

SHOGUN 机器学习工具包 - 项目文档