Cube

Classes

class  Cube< eT >
 Dense cube class. More...
class  Cube_aux

Functions

 Cube::~Cube ()
 Cube::Cube ()
 Cube::Cube (const u32 in_rows, const u32 in_cols, const u32 in_slices)
 construct the cube to have user specified dimensions
void Cube::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 Cube::delete_mat ()
void Cube::create_mat ()
arma_inline const CubeCube::operator= (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 CubeCube::operator+= (const eT val)
 In-place addition of a scalar to all elements of the cube.
arma_inline const CubeCube::operator-= (const eT val)
 In-place subtraction of a scalar from all elements of the cube.
arma_inline const CubeCube::operator*= (const eT val)
 In-place multiplication of all elements of the cube with a scalar.
arma_inline const CubeCube::operator/= (const eT val)
 In-place division of all elements of the cube with a scalar.
 Cube::Cube (const Cube &m)
 construct a cube from a given cube
const CubeCube::operator= (const Cube &m)
 construct a cube from a given cube
void Cube::init (const Cube &x)
 construct a cube from a given cube
 Cube::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::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.
const CubeCube::operator+= (const Cube &m)
 in-place cube addition
const CubeCube::operator-= (const Cube &m)
 in-place cube subtraction
const CubeCube::operator%= (const Cube &m)
 in-place element-wise cube multiplication
const CubeCube::operator/= (const Cube &m)
 in-place element-wise cube division
template<typename T1 , typename T2 >
 Cube::Cube (const BaseCube< pod_type, T1 > &A, const BaseCube< pod_type, T2 > &B)
 for constructing a complex cube out of two non-complex cubes
 Cube::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 CubeCube::operator= (const subview_cube< eT > &X)
 construct a cube from a subview_cube instance (e.g. construct a cube from a delayed subcube operation)
const CubeCube::operator+= (const subview_cube< eT > &X)
 in-place cube addition (using a subcube on the right-hand-side)
const CubeCube::operator-= (const subview_cube< eT > &X)
 in-place cube subtraction (using a subcube on the right-hand-side)
const CubeCube::operator%= (const subview_cube< eT > &X)
 in-place element-wise cube mutiplication (using a subcube on the right-hand-side)
const CubeCube::operator/= (const subview_cube< eT > &X)
 in-place element-wise cube division (using a subcube on the right-hand-side)
arma_inline Mat< eT > & Cube::slice (const u32 in_slice)
 provide the reference to the matrix representing a single slice
arma_inline const Mat< eT > & Cube::slice (const u32 in_slice) const
 provide the reference to the matrix representing a single slice
arma_inline subview_cube< eT > Cube::slices (const u32 in_slice1, const u32 in_slice2)
 creation of subview_cube (subcube comprised of specified slices)
arma_inline const subview_cube
< eT > 
Cube::slices (const u32 in_slice1, const u32 in_slice2) const
 creation of subview_cube (subcube comprised of specified slices)
arma_inline subview_cube< eT > Cube::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 > 
Cube::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_cube_type >
 Cube::Cube (const OpCube< T1, op_cube_type > &X)
 create a cube from OpCube, i.e. run the previously delayed unary operations
template<typename T1 , typename op_cube_type >
const CubeCube::operator= (const OpCube< T1, op_cube_type > &X)
 create a cube from OpCube, i.e. run the previously delayed unary operations
template<typename T1 , typename op_cube_type >
const CubeCube::operator+= (const OpCube< T1, op_cube_type > &X)
 in-place cube addition, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_cube_type >
const CubeCube::operator-= (const OpCube< T1, op_cube_type > &X)
 in-place cube subtraction, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_cube_type >
const CubeCube::operator%= (const OpCube< T1, op_cube_type > &X)
 in-place cube element-wise multiplication, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_cube_type >
const CubeCube::operator/= (const OpCube< T1, op_cube_type > &X)
 in-place cube element-wise division, with the right-hand-side operand having delayed operations
template<typename T1 , typename T2 , typename glue_cube_type >
 Cube::Cube (const GlueCube< T1, T2, glue_cube_type > &X)
 create a cube from Glue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename glue_cube_type >
const CubeCube::operator= (const GlueCube< T1, T2, glue_cube_type > &X)
 create a cube from Glue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename glue_cube_type >
const CubeCube::operator+= (const GlueCube< T1, T2, glue_cube_type > &X)
 in-place cube addition, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_cube_type >
const CubeCube::operator-= (const GlueCube< T1, T2, glue_cube_type > &X)
 in-place cube subtraction, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_cube_type >
const CubeCube::operator%= (const GlueCube< T1, T2, glue_cube_type > &X)
 in-place cube element-wise multiplication, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_cube_type >
const CubeCube::operator/= (const GlueCube< T1, T2, glue_cube_type > &X)
 in-place cube element-wise division, with the right-hand-side operands having delayed operations
arma_inline eT & Cube::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 Cube::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 & Cube::operator[] (const u32 i)
 linear element accessor (treats the cube as a vector); no bounds check.
arma_inline eT Cube::operator[] (const u32 i) const
 linear element accessor (treats the cube as a vector); no bounds check
arma_inline eT & Cube::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 Cube::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 eT & Cube::at (const u32 in_row, const u32 in_col, const u32 in_slice)
 element accessor; no bounds check
arma_inline eT Cube::at (const u32 in_row, const u32 in_col, const u32 in_slice) const
 element accessor; no bounds check
arma_inline const CubeCube::operator++ ()
 prefix ++
arma_inline void Cube::operator++ (int)
 postfix ++ (must not return the object by reference)
arma_inline const CubeCube::operator-- ()
 prefix --
arma_inline void Cube::operator-- (int)
 postfix -- (must not return the object by reference)
arma_inline bool Cube::is_finite () const
 returns true if all of the elements are finite
arma_inline eT * Cube::memptr ()
 returns a pointer to array of eTs used by the cube
arma_inline const eT * Cube::memptr () const
 returns a pointer to array of eTs used by the cube
arma_inline eT * Cube::slice_memptr (const u32 slice)
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline const eT * Cube::slice_memptr (const u32 slice) const
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline eT * Cube::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 * Cube::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 Cube::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 Cube::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 Cube::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 Cube::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 Cube::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 Cube::copy_size (const Cube< eT2 > &m)
 change the cube (without preserving data) to have the same dimensions as the given cube
void Cube::fill (const eT val)
 fill the cube with the specified value
void Cube::zeros ()
void Cube::zeros (const u32 in_rows, const u32 in_cols, const u32 in_slices)
void Cube::ones ()
void Cube::ones (const u32 in_rows, const u32 in_cols, const u32 in_slices)
void Cube::reset ()
void Cube::save (const std::string name, const file_type type=arma_binary) const
 save the cube to a file
void Cube::load (const std::string name, const file_type type=auto_detect)
 load a cube from a file
template<typename eT >
static arma_inline void Cube_aux::prefix_pp (Cube< eT > &x)
 prefix ++
template<typename T >
static arma_inline void Cube_aux::prefix_pp (Cube< std::complex< T > > &x)
 prefix ++ for complex numbers (work around for limitations of the std::complex class)
template<typename eT >
static arma_inline void Cube_aux::postfix_pp (Cube< eT > &x)
 postfix ++
template<typename T >
static arma_inline void Cube_aux::postfix_pp (Cube< std::complex< T > > &x)
 postfix ++ for complex numbers (work around for limitations of the std::complex class)
template<typename eT >
static arma_inline void Cube_aux::prefix_mm (Cube< eT > &x)
 prefix --
template<typename T >
static arma_inline void Cube_aux::prefix_mm (Cube< std::complex< T > > &x)
 prefix -- for complex numbers (work around for limitations of the std::complex class)
template<typename eT >
static arma_inline void Cube_aux::postfix_mm (Cube< eT > &x)
 postfix --
template<typename T >
static arma_inline void Cube_aux::postfix_mm (Cube< std::complex< T > > &x)
 postfix ++ for complex numbers (work around for limitations of the std::complex class)

Function Documentation

template<typename eT >
Cube< eT >::~Cube (  )  [inline, inherited]

Definition at line 22 of file Cube_meat.hpp.

References arma_config::debug, Cube< eT >::delete_mat(), Cube< eT >::mem, Cube< eT >::mem_local, Cube< eT >::n_cols, Cube< eT >::n_elem, Cube< eT >::n_elem_slice, Cube< eT >::n_rows, Cube< eT >::n_slices, access::rw(), and Cube< eT >::use_aux_mem.

00023   {
00024   arma_extra_debug_sigprint_this(this);
00025   
00026   delete_mat();
00027   
00028   if(use_aux_mem == false)
00029     {
00030     if(n_elem > sizeof(mem_local)/sizeof(eT) )
00031       {
00032       delete [] mem;
00033       }
00034     }
00035     
00036   if(arma_config::debug == true)
00037     {
00038     // try to expose buggy user code that accesses deleted objects
00039     access::rw(n_rows)       = 0;
00040     access::rw(n_cols)       = 0;
00041     access::rw(n_elem_slice) = 0;
00042     access::rw(n_slices)     = 0;
00043     access::rw(n_elem)       = 0;
00044     access::rw(mat_ptrs)     = 0;
00045     access::rw(mem)          = 0;
00046     }
00047   
00048   isnt_supported_elem_type<eT>::check();
00049   }

template<typename eT >
Cube< eT >::Cube (  )  [inline, inherited]

Definition at line 55 of file Cube_meat.hpp.

00056   : n_rows(0)
00057   , n_cols(0)
00058   , n_elem_slice(0)
00059   , n_slices(0)
00060   , n_elem(0)
00061   , use_aux_mem(false)
00062   , mat_ptrs(mat_ptrs)
00063   , mem(mem)
00064   {
00065   arma_extra_debug_sigprint_this(this);
00066   }

template<typename eT >
Cube< eT >::Cube ( const u32  in_rows,
const u32  in_cols,
const u32  in_slices 
) [inline, inherited]

construct the cube to have user specified dimensions

Definition at line 73 of file Cube_meat.hpp.

References Cube< eT >::init().

00074   : n_rows(0)
00075   , n_cols(0)
00076   , n_elem_slice(0)
00077   , n_slices(0)
00078   , n_elem(0)
00079   , use_aux_mem(false)
00080   , mat_ptrs(mat_ptrs)
00081   , mem(mem)
00082   {
00083   arma_extra_debug_sigprint_this(this);
00084   
00085   init(in_n_rows, in_n_cols, in_n_slices);
00086   }

template<typename eT >
void Cube< eT >::init ( const u32  in_rows,
const u32  in_cols,
const u32  in_slices 
) [inline, protected, inherited]

internal cube construction; if the requested size is small enough, memory from the stack is used. otherwise memory is allocated via 'new'

Definition at line 95 of file Cube_meat.hpp.

References arma_check(), Cube< eT >::create_mat(), Cube< eT >::delete_mat(), Cube< eT >::mem, Cube< eT >::mem_local, Cube< eT >::n_cols, Cube< eT >::n_elem, Cube< eT >::n_elem_slice, Cube< eT >::n_rows, Cube< eT >::n_slices, access::rw(), and Cube< eT >::use_aux_mem.

Referenced by Cube< eT >::copy_size(), Cube< eT >::Cube(), Cube< eT >::init(), Cube< eT >::operator=(), Cube< eT >::reset(), and Cube< eT >::set_size().

00096   {
00097   arma_extra_debug_sigprint( arma_boost::format("in_n_rows = %d, in_n_cols = %d, in_n_slices = %d") % in_n_rows % in_n_cols % in_n_slices );
00098   
00099   const u32 new_n_elem = in_n_rows * in_n_cols * in_n_slices;
00100 
00101   if(n_elem == new_n_elem)
00102     {
00103     if( (n_rows != in_n_rows) || (n_cols != in_n_cols) || (n_slices != in_n_slices) )
00104       {
00105       delete_mat();
00106 
00107       access::rw(n_rows)       = in_n_rows;
00108       access::rw(n_cols)       = in_n_cols;
00109       access::rw(n_elem_slice) = in_n_rows*in_n_cols;
00110       access::rw(n_slices)     = in_n_slices;
00111     
00112       create_mat();
00113       }
00114     }
00115   else
00116     {
00117     arma_debug_check
00118       (
00119       (use_aux_mem == true),
00120       "Cube::init(): can't change the amount of memory as auxiliary memory is in use"
00121       );
00122       
00123     delete_mat();
00124 
00125     if(n_elem > sizeof(mem_local)/sizeof(eT) )
00126       {
00127       delete [] mem;
00128       }
00129     
00130     if(new_n_elem <= sizeof(mem_local)/sizeof(eT) )
00131       {
00132       access::rw(mem) = mem_local;
00133       }
00134     else
00135       {
00136       access::rw(mem) = new(std::nothrow) eT[new_n_elem];
00137       arma_check( (mem == 0), "Cube::init(): out of memory" );
00138       }
00139     
00140     access::rw(n_elem) = new_n_elem;
00141 
00142     if(new_n_elem == 0)
00143       {
00144       access::rw(n_rows)       = 0;
00145       access::rw(n_cols)       = 0;
00146       access::rw(n_elem_slice) = 0;
00147       access::rw(n_slices)     = 0;
00148       }
00149     else
00150       {
00151       access::rw(n_rows)       = in_n_rows;
00152       access::rw(n_cols)       = in_n_cols;
00153       access::rw(n_elem_slice) = in_n_rows*in_n_cols;
00154       access::rw(n_slices)     = in_n_slices;
00155       }
00156       
00157     create_mat();
00158     }
00159   }

template<typename eT >
void Cube< eT >::delete_mat (  )  [inline, protected, inherited]

Definition at line 165 of file Cube_meat.hpp.

References Cube< eT >::mat_ptrs_local, Cube< eT >::n_slices, access::rw(), and Cube< eT >::slice().

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

00166   {
00167   arma_extra_debug_sigprint();
00168   
00169   for(u32 slice = 0; slice < n_slices; ++slice)
00170     {
00171     delete access::rw(mat_ptrs[slice]);
00172     }
00173 
00174   if(n_slices > sizeof(mat_ptrs_local)/sizeof(Mat<eT>*) )
00175     {
00176     delete [] mat_ptrs;
00177     }
00178   }

template<typename eT >
void Cube< eT >::create_mat (  )  [inline, protected, inherited]

Definition at line 185 of file Cube_meat.hpp.

References arma_check(), Cube< eT >::mat_ptrs_local, Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, access::rw(), Cube< eT >::slice(), and Cube< eT >::slice_memptr().

Referenced by Cube< eT >::init().

00186   {
00187   arma_extra_debug_sigprint();
00188 
00189   if( n_slices <= sizeof(mat_ptrs_local)/sizeof(Mat<eT>*) )
00190     {
00191     access::rw(mat_ptrs) = const_cast< const Mat<eT>** >(mat_ptrs_local);
00192     }
00193   else
00194     {
00195     access::rw(mat_ptrs) = new(std::nothrow) const Mat<eT>*[n_slices];
00196     arma_check( (mat_ptrs == 0), "Cube::create_mat(): out of memory" );
00197     }
00198     
00199   for(u32 slice = 0; slice < n_slices; ++slice)
00200     {
00201     mat_ptrs[slice] = new Mat<eT>('j', slice_memptr(slice), n_rows, n_cols);
00202     }
00203   }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator= ( const eT  val  )  [inline, inherited]

Set the cube to be equal to the specified scalar. NOTE: the size of the cube will be 1x1x1.

Definition at line 212 of file Cube_meat.hpp.

References Cube< eT >::init(), Cube< eT >::mem, and access::rw().

Referenced by Cube< eT >::Cube().

00213   {
00214   arma_extra_debug_sigprint();
00215   
00216   init(1,1,1);
00217   access::rw(mem[0]) = val;
00218   return *this;
00219   }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator+= ( const eT  val  )  [inline, inherited]

In-place addition of a scalar to all elements of the cube.

Definition at line 227 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem, and access::rw().

00228   {
00229   arma_extra_debug_sigprint();
00230   
00231   for(u32 i=0; i<n_elem; ++i)
00232     {
00233     access::rw(mem[i]) += val;
00234     }
00235   
00236   return *this;
00237   }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator-= ( const eT  val  )  [inline, inherited]

In-place subtraction of a scalar from all elements of the cube.

Definition at line 245 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem, and access::rw().

00246   {
00247   arma_extra_debug_sigprint();
00248   
00249   for(u32 i=0; i<n_elem; ++i)
00250     {
00251     access::rw(mem[i]) -= val;
00252     }
00253       
00254   return *this;
00255   }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator*= ( const eT  val  )  [inline, inherited]

In-place multiplication of all elements of the cube with a scalar.

Definition at line 263 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem, and access::rw().

00264   {
00265   arma_extra_debug_sigprint();
00266   
00267   for(u32 i=0; i<n_elem; ++i)
00268     {
00269     access::rw(mem[i]) *= val;
00270     }
00271   
00272   return *this;
00273   }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator/= ( const eT  val  )  [inline, inherited]

In-place division of all elements of the cube with a scalar.

Definition at line 281 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem, and access::rw().

00282   {
00283   arma_extra_debug_sigprint();
00284   
00285   for(u32 i=0; i<n_elem; ++i)
00286     {
00287     access::rw(mem[i]) /= val;
00288     }
00289   
00290   return *this;
00291   }

template<typename eT>
Cube< eT >::Cube ( const Cube< eT > &  m  )  [inline, inherited]

construct a cube from a given cube

Definition at line 298 of file Cube_meat.hpp.

References Cube< eT >::init().

00299   : n_rows(0)
00300   , n_cols(0)
00301   , n_elem_slice(0)
00302   , n_slices(0)
00303   , n_elem(0)
00304   , use_aux_mem(false)
00305   , mat_ptrs(mat_ptrs)
00306   , mem(mem)
00307   {
00308   arma_extra_debug_sigprint(arma_boost::format("this = %x   in_cube = %x") % this % &in_cube);
00309   
00310   init(in_cube);
00311   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator= ( const Cube< eT > &  m  )  [inline, inherited]

construct a cube from a given cube

Definition at line 319 of file Cube_meat.hpp.

References Cube< eT >::init().

00320   {
00321   arma_extra_debug_sigprint();
00322   
00323   init(x);
00324   return *this;
00325   }

template<typename eT >
void Cube< eT >::init ( const Cube< eT > &  x  )  [inline, protected, inherited]

construct a cube from a given cube

Definition at line 333 of file Cube_meat.hpp.

References syslib::copy_elem(), Cube< eT >::init(), Cube< eT >::mem, Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_elem, Cube< eT >::n_rows, and Cube< eT >::n_slices.

00334   {
00335   arma_extra_debug_sigprint();
00336   
00337   if(this != &x)
00338     {
00339     init(x.n_rows, x.n_cols, x.n_slices);
00340     syslib::copy_elem( memptr(), x.mem, n_elem );
00341     }
00342   }

template<typename eT>
Cube< eT >::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 
) [inline, inherited]

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.

Definition at line 354 of file Cube_meat.hpp.

References syslib::copy_elem(), Cube< eT >::init(), Cube< eT >::memptr(), and Cube< eT >::n_elem.

00355   : n_rows      (copy_aux_mem ? 0     : aux_n_rows                        )
00356   , n_cols      (copy_aux_mem ? 0     : aux_n_cols                        )
00357   , n_elem_slice(copy_aux_mem ? 0     : aux_n_rows*aux_n_cols             )
00358   , n_slices    (copy_aux_mem ? 0     : aux_n_slices                      )
00359   , n_elem      (copy_aux_mem ? 0     : aux_n_rows*aux_n_cols*aux_n_slices)
00360   , use_aux_mem (copy_aux_mem ? false : true                              )
00361   , mem         (copy_aux_mem ? mem   : aux_mem                           )
00362   {
00363   arma_extra_debug_sigprint_this(this);
00364   
00365   if(copy_aux_mem == true)
00366     {
00367     init(aux_n_rows, aux_n_cols, aux_n_slices);
00368     syslib::copy_elem( memptr(), aux_mem, n_elem );
00369     }
00370   }

template<typename eT>
Cube< eT >::Cube ( const eT *  aux_mem,
const u32  aux_n_rows,
const u32  aux_n_cols,
const u32  aux_n_slices 
) [inline, inherited]

construct a cube from a given auxiliary read-only array of eTs. the array is copied.

Definition at line 378 of file Cube_meat.hpp.

References syslib::copy_elem(), Cube< eT >::init(), Cube< eT >::memptr(), and Cube< eT >::n_elem.

00379   : n_rows(0)
00380   , n_cols(0)
00381   , n_elem_slice(0)
00382   , n_slices(0)
00383   , n_elem(0)
00384   , use_aux_mem(false)
00385   , mat_ptrs(mat_ptrs)
00386   , mem(mem)
00387   {
00388   arma_extra_debug_sigprint_this(this);
00389   
00390   init(aux_n_rows, aux_n_cols, aux_n_slices);
00391   syslib::copy_elem( memptr(), aux_mem, n_elem );
00392   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator+= ( const Cube< eT > &  m  )  [inline, inherited]

in-place cube addition

Definition at line 400 of file Cube_meat.hpp.

References glue_cube_plus::apply_inplace().

00401   {
00402   arma_extra_debug_sigprint();
00403   
00404   glue_cube_plus::apply_inplace(*this, m);
00405   return *this;
00406   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator-= ( const Cube< eT > &  m  )  [inline, inherited]

in-place cube subtraction

Definition at line 414 of file Cube_meat.hpp.

References glue_cube_minus::apply_inplace().

00415   {
00416   arma_extra_debug_sigprint();
00417   
00418   glue_cube_minus::apply_inplace(*this, m);
00419   return *this;
00420   }

template<typename eT >
const Cube< eT > & Cube< eT >::operator%= ( const Cube< eT > &  m  )  [inline, inherited]

in-place element-wise cube multiplication

Definition at line 428 of file Cube_meat.hpp.

References glue_cube_schur::apply_inplace().

00429   {
00430   arma_extra_debug_sigprint();
00431   
00432   glue_cube_schur::apply_inplace(*this, m);
00433   return *this;
00434   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator/= ( const Cube< eT > &  m  )  [inline, inherited]

in-place element-wise cube division

Definition at line 442 of file Cube_meat.hpp.

References glue_cube_div::apply_inplace().

00443   {
00444   arma_extra_debug_sigprint();
00445   
00446   glue_cube_div::apply_inplace(*this, m);
00447   return *this;
00448   }

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, inherited]

for constructing a complex cube out of two non-complex cubes

< compile-time abort if eT isn't std::complex

< compile-time abort if T is std::complex

< compile-time abort if types are not compatible

Definition at line 457 of file Cube_meat.hpp.

References arma_assert_same_size(), Cube< eT >::mem, and access::rw().

00461   : n_rows(0)
00462   , n_cols(0)
00463   , n_elem_slice(0)
00464   , n_slices(0)
00465   , n_elem(0)
00466   , use_aux_mem(false)
00467   , mat_ptrs(mat_ptrs)
00468   , mem(mem)
00469   {
00470   arma_extra_debug_sigprint_this(this);
00471   
00472   arma_type_check< is_complex<eT>::value == false >::apply();   //!< compile-time abort if eT isn't std::complex
00473   
00474   typedef typename T1::elem_type T;
00475   arma_type_check< is_complex<T>::value == true >::apply();   //!< compile-time abort if T is std::complex
00476   
00477   isnt_same_type<std::complex<T>, eT>::check();   //!< compile-time abort if types are not compatible
00478   
00479   const unwrap_cube<T1> tmp_A(A.get_ref());
00480   const unwrap_cube<T2> tmp_B(B.get_ref());
00481   
00482   const Cube<T>& X = tmp_A.M;
00483   const Cube<T>& Y = tmp_B.M;
00484   
00485   arma_assert_same_size(X, Y, "Cube()");
00486   
00487   init(X.n_rows, X.n_cols, X.n_slices);
00488   
00489   const T* X_mem = X.mem;
00490   const T* Y_mem = Y.mem;
00491   
00492   for(u32 i=0; i<n_elem; ++i)
00493     {
00494     access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]);
00495     }
00496   }

template<typename eT>
Cube< eT >::Cube ( const subview_cube< eT > &  X  )  [inline, inherited]

construct a cube from a subview_cube instance (e.g. construct a cube from a delayed subcube operation)

Definition at line 503 of file Cube_meat.hpp.

References Cube< eT >::operator=().

00504   : n_rows(0)
00505   , n_cols(0)
00506   , n_elem_slice(0)
00507   , n_slices(0)
00508   , n_elem(0)
00509   , use_aux_mem(false)
00510   , mat_ptrs(mat_ptrs)
00511   , mem(mem)
00512   {
00513   arma_extra_debug_sigprint_this(this);
00514   
00515   this->operator=(X);
00516   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator= ( const subview_cube< eT > &  X  )  [inline, inherited]

construct a cube from a subview_cube instance (e.g. construct a cube from a delayed subcube operation)

Definition at line 524 of file Cube_meat.hpp.

00525   {
00526   arma_extra_debug_sigprint();
00527   
00528   subview_cube<eT>::extract(*this, X);
00529   return *this;
00530   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator+= ( const subview_cube< eT > &  X  )  [inline, inherited]

in-place cube addition (using a subcube on the right-hand-side)

Definition at line 538 of file Cube_meat.hpp.

00539   {
00540   arma_extra_debug_sigprint();
00541   
00542   subview_cube<eT>::plus_inplace(*this, X);
00543   return *this;
00544   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator-= ( const subview_cube< eT > &  X  )  [inline, inherited]

in-place cube subtraction (using a subcube on the right-hand-side)

Definition at line 552 of file Cube_meat.hpp.

00553   {
00554   arma_extra_debug_sigprint();
00555   
00556   subview_cube<eT>::minus_inplace(*this, X);
00557   return *this;
00558   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator%= ( const subview_cube< eT > &  X  )  [inline, inherited]

in-place element-wise cube mutiplication (using a subcube on the right-hand-side)

Definition at line 566 of file Cube_meat.hpp.

00567   {
00568   arma_extra_debug_sigprint();
00569   
00570   subview_cube<eT>::schur_inplace(*this, X);
00571   return *this;
00572   }

template<typename eT>
const Cube< eT > & Cube< eT >::operator/= ( const subview_cube< eT > &  X  )  [inline, inherited]

in-place element-wise cube division (using a subcube on the right-hand-side)

Definition at line 580 of file Cube_meat.hpp.

00581   {
00582   arma_extra_debug_sigprint();
00583   
00584   subview_cube<eT>::div_inplace(*this, X);
00585   return *this;
00586   }

template<typename eT >
arma_inline Mat< eT > & Cube< eT >::slice ( const u32  in_slice  )  [inline, inherited]

provide the reference to the matrix representing a single slice

Definition at line 594 of file Cube_meat.hpp.

References Cube< eT >::n_slices.

Referenced by Cube< eT >::create_mat(), Cube< eT >::delete_mat(), diskio::load_raw_ascii(), and arma_ostream::print().

00595   {
00596   arma_extra_debug_sigprint();
00597   
00598   arma_debug_check
00599     (
00600     (in_slice >= n_slices),
00601     "Cube::slice(): index out of bounds"
00602     );
00603   
00604   return const_cast< Mat<eT>& >( *(mat_ptrs[in_slice]) );
00605   }

template<typename eT >
arma_inline const Mat< eT > & Cube< eT >::slice ( const u32  in_slice  )  const [inline, inherited]

provide the reference to the matrix representing a single slice

Definition at line 613 of file Cube_meat.hpp.

References Cube< eT >::n_slices.

00614   {
00615   arma_extra_debug_sigprint();
00616   
00617   arma_debug_check
00618     (
00619     (in_slice >= n_slices),
00620     "Cube::slice(): index out of bounds"
00621     );
00622    
00623   return *(mat_ptrs[in_slice]);
00624   }

template<typename eT >
arma_inline subview_cube< eT > Cube< eT >::slices ( const u32  in_slice1,
const u32  in_slice2 
) [inline, inherited]

creation of subview_cube (subcube comprised of specified slices)

Definition at line 632 of file Cube_meat.hpp.

References Cube< eT >::n_cols, Cube< eT >::n_rows, and Cube< eT >::n_slices.

00633   {
00634   arma_extra_debug_sigprint();
00635   
00636   arma_debug_check
00637     (
00638     (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
00639     "Cube::slices(): indices out of bounds or incorrectly used"
00640     );
00641   
00642   return subview_cube<eT>(*this, 0, 0, in_slice1, ( (n_rows>0) ? n_rows-1 : 0 ), ( (n_cols>0) ? n_cols-1 : 0 ), in_slice2);
00643   }

template<typename eT >
arma_inline const subview_cube< eT > Cube< eT >::slices ( const u32  in_slice1,
const u32  in_slice2 
) const [inline, inherited]

creation of subview_cube (subcube comprised of specified slices)

Definition at line 651 of file Cube_meat.hpp.

References Cube< eT >::n_cols, Cube< eT >::n_rows, and Cube< eT >::n_slices.

00652   {
00653   arma_extra_debug_sigprint();
00654   
00655   arma_debug_check
00656     (
00657     (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
00658     "Cube::rows(): indices out of bounds or incorrectly used"
00659     );
00660   
00661   return subview_cube<eT>(*this, 0, 0, in_slice1, ( (n_rows>0) ? n_rows-1 : 0 ), ( (n_cols>0) ? n_cols-1 : 0 ), in_slice2);
00662   }

template<typename eT >
arma_inline subview_cube< eT > 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 
) [inline, inherited]

creation of subview_cube (generic subcube)

Definition at line 670 of file Cube_meat.hpp.

References Cube< eT >::n_cols, Cube< eT >::n_rows, and Cube< eT >::n_slices.

00671   {
00672   arma_extra_debug_sigprint();
00673   
00674   arma_debug_check
00675     (
00676     (in_row1 >  in_row2) || (in_col1 >  in_col2) || (in_slice1 >  in_slice2) ||
00677     (in_row2 >= n_rows)  || (in_col2 >= n_cols)  || (in_slice2 >= n_slices),
00678     "Cube::subcube(): indices out of bounds or incorrectly used"
00679     );
00680   
00681   return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_col2, in_slice2);
00682   }

template<typename eT >
arma_inline const subview_cube< eT > 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 [inline, inherited]

creation of subview_cube (generic subcube)

Definition at line 690 of file Cube_meat.hpp.

References Cube< eT >::n_cols, Cube< eT >::n_rows, and Cube< eT >::n_slices.

00691   {
00692   arma_extra_debug_sigprint();
00693   
00694   arma_debug_check
00695     (
00696     (in_row1 >  in_row2) || (in_col1 >  in_col2) || (in_slice1 >  in_slice2) ||
00697     (in_row2 >= n_rows)  || (in_col2 >= n_cols)  || (in_slice2 >= n_slices),
00698     "Cube::subcube(): indices out of bounds or incorrectly used"
00699     );
00700     
00701   return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_col2, in_slice2);
00702   }

template<typename eT >
template<typename T1 , typename op_cube_type >
Cube< eT >::Cube ( const OpCube< T1, op_cube_type > &  X  )  [inline, inherited]

create a cube from OpCube, i.e. run the previously delayed unary operations

Definition at line 710 of file Cube_meat.hpp.

00711   : n_rows(0)
00712   , n_cols(0)
00713   , n_elem_slice(0)
00714   , n_slices(0)
00715   , n_elem(0)
00716   , use_aux_mem(false)
00717   , mat_ptrs(mat_ptrs)
00718   , mem(mem)
00719   {
00720   arma_extra_debug_sigprint_this(this);
00721 
00722   isnt_same_type<eT, typename T1::elem_type>::check();
00723   
00724   op_cube_type::apply(*this, X);
00725   }

template<typename eT >
template<typename T1 , typename op_cube_type >
const Cube< eT > & Cube< eT >::operator= ( const OpCube< T1, op_cube_type > &  X  )  [inline, inherited]

create a cube from OpCube, i.e. run the previously delayed unary operations

Definition at line 734 of file Cube_meat.hpp.

00735   {
00736   arma_extra_debug_sigprint();
00737 
00738   isnt_same_type<eT, typename T1::elem_type>::check();
00739   
00740   op_cube_type::apply(*this, X);
00741   
00742   return *this;
00743   }

template<typename eT >
template<typename T1 , typename op_cube_type >
const Cube< eT > & Cube< eT >::operator+= ( const OpCube< T1, op_cube_type > &  X  )  [inline, inherited]

in-place cube addition, with the right-hand-side operand having delayed operations

Definition at line 752 of file Cube_meat.hpp.

References glue_cube_plus::apply_inplace().

00753   {
00754   arma_extra_debug_sigprint();
00755   
00756   isnt_same_type<eT, typename T1::elem_type>::check();
00757   
00758   glue_cube_plus::apply_inplace(*this, X);
00759   
00760   return *this;
00761   }

template<typename eT >
template<typename T1 , typename op_cube_type >
const Cube< eT > & Cube< eT >::operator-= ( const OpCube< T1, op_cube_type > &  X  )  [inline, inherited]

in-place cube subtraction, with the right-hand-side operand having delayed operations

Definition at line 770 of file Cube_meat.hpp.

References glue_cube_minus::apply_inplace().

00771   {
00772   arma_extra_debug_sigprint();
00773   
00774   isnt_same_type<eT, typename T1::elem_type>::check();
00775   
00776   glue_cube_minus::apply_inplace(*this, X);
00777   
00778   return *this;
00779   }

template<typename eT >
template<typename T1 , typename op_cube_type >
const Cube< eT > & Cube< eT >::operator%= ( const OpCube< T1, op_cube_type > &  X  )  [inline, inherited]

in-place cube element-wise multiplication, with the right-hand-side operand having delayed operations

Definition at line 788 of file Cube_meat.hpp.

References glue_cube_schur::apply_inplace().

00789   {
00790   arma_extra_debug_sigprint();
00791   
00792   isnt_same_type<eT, typename T1::elem_type>::check();
00793   glue_cube_schur::apply_inplace(*this, X);
00794   
00795   return *this;
00796   }

template<typename eT >
template<typename T1 , typename op_cube_type >
const Cube< eT > & Cube< eT >::operator/= ( const OpCube< T1, op_cube_type > &  X  )  [inline, inherited]

in-place cube element-wise division, with the right-hand-side operand having delayed operations

Definition at line 805 of file Cube_meat.hpp.

References glue_cube_div::apply_inplace().

00806   {
00807   arma_extra_debug_sigprint();
00808   
00809   isnt_same_type<eT, typename T1::elem_type>::check();
00810   glue_cube_div::apply_inplace(*this, X);
00811   
00812   return *this;
00813   }

template<typename eT >
template<typename T1 , typename T2 , typename glue_cube_type >
Cube< eT >::Cube ( const GlueCube< T1, T2, glue_cube_type > &  X  )  [inline, inherited]

create a cube from Glue, i.e. run the previously delayed binary operations

Definition at line 821 of file Cube_meat.hpp.

References Cube< eT >::operator=().

00822   : n_rows(0)
00823   , n_cols(0)
00824   , n_elem_slice(0)
00825   , n_slices(0)
00826   , n_elem(0)
00827   , use_aux_mem(false)
00828   , mat_ptrs(mat_ptrs)
00829   , mem(mem)
00830   {
00831   arma_extra_debug_sigprint_this(this);
00832   this->operator=(X);
00833   }

template<typename eT >
template<typename T1 , typename T2 , typename glue_cube_type >
const Cube< eT > & Cube< eT >::operator= ( const GlueCube< T1, T2, glue_cube_type > &  X  )  [inline, inherited]

create a cube from Glue, i.e. run the previously delayed binary operations

Definition at line 842 of file Cube_meat.hpp.

00843   {
00844   arma_extra_debug_sigprint();
00845   
00846   isnt_same_type<eT, typename T1::elem_type>::check();
00847   isnt_same_type<eT, typename T2::elem_type>::check();
00848   
00849   glue_cube_type::apply(*this, X);
00850   
00851   return *this;
00852   }

template<typename eT >
template<typename T1 , typename T2 , typename glue_cube_type >
const Cube< eT > & Cube< eT >::operator+= ( const GlueCube< T1, T2, glue_cube_type > &  X  )  [inline, inherited]

in-place cube addition, with the right-hand-side operands having delayed operations

Definition at line 860 of file Cube_meat.hpp.

References glue_cube_plus::apply_inplace().

00861   {
00862   arma_extra_debug_sigprint();
00863   
00864   isnt_same_type<eT, typename T1::elem_type>::check();
00865   isnt_same_type<eT, typename T2::elem_type>::check();
00866   
00867   glue_cube_plus::apply_inplace(*this, X);
00868   
00869   return *this;
00870   }

template<typename eT >
template<typename T1 , typename T2 , typename glue_cube_type >
const Cube< eT > & Cube< eT >::operator-= ( const GlueCube< T1, T2, glue_cube_type > &  X  )  [inline, inherited]

in-place cube subtraction, with the right-hand-side operands having delayed operations

Definition at line 879 of file Cube_meat.hpp.

References glue_cube_minus::apply_inplace().

00880   {
00881   arma_extra_debug_sigprint();
00882   
00883   isnt_same_type<eT, typename T1::elem_type>::check();
00884   isnt_same_type<eT, typename T2::elem_type>::check();
00885   
00886   glue_cube_minus::apply_inplace(*this, X);
00887   
00888   return *this;
00889   }

template<typename eT >
template<typename T1 , typename T2 , typename glue_cube_type >
const Cube< eT > & Cube< eT >::operator%= ( const GlueCube< T1, T2, glue_cube_type > &  X  )  [inline, inherited]

in-place cube element-wise multiplication, with the right-hand-side operands having delayed operations

Definition at line 898 of file Cube_meat.hpp.

References glue_cube_schur::apply_inplace().

00899   {
00900   arma_extra_debug_sigprint();
00901   
00902   isnt_same_type<eT, typename T1::elem_type>::check();
00903   isnt_same_type<eT, typename T2::elem_type>::check();
00904   
00905   glue_cube_schur::apply_inplace(*this, X);
00906   return *this;
00907   }

template<typename eT >
template<typename T1 , typename T2 , typename glue_cube_type >
const Cube< eT > & Cube< eT >::operator/= ( const GlueCube< T1, T2, glue_cube_type > &  X  )  [inline, inherited]

in-place cube element-wise division, with the right-hand-side operands having delayed operations

Definition at line 916 of file Cube_meat.hpp.

References glue_cube_div::apply_inplace().

00917   {
00918   arma_extra_debug_sigprint();
00919   
00920   isnt_same_type<eT, typename T1::elem_type>::check();
00921   isnt_same_type<eT, typename T2::elem_type>::check();
00922   
00923   glue_cube_div::apply_inplace(*this, X);
00924   return *this;
00925   }

template<typename eT >
arma_inline eT & Cube< eT >::operator() ( const u32  i  )  [inline, inherited]

linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined

Definition at line 933 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem, and access::rw().

00934   {
00935   arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds");
00936   return access::rw(mem[i]);
00937   }

template<typename eT >
arma_inline eT Cube< eT >::operator() ( const u32  i  )  const [inline, inherited]

linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined

Definition at line 945 of file Cube_meat.hpp.

References Cube< eT >::mem, and Cube< eT >::n_elem.

00946   {
00947   arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds");
00948   return mem[i];
00949   }

template<typename eT >
arma_inline eT & Cube< eT >::operator[] ( const u32  i  )  [inline, inherited]

linear element accessor (treats the cube as a vector); no bounds check.

Definition at line 956 of file Cube_meat.hpp.

References Cube< eT >::mem, and access::rw().

00957   {
00958   return access::rw(mem[i]);
00959   }

template<typename eT >
arma_inline eT Cube< eT >::operator[] ( const u32  i  )  const [inline, inherited]

linear element accessor (treats the cube as a vector); no bounds check

Definition at line 967 of file Cube_meat.hpp.

References Cube< eT >::mem.

00968   {
00969   return mem[i];
00970   }

template<typename eT >
arma_inline eT & Cube< eT >::operator() ( const u32  in_row,
const u32  in_col,
const u32  in_slice 
) [inline, inherited]

element accessor; bounds checking not done when ARMA_NO_DEBUG is defined

Definition at line 978 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_cols, Cube< eT >::n_elem_slice, Cube< eT >::n_rows, Cube< eT >::n_slices, and access::rw().

00979   {
00980   arma_debug_check
00981     (
00982     (in_row >= n_rows) ||
00983     (in_col >= n_cols) ||
00984     (in_slice >= n_slices)
00985     ,
00986     "Cube::operator(): index out of bounds"
00987     );
00988 
00989   return access::rw(mem[in_slice*n_elem_slice + in_col*n_rows + in_row]);
00990   }

template<typename eT >
arma_inline eT Cube< eT >::operator() ( const u32  in_row,
const u32  in_col,
const u32  in_slice 
) const [inline, inherited]

element accessor; bounds checking not done when ARMA_NO_DEBUG is defined

Definition at line 998 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_cols, Cube< eT >::n_elem_slice, Cube< eT >::n_rows, and Cube< eT >::n_slices.

00999   {
01000   arma_debug_check
01001     (
01002     (in_row >= n_rows) ||
01003     (in_col >= n_cols) ||
01004     (in_slice >= n_slices)
01005     ,
01006     "Cube::operator(): index out of bounds"
01007     );
01008 
01009   return mem[in_slice*n_elem_slice + in_col*n_rows + in_row];
01010   }

template<typename eT >
arma_inline eT & Cube< eT >::at ( const u32  in_row,
const u32  in_col,
const u32  in_slice 
) [inline, inherited]
template<typename eT >
arma_inline eT Cube< eT >::at ( const u32  in_row,
const u32  in_col,
const u32  in_slice 
) const [inline, inherited]

element accessor; no bounds check

Definition at line 1029 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem_slice, and Cube< eT >::n_rows.

01030   {
01031   return mem[in_slice*n_elem_slice + in_col*n_rows + in_row];
01032   }

template<typename eT >
arma_inline const Cube< eT > & Cube< eT >::operator++ (  )  [inline, inherited]

prefix ++

Definition at line 1040 of file Cube_meat.hpp.

References Cube_aux::prefix_pp().

01041   {
01042   Cube_aux::prefix_pp(*this);
01043   return *this;
01044   }

template<typename eT >
arma_inline void Cube< eT >::operator++ ( int   )  [inline, inherited]

postfix ++ (must not return the object by reference)

Definition at line 1052 of file Cube_meat.hpp.

References Cube_aux::postfix_pp().

01053   {
01054   Cube_aux::postfix_pp(*this);
01055   }

template<typename eT >
arma_inline const Cube< eT > & Cube< eT >::operator-- (  )  [inline, inherited]

prefix --

Definition at line 1063 of file Cube_meat.hpp.

References Cube_aux::prefix_mm().

01064   {
01065   Cube_aux::prefix_mm(*this);
01066   return *this;
01067   }

template<typename eT >
arma_inline void Cube< eT >::operator-- ( int   )  [inline, inherited]

postfix -- (must not return the object by reference)

Definition at line 1075 of file Cube_meat.hpp.

References Cube_aux::postfix_mm().

01076   {
01077   Cube_aux::postfix_mm(*this);
01078   }

template<typename eT >
arma_inline bool Cube< eT >::is_finite (  )  const [inline, inherited]

returns true if all of the elements are finite

Definition at line 1086 of file Cube_meat.hpp.

References arma_isfinite(), Cube< eT >::mem, and Cube< eT >::n_elem.

01087   {
01088   for(u32 i=0; i<n_elem; ++i)
01089     {
01090     if(arma_isfinite(mem[i]) == false)
01091       {
01092       return false;
01093       }
01094     }
01095 
01096   return true;
01097   }

template<typename eT >
arma_inline eT * Cube< eT >::memptr (  )  [inline, inherited]

returns a pointer to array of eTs used by the cube

Definition at line 1105 of file Cube_meat.hpp.

References Cube< eT >::mem.

Referenced by abs(), op_atanh::apply(), op_tanh::apply(), op_atan::apply(), op_tan::apply(), op_asinh::apply(), op_sinh::apply(), op_asin::apply(), op_sin::apply(), op_acosh::apply(), op_cosh::apply(), op_acos::apply(), op_cos::apply(), op_scalar_div_post::apply(), op_scalar_div_pre::apply(), op_scalar_times::apply(), op_scalar_minus_post::apply(), op_scalar_minus_pre::apply(), op_scalar_plus::apply(), op_reshape::apply(), op_randn::apply(), op_rand::apply(), op_neg::apply(), op_conj::apply(), op_pow_s32::apply(), op_pow::apply(), op_square::apply(), op_sqrt::apply(), op_trunc_exp::apply(), op_exp::apply(), op_log10::apply(), op_trunc_log::apply(), op_log::apply(), glue_cube_schur::apply(), glue_cube_plus::apply(), glue_cube_minus::apply(), glue_cube_div::apply(), glue_cube_schur::apply_inplace(), glue_cube_plus::apply_inplace(), glue_cube_minus::apply_inplace(), glue_cube_div::apply_inplace(), Cube< eT >::Cube(), subview_cube< eT >::div_inplace(), conv_to< Cube< out_eT > >::from(), imag(), Cube< eT >::init(), diskio::load_arma_binary(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), subview_cube< eT >::plus_inplace(), Cube_aux::postfix_mm(), Cube_aux::postfix_pp(), Cube_aux::prefix_mm(), Cube_aux::prefix_pp(), arma_ostream::print(), real(), and subview_cube< eT >::schur_inplace().

01106   {
01107   return const_cast<eT*>(mem);
01108   }

template<typename eT >
arma_inline const eT * Cube< eT >::memptr (  )  const [inline, inherited]

returns a pointer to array of eTs used by the cube

Definition at line 1116 of file Cube_meat.hpp.

References Cube< eT >::mem.

01117   {
01118   return mem;
01119   }

template<typename eT >
arma_inline eT * Cube< eT >::slice_memptr ( const u32  slice  )  [inline, inherited]

returns a pointer to array of eTs used by the specified slice in the cube

Definition at line 1127 of file Cube_meat.hpp.

References Cube< eT >::mem, and Cube< eT >::n_elem_slice.

Referenced by Cube< eT >::create_mat().

01128   {
01129   return const_cast<eT*>( &mem[ slice*n_elem_slice ] );
01130   }

template<typename eT >
arma_inline const eT * Cube< eT >::slice_memptr ( const u32  slice  )  const [inline, inherited]

returns a pointer to array of eTs used by the specified slice in the cube

Definition at line 1138 of file Cube_meat.hpp.

References Cube< eT >::mem, and Cube< eT >::n_elem_slice.

01139   {
01140   return &mem[ slice*n_elem_slice ];
01141   }

template<typename eT >
arma_inline eT * Cube< eT >::slice_colptr ( const u32  in_slice,
const u32  in_col 
) [inline, inherited]

returns a pointer to array of eTs used by the specified slice in the cube

Definition at line 1149 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem_slice, and Cube< eT >::n_rows.

Referenced by subview_cube< eT >::div_inplace(), subview_cube< eT >::extract(), subview_cube< eT >::minus_inplace(), subview_cube< eT >::plus_inplace(), and subview_cube< eT >::schur_inplace().

01150   {
01151   return const_cast<eT*>( &mem[ slice*n_elem_slice + col*n_rows] );
01152   }

template<typename eT >
arma_inline const eT * Cube< eT >::slice_colptr ( const u32  in_slice,
const u32  in_col 
) const [inline, inherited]

returns a pointer to array of eTs used by the specified slice in the cube

Definition at line 1160 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem_slice, and Cube< eT >::n_rows.

01161   {
01162   return &mem[ slice*n_elem_slice + col*n_rows ];
01163   }

template<typename eT >
void Cube< eT >::print ( const std::string  extra_text = ""  )  const [inline, inherited]

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.

Definition at line 1174 of file Cube_meat.hpp.

Referenced by Cube< eT >::print(), and Cube< eT >::raw_print().

01175   {
01176   arma_extra_debug_sigprint();
01177   
01178   if(extra_text.length() != 0)
01179     {
01180     cout << extra_text << '\n';
01181     }
01182   
01183   arma_ostream::print(cout, *this, true);
01184   }

template<typename eT >
void Cube< eT >::print ( std::ostream &  user_stream,
const std::string  extra_text = "" 
) const [inline, inherited]

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.

Definition at line 1194 of file Cube_meat.hpp.

References Cube< eT >::print().

01195   {
01196   arma_extra_debug_sigprint();
01197   
01198   if(extra_text.length() != 0)
01199     {
01200     user_stream << extra_text << '\n';
01201     }
01202   
01203   arma_ostream::print(user_stream, *this, true);
01204   }

template<typename eT >
void Cube< eT >::raw_print ( const std::string  extra_text = ""  )  const [inline, inherited]

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

Definition at line 1215 of file Cube_meat.hpp.

References Cube< eT >::print().

01216   {
01217   arma_extra_debug_sigprint();
01218   
01219   if(extra_text.length() != 0)
01220     {
01221     cout << extra_text << '\n';
01222     }
01223   
01224   arma_ostream::print(cout, *this, false);
01225   }

template<typename eT >
void Cube< eT >::raw_print ( std::ostream &  user_stream,
const std::string  extra_text = "" 
) const [inline, inherited]

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

Definition at line 1236 of file Cube_meat.hpp.

References Cube< eT >::print().

01237   {
01238   arma_extra_debug_sigprint();
01239   
01240   if(extra_text.length() != 0)
01241     {
01242     user_stream << extra_text << '\n';
01243     }
01244   
01245   arma_ostream::print(user_stream, *this, false);
01246   }

template<typename eT >
void Cube< eT >::set_size ( const u32  in_rows,
const u32  in_cols,
const u32  in_slices 
) [inline, inherited]

change the cube to have user specified dimensions (data is not preserved)

Definition at line 1254 of file Cube_meat.hpp.

References Cube< eT >::init().

Referenced by op_reshape::apply(), op_randn::apply(), op_rand::apply(), glue_cube_schur::apply(), glue_cube_plus::apply(), glue_cube_minus::apply(), glue_cube_div::apply(), subview_cube< eT >::extract(), diskio::load_arma_ascii(), diskio::load_arma_binary(), diskio::load_ppm_binary(), diskio::load_raw_ascii(), Cube< eT >::ones(), and Cube< eT >::zeros().

01255   {
01256   arma_extra_debug_sigprint();
01257   
01258   init(in_n_rows, in_n_cols, in_n_slices);
01259   }

template<typename eT >
template<typename eT2 >
void Cube< eT >::copy_size ( const Cube< eT2 > &  m  )  [inline, inherited]
template<typename eT>
void Cube< eT >::fill ( const eT  val  )  [inline, inherited]

fill the cube with the specified value

Definition at line 1281 of file Cube_meat.hpp.

References Cube< eT >::mem, Cube< eT >::n_elem, and access::rw().

Referenced by Cube< eT >::ones(), operator*(), operator/(), and Cube< eT >::zeros().

01282   {
01283   arma_extra_debug_sigprint();
01284   
01285   for(u32 i=0; i<n_elem; ++i)
01286     {
01287     access::rw(mem[i]) = val;
01288     }
01289   }

template<typename eT >
void Cube< eT >::zeros (  )  [inline, inherited]

Definition at line 1296 of file Cube_meat.hpp.

References Cube< eT >::fill().

Referenced by op_zeros::apply(), and subview_cube< eT >::minus_inplace().

01297   {
01298   arma_extra_debug_sigprint();
01299   
01300   fill(eT(0));
01301   }

template<typename eT >
void Cube< eT >::zeros ( const u32  in_rows,
const u32  in_cols,
const u32  in_slices 
) [inline, inherited]

Definition at line 1308 of file Cube_meat.hpp.

References Cube< eT >::fill(), and Cube< eT >::set_size().

01309   {
01310   arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d, in_slices = %d") % in_rows % in_cols % in_slices );
01311 
01312   set_size(in_rows, in_cols, in_slices);
01313   fill(eT(0));
01314   }

template<typename eT >
void Cube< eT >::ones (  )  [inline, inherited]

Definition at line 1321 of file Cube_meat.hpp.

References Cube< eT >::fill().

Referenced by op_ones_full::apply().

01322   {
01323   arma_extra_debug_sigprint();
01324   
01325   fill(eT(1));
01326   }

template<typename eT >
void Cube< eT >::ones ( const u32  in_rows,
const u32  in_cols,
const u32  in_slices 
) [inline, inherited]

Definition at line 1333 of file Cube_meat.hpp.

References Cube< eT >::fill(), and Cube< eT >::set_size().

01334   {
01335   arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d, in_slices = %d") % in_rows % in_cols % in_slices );
01336 
01337   set_size(in_rows, in_cols, in_slices);
01338   fill(eT(1));
01339   }

template<typename eT >
void Cube< eT >::reset (  )  [inline, inherited]

Definition at line 1346 of file Cube_meat.hpp.

References Cube< eT >::init().

Referenced by diskio::load_arma_ascii(), diskio::load_arma_binary(), diskio::load_auto_detect(), and diskio::load_ppm_binary().

01347   {
01348   arma_extra_debug_sigprint();
01349   
01350   init(0,0,0);
01351   }

template<typename eT >
void Cube< eT >::save ( const std::string  name,
const file_type  type = arma_binary 
) const [inline, inherited]

save the cube to a file

Definition at line 1359 of file Cube_meat.hpp.

References arma_ascii, arma_binary, arma_stop(), ppm_binary, raw_ascii, diskio::save_arma_ascii(), diskio::save_arma_binary(), diskio::save_ppm_binary(), and diskio::save_raw_ascii().

01360   {
01361   arma_extra_debug_sigprint();
01362   
01363   switch(type)
01364     {
01365     case raw_ascii:
01366       diskio::save_raw_ascii(*this, name);
01367       break;
01368     
01369     case arma_ascii:
01370       diskio::save_arma_ascii(*this, name);
01371       break;
01372     
01373     case arma_binary:
01374       diskio::save_arma_binary(*this, name);
01375       break;
01376       
01377     case ppm_binary:
01378       diskio::save_ppm_binary(*this, name);
01379       break;
01380 
01381     default:
01382       arma_stop("Cube::save(): unsupported file type");
01383     }
01384   
01385   }

template<typename eT >
void Cube< eT >::load ( const std::string  name,
const file_type  type = auto_detect 
) [inline, inherited]

load a cube from a file

Definition at line 1393 of file Cube_meat.hpp.

References arma_ascii, arma_binary, arma_stop(), auto_detect, diskio::load_arma_ascii(), diskio::load_arma_binary(), diskio::load_auto_detect(), diskio::load_ppm_binary(), diskio::load_raw_ascii(), ppm_binary, and raw_ascii.

01394   {
01395   arma_extra_debug_sigprint();
01396   
01397   switch(type)
01398     {
01399     case auto_detect:
01400       diskio::load_auto_detect(*this, name);
01401       break;
01402     
01403     case raw_ascii:
01404       diskio::load_raw_ascii(*this, name);
01405       break;
01406     
01407     case arma_ascii:
01408       diskio::load_arma_ascii(*this, name);
01409       break;
01410     
01411     case arma_binary:
01412       diskio::load_arma_binary(*this, name);
01413       break;
01414       
01415     case ppm_binary:
01416       diskio::load_ppm_binary(*this, name);
01417       break;
01418 
01419     default:
01420       arma_stop("Cube::load(): unsupported file type");
01421     }
01422   
01423   }

template<typename eT >
arma_inline void Cube_aux::prefix_pp ( Cube< eT > &  x  )  [inline, static, inherited]

prefix ++

Definition at line 1431 of file Cube_meat.hpp.

References Cube< eT >::memptr(), and Cube< eT >::n_elem.

Referenced by Cube< eT >::operator++().

01432   {
01433         eT* memptr = x.memptr();
01434   const u32 n_elem = x.n_elem;
01435 
01436   for(u32 i=0; i<n_elem; ++i)
01437     {
01438     ++(memptr[i]);
01439     }
01440   }

template<typename T >
arma_inline void Cube_aux::prefix_pp ( Cube< std::complex< T > > &  x  )  [inline, static, inherited]

prefix ++ for complex numbers (work around for limitations of the std::complex class)

Definition at line 1448 of file Cube_meat.hpp.

01449   {
01450   x += T(1);
01451   }

template<typename eT >
arma_inline void Cube_aux::postfix_pp ( Cube< eT > &  x  )  [inline, static, inherited]

postfix ++

Definition at line 1459 of file Cube_meat.hpp.

References Cube< eT >::memptr(), and Cube< eT >::n_elem.

Referenced by Cube< eT >::operator++().

01460   {
01461         eT* memptr = x.memptr();
01462   const u32 n_elem = x.n_elem;
01463 
01464   for(u32 i=0; i<n_elem; ++i)
01465     {
01466     (memptr[i])++;
01467     }
01468   }

template<typename T >
arma_inline void Cube_aux::postfix_pp ( Cube< std::complex< T > > &  x  )  [inline, static, inherited]

postfix ++ for complex numbers (work around for limitations of the std::complex class)

Definition at line 1476 of file Cube_meat.hpp.

01477   {
01478   x += T(1);
01479   }

template<typename eT >
arma_inline void Cube_aux::prefix_mm ( Cube< eT > &  x  )  [inline, static, inherited]

prefix --

Definition at line 1487 of file Cube_meat.hpp.

References Cube< eT >::memptr(), and Cube< eT >::n_elem.

Referenced by Cube< eT >::operator--().

01488   {
01489         eT* memptr = x.memptr();
01490   const u32 n_elem = x.n_elem;
01491 
01492   for(u32 i=0; i<n_elem; ++i)
01493     {
01494     --(memptr[i]);
01495     }
01496   }

template<typename T >
arma_inline void Cube_aux::prefix_mm ( Cube< std::complex< T > > &  x  )  [inline, static, inherited]

prefix -- for complex numbers (work around for limitations of the std::complex class)

Definition at line 1504 of file Cube_meat.hpp.

01505   {
01506   x -= T(1);
01507   }

template<typename eT >
arma_inline void Cube_aux::postfix_mm ( Cube< eT > &  x  )  [inline, static, inherited]

postfix --

Definition at line 1515 of file Cube_meat.hpp.

References Cube< eT >::memptr(), and Cube< eT >::n_elem.

Referenced by Cube< eT >::operator--().

01516   {
01517         eT* memptr = x.memptr();
01518   const u32 n_elem = x.n_elem;
01519 
01520   for(u32 i=0; i<n_elem; ++i)
01521     {
01522     (memptr[i])--;
01523     }
01524   }

template<typename T >
arma_inline void Cube_aux::postfix_mm ( Cube< std::complex< T > > &  x  )  [inline, static, inherited]

postfix ++ for complex numbers (work around for limitations of the std::complex class)

Definition at line 1532 of file Cube_meat.hpp.

01533   {
01534   x -= T(1);
01535   }