Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

Cube< eT > Class Template Reference
[Cube]

Dense cube class. More...

#include <Cube_proto.hpp>

Inheritance diagram for Cube< eT >:
BaseCube< eT, Cube< eT > >

List of all members.

Public Types

typedef eT elem_type
 the type of elements stored in the cube
typedef get_pod_type< eT >::result pod_type
 if eT is non-complex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std::complex
typedef eT * iterator
typedef const eT * const_iterator
typedef eT * slice_iterator
typedef const eT * const_slice_iterator

Public Member Functions

 ~Cube ()
 Cube ()
 Cube (const u32 in_rows, const u32 in_cols, const u32 in_slices)
 construct the cube to have user specified dimensions
 Cube (eT *aux_mem, const u32 aux_n_rows, const u32 aux_n_cols, const u32 aux_n_slices, const bool copy_aux_mem=true)
 construct a cube from a given auxiliary array of eTs. //! if copy_aux_mem is true, new memory is allocated and the array is copied. //! if copy_aux_mem is false, the auxiliary array is used directly (without allocating memory and copying). //! note that in the latter case //! the default is to copy the array.
 Cube (const eT *aux_mem, const u32 aux_n_rows, const u32 aux_n_cols, const u32 aux_n_slices)
 construct a cube from a given auxiliary read-only array of eTs. //! the array is copied.
arma_inline const Cubeoperator= (const eT val)
 Set the cube to be equal to the specified scalar. //! NOTE: the size of the cube will be 1x1x1.
arma_inline const Cubeoperator+= (const eT val)
 In-place addition of a scalar to all elements of the cube.
arma_inline const Cubeoperator-= (const eT val)
 In-place subtraction of a scalar from all elements of the cube.
arma_inline const Cubeoperator*= (const eT val)
 In-place multiplication of all elements of the cube with a scalar.
arma_inline const Cubeoperator/= (const eT val)
 In-place division of all elements of the cube with a scalar.
 Cube (const Cube &m)
 construct a cube from a given cube
const Cubeoperator= (const Cube &m)
 construct a cube from a given cube
const Cubeoperator+= (const Cube &m)
 in-place cube addition
const Cubeoperator-= (const Cube &m)
 in-place cube subtraction
const Cubeoperator%= (const Cube &m)
 in-place element-wise cube multiplication
const Cubeoperator/= (const Cube &m)
 in-place element-wise cube division
template<typename T1 , typename T2 >
 Cube (const BaseCube< pod_type, T1 > &A, const BaseCube< pod_type, T2 > &B)
 Cube (const subview_cube< eT > &X)
 construct a cube from a subview_cube instance (e.g. construct a cube from a delayed subcube operation)
const Cubeoperator= (const subview_cube< eT > &X)
 construct a cube from a subview_cube instance (e.g. construct a cube from a delayed subcube operation)
const Cubeoperator+= (const subview_cube< eT > &X)
 in-place cube addition (using a subcube on the right-hand-side)
const Cubeoperator-= (const subview_cube< eT > &X)
 in-place cube subtraction (using a subcube on the right-hand-side)
const Cubeoperator%= (const subview_cube< eT > &X)
 in-place element-wise cube mutiplication (using a subcube on the right-hand-side)
const Cubeoperator/= (const subview_cube< eT > &X)
 in-place element-wise cube division (using a subcube on the right-hand-side)
arma_inline Mat< eT > & slice (const u32 in_slice)
 provide the reference to the matrix representing a single slice
arma_inline const Mat< eT > & slice (const u32 in_slice) const
 provide the reference to the matrix representing a single slice
arma_inline subview_cube< eT > slices (const u32 in_slice1, const u32 in_slice2)
 creation of subview_cube (subcube comprised of specified slices)
arma_inline const subview_cube
< eT > 
slices (const u32 in_slice1, const u32 in_slice2) const
 creation of subview_cube (subcube comprised of specified slices)
arma_inline subview_cube< eT > subcube (const u32 in_row1, const u32 in_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u32 in_slice2)
 creation of subview_cube (generic subcube)
arma_inline const subview_cube
< eT > 
subcube (const u32 in_row1, const u32 in_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u32 in_slice2) const
 creation of subview_cube (generic subcube)
template<typename T1 , typename op_type >
 Cube (const OpCube< T1, op_type > &X)
 create a cube from OpCube, i.e. run the previously delayed unary operations
template<typename T1 , typename op_type >
const Cubeoperator= (const OpCube< T1, op_type > &X)
 create a cube from OpCube, i.e. run the previously delayed unary operations
template<typename T1 , typename op_type >
const Cubeoperator+= (const OpCube< T1, op_type > &X)
 in-place cube addition, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const Cubeoperator-= (const OpCube< T1, op_type > &X)
 in-place cube subtraction, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const Cubeoperator%= (const OpCube< T1, op_type > &X)
 in-place cube element-wise multiplication, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const Cubeoperator/= (const OpCube< T1, op_type > &X)
 in-place cube element-wise division, with the right-hand-side operand having delayed operations
template<typename T1 , typename eop_type >
 Cube (const eOpCube< T1, eop_type > &X)
 create a cube from eOpCube, i.e. run the previously delayed unary operations
template<typename T1 , typename eop_type >
const Cubeoperator= (const eOpCube< T1, eop_type > &X)
 create a cube from eOpCube, i.e. run the previously delayed unary operations
template<typename T1 , typename eop_type >
const Cubeoperator+= (const eOpCube< T1, eop_type > &X)
 in-place cube addition, with the right-hand-side operand having delayed operations
template<typename T1 , typename eop_type >
const Cubeoperator-= (const eOpCube< T1, eop_type > &X)
 in-place cube subtraction, with the right-hand-side operand having delayed operations
template<typename T1 , typename eop_type >
const Cubeoperator%= (const eOpCube< T1, eop_type > &X)
 in-place cube element-wise multiplication, with the right-hand-side operand having delayed operations
template<typename T1 , typename eop_type >
const Cubeoperator/= (const eOpCube< T1, eop_type > &X)
 in-place cube element-wise division, with the right-hand-side operand having delayed operations
template<typename T1 , typename T2 , typename glue_type >
 Cube (const GlueCube< T1, T2, glue_type > &X)
 create a cube from Glue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator= (const GlueCube< T1, T2, glue_type > &X)
 create a cube from Glue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator+= (const GlueCube< T1, T2, glue_type > &X)
 in-place cube addition, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator-= (const GlueCube< T1, T2, glue_type > &X)
 in-place cube subtraction, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator%= (const GlueCube< T1, T2, glue_type > &X)
 in-place cube element-wise multiplication, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator/= (const GlueCube< T1, T2, glue_type > &X)
 in-place cube element-wise division, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename eglue_type >
 Cube (const eGlueCube< T1, T2, eglue_type > &X)
 create a cube from eGlue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename eglue_type >
const Cubeoperator= (const eGlueCube< T1, T2, eglue_type > &X)
 create a cube from Glue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename eglue_type >
const Cubeoperator+= (const eGlueCube< T1, T2, eglue_type > &X)
 in-place cube addition, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename eglue_type >
const Cubeoperator-= (const eGlueCube< T1, T2, eglue_type > &X)
 in-place cube subtraction, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename eglue_type >
const Cubeoperator%= (const eGlueCube< T1, T2, eglue_type > &X)
 in-place cube element-wise multiplication, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename eglue_type >
const Cubeoperator/= (const eGlueCube< T1, T2, eglue_type > &X)
 in-place cube element-wise division, with the right-hand-side operands having delayed operations
arma_inline eT & operator[] (const u32 i)
 linear element accessor (treats the cube as a vector); no bounds check.
arma_inline eT operator[] (const u32 i) const
 linear element accessor (treats the cube as a vector); no bounds check
