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]

List of all members.

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 ()

Protected Attributes

int32_t dim1_size
int32_t dim2_size
int32_t dim3_size

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:
dim1 dimension 1
dim2 dimension 2
dim3 dimension 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_array another array
dim1 dimension 1
dim2 dimension 2
dim3 dimension 3
p_free_array if array must be freed
p_copy_array if 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_array another array
dim1 dimension 1
dim2 dimension 2
dim3 dimension 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:
idx1 index 1
idx2 index 2
idx3 index 3
Returns:
array element at index

Definition at line 209 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_array another array
idx1 index 1
idx2 index 2
idx3 index 3
p_dim1_size size of dimension 1
p_dim2_size size of dimension 2
Returns:
element of given array at given index

Definition at line 259 of file Array3.h.

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

get array element at index

Parameters:
idx1 index 1
idx2 index 2
idx3 index 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_array another array
idx1 index 1
idx2 index 2
idx3 index 3
Returns:
array element at index

Definition at line 240 of file Array3.h.

T* get_array ( void   ) 

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:
dim1 dimension 1 will be stored here
dim2 dimension 2 will be stored here
dim3 dimension 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:
idx1 index 1
idx2 index 2
idx3 index 3
Returns:
array element at index

Definition at line 178 of file Array3.h.

virtual const char* get_name ( void   )  [virtual]
Returns:
object name

Implements CSGObject.

Definition at line 308 of file Array3.h.

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

operator overload for array assignment

Parameters:
orig original 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:
dim1 new dimension 1
dim2 new dimension 2
dim3 new 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_array another array
dim1 dimension 1
dim2 dimensino 2
dim3 dimensino 3
p_free_array if array must be freed
copy_array if 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_name new 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_element array element
idx1 index 1
idx2 index 2
idx3 index 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation