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

Detailed Description

template<class T>
class shogun::CArray3< T >

Template class Array3 implements a dense three dimensional array.

Note that depending on compile options everything will be inlined, such that this is as high performance 3d-array implementation without error checking.

Definition at line 28 of file Array3.h.

Inheritance diagram for CArray3< T >:
Inheritance graph
[legend]

Public Member Functions

 CArray3 ()
 CArray3 (int32_t dim1, int32_t dim2, int32_t dim3)
 CArray3 (T *p_array, int32_t dim1, int32_t dim2, int32_t dim3, bool p_free_array=true, bool p_copy_array=false)
 CArray3 (const T *p_array, int32_t dim1, int32_t dim2, int32_t dim3)
virtual ~CArray3 ()
void set_array_name (const char *p_name)
void get_array_size (int32_t &dim1, int32_t &dim2, int32_t &dim3)
int32_t get_dim1 ()
int32_t get_dim2 ()
int32_t get_dim3 ()
void zero ()
void set_const (T const_elem)
T * get_array ()
void set_array (T *p_array, int32_t dim1, int32_t dim2, int32_t dim3, bool p_free_array, bool copy_array=false)
bool resize_array (int32_t dim1, int32_t dim2, int32_t dim3)
get_element (int32_t idx1, int32_t idx2, int32_t idx3) const
bool set_element (T p_element, int32_t idx1, int32_t idx2, int32_t idx3)
const T & element (int32_t idx1, int32_t idx2, int32_t idx3) const
T & element (int32_t idx1, int32_t idx2, int32_t idx3)
T & element (T *p_array, int32_t idx1, int32_t idx2, int32_t idx3)
T & element (T *p_array, int32_t idx1, int32_t idx2, int32_t idx3, int32_t p_dim1_size, int32_t p_dim2_size)
CArray3< T > & operator= (const CArray3< T > &orig)
void display_size () const
void display_array () const
virtual const char * get_name ()
- Public Member Functions inherited from CArray< T >
 CArray (int32_t initial_size=1)
 CArray (T *p_array, int32_t p_array_size, bool p_free_array=true, bool p_copy_array=false)
 CArray (const T *p_array, int32_t p_array_size)
virtual ~CArray ()
virtual const char * get_name () const
virtual const char * get_array_name () const
int32_t get_array_size () const
const T & get_element (int32_t index) const
bool set_element (const T &p_element, int32_t index)
const T & element (int32_t idx1) const
T & element (int32_t index)
T & element (T *p_array, int32_t index)
bool resize_array (int32_t n)
void set_array (T *p_array, int32_t p_array_size, bool p_free_array=true, bool copy_array=false)
void set_array (const T *p_array, int32_t p_array_size)
void clear_array ()
const T & operator[] (int32_t index) const
T & operator[] (int32_t index)
CArray< T > & operator= (const CArray< T > &orig)
- Public Member Functions inherited from CSGObject
 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
virtual bool is_generic (EPrimitiveType *generic) const
template<class T >
void set_generic ()
void unset_generic ()
virtual void print_serializable (const char *prefix="")
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
void set_global_io (SGIO *io)
SGIOget_global_io ()
void set_global_parallel (Parallel *parallel)
Parallelget_global_parallel ()
void set_global_version (Version *version)
Versionget_global_version ()
SGVector< char * > get_modelsel_names ()
char * get_modsel_param_descr (const char *param_name)
index_t get_modsel_param_index (const char *param_name)

Protected Attributes

int32_t dim1_size
int32_t dim2_size
int32_t dim3_size
- Protected Attributes inherited from CArray< T >
T * array
int32_t array_size
bool free_array
const char * name
 DECLARE_ARRAY_STATISTICS

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters
- Protected Member Functions inherited from CSGObject
virtual void load_serializable_pre () throw (ShogunException)
virtual void load_serializable_post () throw (ShogunException)
virtual void save_serializable_pre () throw (ShogunException)
virtual void save_serializable_post () throw (ShogunException)

Constructor & Destructor Documentation

CArray3 ( )

default constructor

Definition at line 32 of file Array3.h.

CArray3 ( int32_t  dim1,
int32_t  dim2,
int32_t  dim3 
)

constructor

Parameters
dim1dimension 1
dim2dimension 2
dim3dimension 3

Definition at line 43 of file Array3.h.

CArray3 ( T *  p_array,
int32_t  dim1,
int32_t  dim2,
int32_t  dim3,
bool  p_free_array = true,
bool  p_copy_array = false 
)

constructor

Parameters
p_arrayanother array
dim1dimension 1
dim2dimension 2
dim3dimension 3
p_free_arrayif array must be freed
p_copy_arrayif array must be copied

Definition at line 57 of file Array3.h.