arma_inline eT & operator() (const u32 i)
 linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline eT operator() (const u32 i) const
 linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline eT & at (const u32 in_row, const u32 in_col, const u32 in_slice)
 element accessor; no bounds check
arma_inline eT at (const u32 in_row, const u32 in_col, const u32 in_slice) const
 element accessor; no bounds check
arma_inline eT & operator() (const u32 in_row, const u32 in_col, const u32 in_slice)
 element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline eT operator() (const u32 in_row, const u32 in_col, const u32 in_slice) const
 element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline const Cubeoperator++ ()
 prefix ++
arma_inline void operator++ (int)
 postfix ++ (must not return the object by reference)
arma_inline const Cubeoperator-- ()
 prefix --
arma_inline void operator-- (int)
 postfix -- (must not return the object by reference)
arma_inline bool is_finite () const
 returns true if all of the elements are finite
arma_inline eT * memptr ()
 returns a pointer to array of eTs used by the cube
arma_inline const eT * memptr () const
 returns a pointer to array of eTs used by the cube
arma_inline eT * slice_memptr (const u32 slice)
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline const eT * slice_memptr (const u32 slice) const
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline eT * slice_colptr (const u32 in_slice, const u32 in_col)
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline const eT * slice_colptr (const u32 in_slice, const u32 in_col) const
 returns a pointer to array of eTs used by the specified slice in the cube
void print (const std::string extra_text="") const
 print contents of the cube (to the cout stream), //! optionally preceding with a user specified line of text. //! the precision and cell width are modified. //! on return, the stream's flags are restored to their original values.
void print (std::ostream &user_stream, const std::string extra_text="") const
 print contents of the cube to a user specified stream, //! optionally preceding with a user specified line of text. //! the precision and cell width are modified. //! on return, the stream's flags are restored to their original values.
void raw_print (const std::string extra_text="") const
 print contents of the cube (to the cout stream), //! optionally preceding with a user specified line of text. //! the stream's flags are used as is and are not modified //! (i.e. the precision and cell width are not modified).
void raw_print (std::ostream &user_stream, const std::string extra_text="") const
 print contents of the cube to a user specified stream, //! optionally preceding with a user specified line of text. //! the stream's flags are used as is and are not modified. //! (i.e. the precision and cell width are not modified).
void set_size (const u32 in_rows, const u32 in_cols, const u32 in_slices)
 change the cube to have user specified dimensions (data is not preserved)
template<typename eT2 >
void copy_size (const Cube< eT2 > &m)
 change the cube (without preserving data) to have the same dimensions as the given cube
void fill (const eT val)
 fill the cube with the specified value
void zeros ()
void zeros (const u32 in_rows, const u32 in_cols, const u32 in_slices)
void ones ()
void ones (const u32 in_rows, const u32 in_cols, const u32 in_slices)
void reset ()
bool save (const std::string name, const file_type type=arma_binary, const bool print_status=true) const
 save the cube to a file
bool save (std::ostream &os, const file_type type=arma_binary, const bool print_status=true) const
 save the cube to a stream
bool load (const std::string name, const file_type type=auto_detect, const bool print_status=true)
 load a cube from a file
bool load (std::istream &is, const file_type type=auto_detect, const bool print_status=true)
 load a cube from a stream
bool quiet_save (const std::string name, const file_type type=arma_binary) const
 save the cube to a file, without printing any error messages
bool quiet_save (std::ostream &os, const file_type type=arma_binary) const
 save the cube to a stream, without printing any error messages
bool quiet_load (const std::string name, const file_type type=auto_detect)
 load a cube from a file, without printing any error messages
bool quiet_load (std::istream &is, const file_type type=auto_detect)
 load a cube from a stream, without printing any error messages
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
slice_iterator begin_slice (const u32 slice_num)
const_slice_iterator begin_slice (const u32 slice_num) const
slice_iterator end_slice (const u32 slice_num)
const_slice_iterator end_slice (const u32 slice_num) const
template<typename T1 , typename T2 >
 Cube (const BaseCube< typename Cube< eT >::pod_type, T1 > &A, const BaseCube< typename Cube< eT >::pod_type, T2 > &B)
 for constructing a complex cube out of two non-complex cubes

Public Attributes

const u32 n_rows
 number of rows in each slice (read-only)
const u32 n_cols
 number of columns in each slice (read-only)
const u32 n_elem_slice
 number of elements in each slice (read-only)
const u32 n_slices
 number of slices in the cube (read-only)
const u32 n_elem
 number of elements in the cube (read-only)
const bool use_aux_mem
 true if externally managed memory is being used (read-only)
arma_aligned const Mat< eT >
**const 
mat_ptrs
 pointer to an array containing pointers to Mat instances (one for each slice)
arma_aligned const eT *const mem
 pointer to the memory used by the cube (memory is read-only)

Protected Member Functions

void init (const u32 in_rows, const u32 in_cols, const u32 in_slices)
 internal cube construction; if the requested size is small enough, memory from the stack is used. //! otherwise memory is allocated via 'new'
void init (const Cube &x)
 construct a cube from a given cube
void delete_mat ()
void create_mat ()

Protected Attributes

arma_aligned Mat< eT > * mat_ptrs_local [16]
arma_aligned eT mem_local [64]

Detailed Description

template<typename eT>
class Cube< eT >

Dense cube class.

Definition at line 23 of file Cube_proto.hpp.


Member Typedef Documentation

template<typename eT>
typedef eT Cube< eT >::elem_type

the type of elements stored in the cube

Definition at line 27 of file Cube_proto.hpp.

template<typename eT>
typedef get_pod_type<eT>::result Cube< eT >::pod_type

if eT is non-complex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std::complex

Definition at line 28 of file Cube_proto.hpp.

template<typename eT>
typedef eT* Cube< eT >::iterator

Definition at line 179 of file Cube_proto.hpp.

template<typename eT>
typedef const eT* Cube< eT >::const_iterator

Definition at line 180 of file Cube_proto.hpp.

template<typename eT>
typedef eT* Cube< eT >::slice_iterator

Definition at line 182 of file Cube_proto.hpp.

template<typename eT>
typedef const eT* Cube< eT >::const_slice_iterator

Definition at line 183 of file Cube_proto.hpp.


Constructor & Destructor Documentation

template<typename eT>
template<typename T1 , typename T2 >
Cube< eT >::Cube ( const BaseCube< pod_type, T1 > &  A,
const BaseCube< pod_type, T2 > &  B 
) [inline, explicit]

Member Data Documentation

template<typename eT>
const u32 Cube< eT >::n_elem_slice
template<typename eT>
const bool Cube< eT >::use_aux_mem

true if externally managed memory is being used (read-only)

Definition at line 35 of file Cube_proto.hpp.

Referenced by Cube< eT >::init(), and Cube< eT >::~Cube().

template<typename eT>
arma_aligned const Mat<eT>** const Cube< eT >::mat_ptrs

pointer to an array containing pointers to Mat instances (one for each slice)

Definition at line 37 of file Cube_proto.hpp.

Referenced by Cube< eT >::create_mat(), Cube< eT >::delete_mat(), Cube< eT >::slice(), and Cube< eT >::~Cube().

template<typename eT>
arma_aligned const eT* const Cube< eT >::mem
template<typename eT>
arma_aligned Mat<eT>* Cube< eT >::mat_ptrs_local[16] [protected]

Definition at line 41 of file Cube_proto.hpp.

Referenced by Cube< eT >::create_mat(), and Cube< eT >::delete_mat().

template<typename eT>
arma_aligned eT Cube< eT >::mem_local[64] [protected]

Definition at line 42 of file Cube_proto.hpp.

Referenced by Cube< eT >::init(), and Cube< eT >::~Cube().