CArray3 ( const T *  p_array,
int32_t  dim1,
int32_t  dim2,
int32_t  dim3 
)

constructor

Parameters
p_arrayanother array
dim1dimension 1
dim2dimension 2
dim3dimension 3

Definition at line 72 of file Array3.h.

virtual ~CArray3 ( )
virtual

Definition at line 78 of file Array3.h.

Member Function Documentation

void display_array ( ) const

display array

Reimplemented from CArray< T >.

Definition at line 291 of file Array3.h.

void display_size ( ) const

display array size

Reimplemented from CArray< T >.

Definition at line 285 of file Array3.h.

const T& element ( int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
) const

get array element at index

Parameters
idx1index 1
idx2index 2
idx3index 3
Returns
array element at index

Definition at line 209 of file Array3.h.

T& element ( int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
)

get array element at index

Parameters
idx1index 1
idx2index 2
idx3index 3
Returns
array element at index

Definition at line 224 of file Array3.h.

T& element ( T *  p_array,
int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
)

get element of given array at given index

Parameters
p_arrayanother array
idx1index 1
idx2index 2
idx3index 3
Returns
array element at index

Definition at line 240 of file Array3.h.

T& element ( T *  p_array,
int32_t  idx1,
int32_t  idx2,
int32_t  idx3,
int32_t  p_dim1_size,
int32_t  p_dim2_size 
)

get element of given array at given index

Parameters
p_arrayanother array
idx1index 1
idx2index 2
idx3index 3
p_dim1_sizesize of dimension 1
p_dim2_sizesize of dimension 2
Returns
element of given array at given index

Definition at line 259 of file Array3.h.

T* get_array ( )

get the array call get_array just before messing with it DO NOT call any [],resize/delete functions after get_array(), the pointer may become invalid !

Returns
the array

Reimplemented from CArray< T >.

Definition at line 137 of file Array3.h.

void get_array_size ( int32_t &  dim1,
int32_t &  dim2,
int32_t &  dim3 
)

return total array size (including granularity buffer)

Parameters
dim1dimension 1 will be stored here
dim2dimension 2 will be stored here
dim3dimension 3 will be stored here

Definition at line 95 of file Array3.h.

int32_t get_dim1 ( )

get dimension 1

Returns
dimension 1

Reimplemented from CArray< T >.

Definition at line 106 of file Array3.h.

int32_t get_dim2 ( )

get dimension 2

Returns
dimension 2

Definition at line 112 of file Array3.h.

int32_t get_dim3 ( )

get dimension 3

Returns
dimension 3

Definition at line 118 of file Array3.h.

T get_element ( int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
) const

get array element at index

Parameters
idx1index 1
idx2index 2
idx3index 3
Returns
array element at index

Definition at line 178 of file Array3.h.

virtual const char* get_name ( )
virtual
Returns
object name

Definition at line 308 of file Array3.h.

CArray3<T>& operator= ( const CArray3< T > &  orig)

operator overload for array assignment

Parameters
origoriginal array
Returns
new array

Definition at line 275 of file Array3.h.

bool resize_array ( int32_t  dim1,
int32_t  dim2,
int32_t  dim3 
)

resize array

Parameters
dim1new dimension 1
dim2new dimension 2
dim3new dimension 3
Returns
if resizing was successful

Definition at line 163 of file Array3.h.

void set_array ( T *  p_array,
int32_t  dim1,
int32_t  dim2,
int32_t  dim3,
bool  p_free_array,
bool  copy_array = false 
)

set the array pointer and free previously allocated memory

Parameters
p_arrayanother array
dim1dimension 1
dim2dimensino 2
dim3dimensino 3
p_free_arrayif array must be freed
copy_arrayif array must be copied

Definition at line 148 of file Array3.h.

void set_array_name ( const char *  p_name)

set array's name

Parameters
p_namenew name

Reimplemented from CArray< T >.

Definition at line 84 of file Array3.h.

void set_const ( const_elem)

set array with a constant

Reimplemented from CArray< T >.

Definition at line 125 of file Array3.h.

bool set_element ( p_element,
int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
)

set array element at index 'index'

Parameters
p_elementarray element
idx1index 1
idx2index 2
idx3index 3
Returns
if setting was successful

Definition at line 194 of file Array3.h.

void zero ( )

zero array

Reimplemented from CArray< T >.

Definition at line 122 of file Array3.h.

Member Data Documentation

int32_t dim1_size
protected

size of array's dimension 1

Definition at line 312 of file Array3.h.

int32_t dim2_size
protected

size of array's dimension 2

Definition at line 314 of file Array3.h.

int32_t dim3_size
protected

size of array's dimension 3

Definition at line 316 of file Array3.h.


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

SHOGUN Machine Learning Toolbox - Documentation