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< 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
 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_type >
 Cube::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 CubeCube::operator= (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 CubeCube::operator+= (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 CubeCube::operator-= (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 CubeCube::operator%= (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 CubeCube::operator/= (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::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 CubeCube::operator= (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 CubeCube::operator+= (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 CubeCube::operator-= (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 CubeCube::operator%= (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 CubeCube::operator/= (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::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 CubeCube::operator= (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 CubeCube::operator+= (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 CubeCube::operator-= (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 CubeCube::operator%= (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 CubeCube::operator/= (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::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 CubeCube::operator= (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 CubeCube::operator+= (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 CubeCube::operator-= (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 CubeCube::operator%= (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 CubeCube::operator/= (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 & 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::save (std::ostream &os, const file_type type=arma_binary) const
 save the cube to a stream
void Cube::load (const std::string name, const file_type type=auto_detect)
 load a cube from a file
void Cube::load (std::istream &is, const file_type type=auto_detect)
 load a cube from a stream
iterator Cube::begin ()
const_iterator Cube::begin () const
iterator Cube::end ()
const_iterator Cube::end () const
slice_iterator Cube::begin_slice (const u32 slice_num)
const_slice_iterator Cube::begin_slice (const u32 slice_num) const
slice_iterator Cube::end_slice (const u32 slice_num)
const_slice_iterator Cube::end_slice (const u32 slice_num) const
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 23 of file Cube_meat.hpp.

References arma_config::debug, Cube< eT >::delete_mat(), Cube< eT >::mat_ptrs, 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.

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

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

Definition at line 56 of file Cube_meat.hpp.

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

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 74 of file Cube_meat.hpp.

References Cube< eT >::init().

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

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

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

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

Definition at line 166 of file Cube_meat.hpp.

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

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

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

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

Definition at line 186 of file Cube_meat.hpp.

References arma_check(), Cube< eT >::mat_ptrs, 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 >::Cube(), and Cube< eT >::init().

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

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 213 of file Cube_meat.hpp.

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

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

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

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 228 of file Cube_meat.hpp.

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

00229   {
00230   arma_extra_debug_sigprint();
00231   
00232         eT* local_ptr    = memptr();
00233   const u32 local_n_elem = n_elem;
00234     
00235   u32 i,j;
00236   
00237   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00238     {
00239     local_ptr[i] += val;
00240     local_ptr[j] += val;
00241     }
00242   
00243   if(i < local_n_elem)
00244     {
00245     local_ptr[i] += val;
00246     }
00247   
00248   return *this;
00249   }

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 257 of file Cube_meat.hpp.

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

00258   {
00259   arma_extra_debug_sigprint();
00260   
00261         eT* local_ptr    = memptr();
00262   const u32 local_n_elem = n_elem;
00263     
00264   u32 i,j;
00265   
00266   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00267     {
00268     local_ptr[i] -= val;
00269     local_ptr[j] -= val;
00270     }
00271   
00272   if(i < local_n_elem)
00273     {
00274     local_ptr[i] -= val;
00275     }
00276   
00277   return *this;
00278   }

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 286 of file Cube_meat.hpp.

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

00287   {
00288   arma_extra_debug_sigprint();
00289   
00290         eT* local_ptr    = memptr();
00291   const u32 local_n_elem = n_elem;
00292     
00293   u32 i,j;
00294   
00295   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00296     {
00297     local_ptr[i] *= val;
00298     local_ptr[j] *= val;
00299     }
00300   
00301   if(i < local_n_elem)
00302     {
00303     local_ptr[i] *= val;
00304     }
00305   
00306   return *this;
00307   }

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 315 of file Cube_meat.hpp.

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

00316   {
00317   arma_extra_debug_sigprint();
00318   
00319         eT* local_ptr    = memptr();
00320   const u32 local_n_elem = n_elem;
00321     
00322   u32 i,j;
00323   
00324   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00325     {
00326     local_ptr[i] /= val;
00327     local_ptr[j] /= val;
00328     }
00329   
00330   if(i < local_n_elem)
00331     {
00332     local_ptr[i] /= val;
00333     }
00334   
00335   return *this;
00336   }

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

construct a cube from a given cube

Definition at line 343 of file Cube_meat.hpp.

References Cube< eT >::init().

00344   : n_rows(0)
00345   , n_cols(0)
00346   , n_elem_slice(0)
00347   , n_slices(0)
00348   , n_elem(0)
00349   , use_aux_mem(false)
00350   , mat_ptrs(mat_ptrs)
00351   , mem(mem)
00352   {
00353   arma_extra_debug_sigprint(arma_boost::format("this = %x   in_cube = %x") % this % &in_cube);
00354   
00355   init(in_cube);
00356   }

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 364 of file Cube_meat.hpp.

References Cube< eT >::init().

00365   {
00366   arma_extra_debug_sigprint();
00367   
00368   init(x);
00369   return *this;
00370   }

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

construct a cube from a given cube

Definition at line 378 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.

00379   {
00380   arma_extra_debug_sigprint();
00381   
00382   if(this != &x)
00383     {
00384     init(x.n_rows, x.n_cols, x.n_slices);
00385     syslib::copy_elem( memptr(), x.mem, n_elem );
00386     }
00387   }

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 399 of file Cube_meat.hpp.

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

00400   : n_rows      (copy_aux_mem ? 0     : aux_n_rows                        )
00401   , n_cols      (copy_aux_mem ? 0     : aux_n_cols                        )
00402   , n_elem_slice(copy_aux_mem ? 0     : aux_n_rows*aux_n_cols             )
00403   , n_slices    (copy_aux_mem ? 0     : aux_n_slices                      )
00404   , n_elem      (copy_aux_mem ? 0     : aux_n_rows*aux_n_cols*aux_n_slices)
00405   , use_aux_mem (copy_aux_mem ? false : true                              )
00406   , mat_ptrs    (mat_ptrs                                                 )
00407   , mem         (copy_aux_mem ? mem   : aux_mem                           )
00408   {
00409   arma_extra_debug_sigprint_this(this);
00410   
00411   if(copy_aux_mem == true)
00412     {
00413     init(aux_n_rows, aux_n_cols, aux_n_slices);
00414     syslib::copy_elem( memptr(), aux_mem, n_elem );
00415     }
00416   else
00417     {
00418     create_mat();
00419     }
00420   }

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 428 of file Cube_meat.hpp.

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

00429   : n_rows(0)
00430   , n_cols(0)
00431   , n_elem_slice(0)
00432   , n_slices(0)
00433   , n_elem(0)
00434   , use_aux_mem(false)
00435   , mat_ptrs(mat_ptrs)
00436   , mem(mem)
00437   {
00438   arma_extra_debug_sigprint_this(this);
00439   
00440   init(aux_n_rows, aux_n_cols, aux_n_slices);
00441   syslib::copy_elem( memptr(), aux_mem, n_elem );
00442   }

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

in-place cube addition

Definition at line 450 of file Cube_meat.hpp.

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

00451   {
00452   arma_extra_debug_sigprint();
00453   
00454   arma_debug_assert_same_size(*this, m, "cube addition");
00455   
00456   const u32 local_n_elem = m.n_elem;
00457   
00458         eT* out_mem = (*this).memptr();
00459   const eT* m_mem   = m.memptr();
00460   
00461   u32 i,j;
00462   
00463   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00464     {
00465     out_mem[i] += m_mem[i];
00466     out_mem[j] += m_mem[j];
00467     }
00468   
00469   if(i < local_n_elem)
00470     {
00471     out_mem[i] += m_mem[i];
00472     }
00473   
00474   return *this;
00475   }

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

in-place cube subtraction

Definition at line 483 of file Cube_meat.hpp.

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

00484   {
00485   arma_extra_debug_sigprint();
00486   
00487   arma_debug_assert_same_size(*this, m, "cube subtraction");
00488   
00489   const u32 local_n_elem = m.n_elem;
00490   
00491         eT* out_mem = (*this).memptr();
00492   const eT* m_mem   = m.memptr();
00493   
00494   u32 i,j;
00495   
00496   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00497     {
00498     out_mem[i] -= m_mem[i];
00499     out_mem[j] -= m_mem[j];
00500     }
00501   
00502   if(i < local_n_elem)
00503     {
00504     out_mem[i] -= m_mem[i];
00505     }
00506   
00507   return *this;
00508   }

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

in-place element-wise cube multiplication

Definition at line 516 of file Cube_meat.hpp.

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

00517   {
00518   arma_extra_debug_sigprint();
00519   
00520   arma_debug_assert_same_size(*this, m, "element-wise cube multiplication");
00521   
00522   const u32 local_n_elem = m.n_elem;
00523   
00524         eT* out_mem = (*this).memptr();
00525   const eT* m_mem   = m.memptr();
00526   
00527   u32 i,j;
00528   
00529   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00530     {
00531     out_mem[i] *= m_mem[i];
00532     out_mem[j] *= m_mem[j];
00533     }
00534   
00535   if(i < local_n_elem)
00536     {
00537     out_mem[i] *= m_mem[i];
00538     }
00539   
00540   return *this;
00541   }

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

in-place element-wise cube division

Definition at line 549 of file Cube_meat.hpp.

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

00550   {
00551   arma_extra_debug_sigprint();
00552   
00553   arma_debug_assert_same_size(*this, m, "element-wise cube division");
00554   
00555   const u32 local_n_elem = m.n_elem;
00556   
00557         eT* out_mem = (*this).memptr();
00558   const eT* m_mem   = m.memptr();
00559   
00560   u32 i,j;
00561   
00562   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00563     {
00564     out_mem[i] /= m_mem[i];
00565     out_mem[j] /= m_mem[j];
00566     }
00567   
00568   if(i < local_n_elem)
00569     {
00570     out_mem[i] /= m_mem[i];
00571     }
00572   
00573   return *this;
00574   }

template<typename eT>
template<typename T1 , typename T2 >
Cube< eT >::Cube ( const BaseCube< typename Cube< eT >::pod_type, T1 > &  A,
const BaseCube< typename Cube< eT >::pod_type, T2 > &  B 
) [inline, 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 583 of file Cube_meat.hpp.

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

00587   : n_rows(0)
00588   , n_cols(0)
00589   , n_elem_slice(0)
00590   , n_slices(0)
00591   , n_elem(0)
00592   , use_aux_mem(false)
00593   , mat_ptrs(mat_ptrs)
00594   , mem(mem)
00595   {
00596   arma_extra_debug_sigprint_this(this);
00597   
00598   arma_type_check< is_complex<eT>::value == false >::apply();   //!< compile-time abort if eT isn't std::complex
00599   
00600   typedef typename T1::elem_type T;
00601   arma_type_check< is_complex<T>::value == true >::apply();   //!< compile-time abort if T is std::complex
00602   
00603   isnt_same_type<std::complex<T>, eT>::check();   //!< compile-time abort if types are not compatible
00604   
00605   const unwrap_cube<T1> tmp_A(A.get_ref());
00606   const unwrap_cube<T2> tmp_B(B.get_ref());
00607   
00608   const Cube<T>& X = tmp_A.M;
00609   const Cube<T>& Y = tmp_B.M;
00610   
00611   arma_assert_same_size(X, Y, "Cube()");
00612   
00613   init(X.n_rows, X.n_cols, X.n_slices);
00614   
00615   const T* X_mem = X.mem;
00616   const T* Y_mem = Y.mem;
00617   
00618   for(u32 i=0; i<n_elem; ++i)
00619     {
00620     access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]);
00621     }
00622   }

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 629 of file Cube_meat.hpp.

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

00630   : n_rows(0)
00631   , n_cols(0)
00632   , n_elem_slice(0)
00633   , n_slices(0)
00634   , n_elem(0)
00635   , use_aux_mem(false)
00636   , mat_ptrs(mat_ptrs)
00637   , mem(mem)
00638   {
00639   arma_extra_debug_sigprint_this(this);
00640   
00641   this->operator=(X);
00642   }

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 650 of file Cube_meat.hpp.

00651   {
00652   arma_extra_debug_sigprint();
00653   
00654   subview_cube<eT>::extract(*this, X);
00655   return *this;
00656   }

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 664 of file Cube_meat.hpp.

00665   {
00666   arma_extra_debug_sigprint();
00667   
00668   subview_cube<eT>::plus_inplace(*this, X);
00669   return *this;
00670   }

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 678 of file Cube_meat.hpp.

00679   {
00680   arma_extra_debug_sigprint();
00681   
00682   subview_cube<eT>::minus_inplace(*this, X);
00683   return *this;
00684   }

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 692 of file Cube_meat.hpp.

00693   {
00694   arma_extra_debug_sigprint();
00695   
00696   subview_cube<eT>::schur_inplace(*this, X);
00697   return *this;
00698   }

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 706 of file Cube_meat.hpp.

00707   {
00708   arma_extra_debug_sigprint();
00709   
00710   subview_cube<eT>::div_inplace(*this, X);
00711   return *this;
00712   }

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 720 of file Cube_meat.hpp.

References Cube< eT >::mat_ptrs, and Cube< eT >::n_slices.

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

00721   {
00722   arma_extra_debug_sigprint();
00723   
00724   arma_debug_check
00725     (
00726     (in_slice >= n_slices),
00727     "Cube::slice(): index out of bounds"
00728     );
00729   
00730   return const_cast< Mat<eT>& >( *(mat_ptrs[in_slice]) );
00731   }

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 739 of file Cube_meat.hpp.

References Cube< eT >::mat_ptrs, and Cube< eT >::n_slices.

00740   {
00741   arma_extra_debug_sigprint();
00742   
00743   arma_debug_check
00744     (
00745     (in_slice >= n_slices),
00746     "Cube::slice(): index out of bounds"
00747     );
00748    
00749   return *(mat_ptrs[in_slice]);
00750   }

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 758 of file Cube_meat.hpp.

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

00759   {
00760   arma_extra_debug_sigprint();
00761   
00762   arma_debug_check
00763     (
00764     (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
00765     "Cube::slices(): indices out of bounds or incorrectly used"
00766     );
00767   
00768   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);
00769   }

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 777 of file Cube_meat.hpp.

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

00778   {
00779   arma_extra_debug_sigprint();
00780   
00781   arma_debug_check
00782     (
00783     (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
00784     "Cube::rows(): indices out of bounds or incorrectly used"
00785     );
00786   
00787   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);
00788   }

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 796 of file Cube_meat.hpp.

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

00797   {
00798   arma_extra_debug_sigprint();
00799   
00800   arma_debug_check
00801     (
00802     (in_row1 >  in_row2) || (in_col1 >  in_col2) || (in_slice1 >  in_slice2) ||
00803     (in_row2 >= n_rows)  || (in_col2 >= n_cols)  || (in_slice2 >= n_slices),
00804     "Cube::subcube(): indices out of bounds or incorrectly used"
00805     );
00806   
00807   return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_col2, in_slice2);
00808   }

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 816 of file Cube_meat.hpp.

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

00817   {
00818   arma_extra_debug_sigprint();
00819   
00820   arma_debug_check
00821     (
00822     (in_row1 >  in_row2) || (in_col1 >  in_col2) || (in_slice1 >  in_slice2) ||
00823     (in_row2 >= n_rows)  || (in_col2 >= n_cols)  || (in_slice2 >= n_slices),
00824     "Cube::subcube(): indices out of bounds or incorrectly used"
00825     );
00826     
00827   return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_col2, in_slice2);
00828   }

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

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

Definition at line 836 of file Cube_meat.hpp.

00837   : n_rows(0)
00838   , n_cols(0)
00839   , n_elem_slice(0)
00840   , n_slices(0)
00841   , n_elem(0)
00842   , use_aux_mem(false)
00843   , mat_ptrs(mat_ptrs)
00844   , mem(mem)
00845   {
00846   arma_extra_debug_sigprint_this(this);
00847 
00848   isnt_same_type<eT, typename T1::elem_type>::check();
00849   
00850   op_type::apply(*this, X);
00851   }

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

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

Definition at line 860 of file Cube_meat.hpp.

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

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

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

Definition at line 878 of file Cube_meat.hpp.

00879   {
00880   arma_extra_debug_sigprint();
00881   
00882   isnt_same_type<eT, typename T1::elem_type>::check();
00883   
00884   const Cube<eT> m(X);
00885   
00886   return (*this).operator+=(m);
00887   }

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

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

Definition at line 896 of file Cube_meat.hpp.

00897   {
00898   arma_extra_debug_sigprint();
00899   
00900   isnt_same_type<eT, typename T1::elem_type>::check();
00901   
00902   const Cube<eT> m(X);
00903   
00904   return (*this).operator-=(m);
00905   }

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

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

Definition at line 914 of file Cube_meat.hpp.

00915   {
00916   arma_extra_debug_sigprint();
00917   
00918   isnt_same_type<eT, typename T1::elem_type>::check();
00919   
00920   const Cube<eT> m(X);
00921   
00922   return (*this).operator%=(m);
00923   }

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

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

Definition at line 932 of file Cube_meat.hpp.

00933   {
00934   arma_extra_debug_sigprint();
00935   
00936   isnt_same_type<eT, typename T1::elem_type>::check();
00937   
00938   const Cube<eT> m(X);
00939   
00940   return (*this).operator/=(m);
00941   }

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

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

Definition at line 949 of file Cube_meat.hpp.

00950   : n_rows(0)
00951   , n_cols(0)
00952   , n_elem_slice(0)
00953   , n_slices(0)
00954   , n_elem(0)
00955   , use_aux_mem(false)
00956   , mat_ptrs(mat_ptrs)
00957   , mem(mem)
00958   {
00959   arma_extra_debug_sigprint_this(this);
00960 
00961   isnt_same_type<eT, typename T1::elem_type>::check();
00962   
00963   eop_type::apply(*this, X);
00964   }

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

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

Definition at line 973 of file Cube_meat.hpp.

00974   {
00975   arma_extra_debug_sigprint();
00976 
00977   isnt_same_type<eT, typename T1::elem_type>::check();
00978   
00979   eop_type::apply(*this, X);
00980   
00981   return *this;
00982   }

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

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

Definition at line 991 of file Cube_meat.hpp.

00992   {
00993   arma_extra_debug_sigprint();
00994   
00995   isnt_same_type<eT, typename T1::elem_type>::check();
00996   
00997   eop_type::apply_inplace_plus(*this, X);
00998   
00999   return *this;
01000   }

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

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

Definition at line 1009 of file Cube_meat.hpp.

01010   {
01011   arma_extra_debug_sigprint();
01012   
01013   isnt_same_type<eT, typename T1::elem_type>::check();
01014   
01015   eop_type::apply_inplace_minus(*this, X);
01016   
01017   return *this;
01018   }

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

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

Definition at line 1027 of file Cube_meat.hpp.

01028   {
01029   arma_extra_debug_sigprint();
01030   
01031   isnt_same_type<eT, typename T1::elem_type>::check();
01032 
01033   eop_type::apply_inplace_schur(*this, X);
01034   
01035   return *this;
01036   }

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

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

Definition at line 1045 of file Cube_meat.hpp.

01046   {
01047   arma_extra_debug_sigprint();
01048   
01049   isnt_same_type<eT, typename T1::elem_type>::check();
01050 
01051   eop_type::apply_inplace_div(*this, X);
01052   
01053   return *this;
01054   }

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

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

Definition at line 1062 of file Cube_meat.hpp.

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

01063   : n_rows(0)
01064   , n_cols(0)
01065   , n_elem_slice(0)
01066   , n_slices(0)
01067   , n_elem(0)
01068   , use_aux_mem(false)
01069   , mat_ptrs(mat_ptrs)
01070   , mem(mem)
01071   {
01072   arma_extra_debug_sigprint_this(this);
01073   this->operator=(X);
01074   }

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

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

Definition at line 1083 of file Cube_meat.hpp.

01084   {
01085   arma_extra_debug_sigprint();
01086   
01087   isnt_same_type<eT, typename T1::elem_type>::check();
01088   isnt_same_type<eT, typename T2::elem_type>::check();
01089   
01090   glue_type::apply(*this, X);
01091   
01092   return *this;
01093   }

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

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

Definition at line 1101 of file Cube_meat.hpp.

01102   {
01103   arma_extra_debug_sigprint();
01104   
01105   isnt_same_type<eT, typename T1::elem_type>::check();
01106   isnt_same_type<eT, typename T2::elem_type>::check();
01107   
01108   const Cube<eT> m(X);
01109   
01110   return (*this).operator+=(m);
01111   }

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

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

Definition at line 1120 of file Cube_meat.hpp.

01121   {
01122   arma_extra_debug_sigprint();
01123   
01124   isnt_same_type<eT, typename T1::elem_type>::check();
01125   isnt_same_type<eT, typename T2::elem_type>::check();
01126   
01127   const Cube<eT> m(X);
01128   
01129   return (*this).operator-=(m);
01130   }

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

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

Definition at line 1139 of file Cube_meat.hpp.

01140   {
01141   arma_extra_debug_sigprint();
01142   
01143   isnt_same_type<eT, typename T1::elem_type>::check();
01144   isnt_same_type<eT, typename T2::elem_type>::check();
01145   
01146   const Cube<eT> m(X);
01147   
01148   return (*this).operator%=(m);
01149   }

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

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

Definition at line 1158 of file Cube_meat.hpp.

01159   {
01160   arma_extra_debug_sigprint();
01161   
01162   isnt_same_type<eT, typename T1::elem_type>::check();
01163   isnt_same_type<eT, typename T2::elem_type>::check();
01164   
01165   const Cube<eT> m(X);
01166   
01167   return (*this).operator/=(m);
01168   }

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

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

Definition at line 1176 of file Cube_meat.hpp.

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

01177   : n_rows(0)
01178   , n_cols(0)
01179   , n_elem_slice(0)
01180   , n_slices(0)
01181   , n_elem(0)
01182   , use_aux_mem(false)
01183   , mat_ptrs(mat_ptrs)
01184   , mem(mem)
01185   {
01186   arma_extra_debug_sigprint_this(this);
01187   this->operator=(X);
01188   }

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

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

Definition at line 1197 of file Cube_meat.hpp.

01198   {
01199   arma_extra_debug_sigprint();
01200   
01201   isnt_same_type<eT, typename T1::elem_type>::check();
01202   isnt_same_type<eT, typename T2::elem_type>::check();
01203   
01204   eglue_type::apply(*this, X);
01205   
01206   return *this;
01207   }

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

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

Definition at line 1215 of file Cube_meat.hpp.

01216   {
01217   arma_extra_debug_sigprint();
01218   
01219   isnt_same_type<eT, typename T1::elem_type>::check();
01220   isnt_same_type<eT, typename T2::elem_type>::check();
01221   
01222   eglue_type::apply_inplace_plus(*this, X);
01223   
01224   return *this;
01225   }

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

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

Definition at line 1234 of file Cube_meat.hpp.

01235   {
01236   arma_extra_debug_sigprint();
01237   
01238   isnt_same_type<eT, typename T1::elem_type>::check();
01239   isnt_same_type<eT, typename T2::elem_type>::check();
01240   
01241   eglue_type::apply_inplace_minus(*this, X);
01242   
01243   return *this;
01244   }

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

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

Definition at line 1253 of file Cube_meat.hpp.

01254   {
01255   arma_extra_debug_sigprint();
01256   
01257   isnt_same_type<eT, typename T1::elem_type>::check();
01258   isnt_same_type<eT, typename T2::elem_type>::check();
01259   
01260   eglue_type::apply_inplace_schur(*this, X);
01261   
01262   return *this;
01263   }

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

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

Definition at line 1272 of file Cube_meat.hpp.

01273   {
01274   arma_extra_debug_sigprint();
01275   
01276   isnt_same_type<eT, typename T1::elem_type>::check();
01277   isnt_same_type<eT, typename T2::elem_type>::check();
01278   
01279   eglue_type::apply_inplace_div(*this, X);
01280   
01281   return *this;
01282   }

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 1290 of file Cube_meat.hpp.

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

01291   {
01292   arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds");
01293   return access::rw(mem[i]);
01294   }

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 1302 of file Cube_meat.hpp.

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

01303   {
01304   arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds");
01305   return mem[i];
01306   }

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 1313 of file Cube_meat.hpp.

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

01314   {
01315   return access::rw(mem[i]);
01316   }

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 1324 of file Cube_meat.hpp.

References Cube< eT >::mem.

01325   {
01326   return mem[i];
01327   }

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

01336   {
01337   arma_debug_check
01338     (
01339     (in_row >= n_rows) ||
01340     (in_col >= n_cols) ||
01341     (in_slice >= n_slices)
01342     ,
01343     "Cube::operator(): index out of bounds"
01344     );
01345 
01346   return access::rw(mem[in_slice*n_elem_slice + in_col*n_rows + in_row]);
01347   }

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

01356   {
01357   arma_debug_check
01358     (
01359     (in_row >= n_rows) ||
01360     (in_col >= n_cols) ||
01361     (in_slice >= n_slices)
01362     ,
01363     "Cube::operator(): index out of bounds"
01364     );
01365 
01366   return mem[in_slice*n_elem_slice + in_col*n_rows + in_row];
01367   }

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

element accessor; no bounds check

Definition at line 1375 of file Cube_meat.hpp.

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

Referenced by op_reshape::apply(), diskio::load_arma_ascii(), diskio::load_ppm_binary(), diskio::save_arma_ascii(), diskio::save_ppm_binary(), and diskio::save_raw_ascii().

01376   {
01377   return access::rw( mem[in_slice*n_elem_slice + in_col*n_rows + in_row] );
01378   }

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 1386 of file Cube_meat.hpp.

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

01387   {
01388   return mem[in_slice*n_elem_slice + in_col*n_rows + in_row];
01389   }

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

prefix ++

Definition at line 1397 of file Cube_meat.hpp.

References Cube_aux::prefix_pp().

01398   {
01399   Cube_aux::prefix_pp(*this);
01400   return *this;
01401   }

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

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

Definition at line 1409 of file Cube_meat.hpp.

References Cube_aux::postfix_pp().

01410   {
01411   Cube_aux::postfix_pp(*this);
01412   }

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

prefix --

Definition at line 1420 of file Cube_meat.hpp.

References Cube_aux::prefix_mm().

01421   {
01422   Cube_aux::prefix_mm(*this);
01423   return *this;
01424   }

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

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

Definition at line 1432 of file Cube_meat.hpp.

References Cube_aux::postfix_mm().

01433   {
01434   Cube_aux::postfix_mm(*this);
01435   }

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 1443 of file Cube_meat.hpp.

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

01444   {
01445   for(u32 i=0; i<n_elem; ++i)
01446     {
01447     if(arma_isfinite(mem[i]) == false)
01448       {
01449       return false;
01450       }
01451     }
01452 
01453   return true;
01454   }

template<typename eT >
arma_inline eT * Cube< eT >::memptr (  )  [inline, inherited]
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 1473 of file Cube_meat.hpp.

References Cube< eT >::mem.

01474   {
01475   return mem;
01476   }

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 1484 of file Cube_meat.hpp.

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

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

01485   {
01486   return const_cast<eT*>( &mem[ slice*n_elem_slice ] );
01487   }

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 1495 of file Cube_meat.hpp.

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

01496   {
01497   return &mem[ slice*n_elem_slice ];
01498   }

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

01507   {
01508   return const_cast<eT*>( &mem[ slice*n_elem_slice + col*n_rows] );
01509   }

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 1517 of file Cube_meat.hpp.

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

01518   {
01519   return &mem[ slice*n_elem_slice + col*n_rows ];
01520   }

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 1531 of file Cube_meat.hpp.

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

01532   {
01533   arma_extra_debug_sigprint();
01534   
01535   if(extra_text.length() != 0)
01536     {
01537     cout << extra_text << '\n';
01538     }
01539   
01540   arma_ostream::print(cout, *this, true);
01541   }

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 1551 of file Cube_meat.hpp.

References Cube< eT >::print().

01552   {
01553   arma_extra_debug_sigprint();
01554   
01555   if(extra_text.length() != 0)
01556     {
01557     user_stream << extra_text << '\n';
01558     }
01559   
01560   arma_ostream::print(user_stream, *this, true);
01561   }

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 1572 of file Cube_meat.hpp.

References Cube< eT >::print().

01573   {
01574   arma_extra_debug_sigprint();
01575   
01576   if(extra_text.length() != 0)
01577     {
01578     cout << extra_text << '\n';
01579     }
01580   
01581   arma_ostream::print(cout, *this, false);
01582   }

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 1593 of file Cube_meat.hpp.

References Cube< eT >::print().

01594   {
01595   arma_extra_debug_sigprint();
01596   
01597   if(extra_text.length() != 0)
01598     {
01599     user_stream << extra_text << '\n';
01600     }
01601   
01602   arma_ostream::print(user_stream, *this, false);
01603   }

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 1611 of file Cube_meat.hpp.

References Cube< eT >::init().

Referenced by op_reshape::apply(), eglue_cube_core< eglue_type >::apply(), eop_cube_core< eop_cube_type >::apply_proxy(), eop_cube_core< eop_cube_type >::apply_unwrap(), 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().

01612   {
01613   arma_extra_debug_sigprint();
01614   
01615   init(in_n_rows, in_n_cols, in_n_slices);
01616   }

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

change the cube (without preserving data) to have the same dimensions as the given cube

Definition at line 1625 of file Cube_meat.hpp.

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

01626   {
01627   arma_extra_debug_sigprint();
01628   
01629   init(m.n_rows, m.n_cols, m.n_slices);
01630   }

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

fill the cube with the specified value

Definition at line 1638 of file Cube_meat.hpp.

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

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

01639   {
01640   arma_extra_debug_sigprint();
01641   
01642         eT* local_ptr    = memptr();
01643   const u32 local_n_elem = n_elem;
01644   
01645   u32 i,j;
01646   
01647   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
01648     {
01649     local_ptr[i] = val;
01650     local_ptr[j] = val;
01651     }
01652   
01653   if(i < local_n_elem)
01654     {
01655     local_ptr[i] = val;
01656     }
01657   }

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

Definition at line 1664 of file Cube_meat.hpp.

References Cube< eT >::fill().

01665   {
01666   arma_extra_debug_sigprint();
01667   
01668   fill(eT(0));
01669   }

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

Definition at line 1676 of file Cube_meat.hpp.

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

01677   {
01678   arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d, in_slices = %d") % in_rows % in_cols % in_slices );
01679 
01680   set_size(in_rows, in_cols, in_slices);
01681   fill(eT(0));
01682   }

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

Definition at line 1689 of file Cube_meat.hpp.

References Cube< eT >::fill().

01690   {
01691   arma_extra_debug_sigprint();
01692   
01693   fill(eT(1));
01694   }

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

Definition at line 1701 of file Cube_meat.hpp.

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

01702   {
01703   arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d, in_slices = %d") % in_rows % in_cols % in_slices );
01704 
01705   set_size(in_rows, in_cols, in_slices);
01706   fill(eT(1));
01707   }

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

Definition at line 1714 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().

01715   {
01716   arma_extra_debug_sigprint();
01717   
01718   init(0,0,0);
01719   }

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

01728   {
01729   arma_extra_debug_sigprint();
01730   
01731   switch(type)
01732     {
01733     case raw_ascii:
01734       diskio::save_raw_ascii(*this, name);
01735       break;
01736     
01737     case arma_ascii:
01738       diskio::save_arma_ascii(*this, name);
01739       break;
01740     
01741     case arma_binary:
01742       diskio::save_arma_binary(*this, name);
01743       break;
01744       
01745     case ppm_binary:
01746       diskio::save_ppm_binary(*this, name);
01747       break;
01748 
01749     default:
01750       arma_stop("Cube::save(): unsupported file type");
01751     }
01752   
01753   }

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

save the cube to a stream

Definition at line 1761 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().

01762   {
01763   arma_extra_debug_sigprint();
01764   
01765   switch(type)
01766     {
01767     case raw_ascii:
01768       diskio::save_raw_ascii(*this, "[ostream]", os);
01769       break;
01770     
01771     case arma_ascii:
01772       diskio::save_arma_ascii(*this, "[ostream]", os);
01773       break;
01774     
01775     case arma_binary:
01776       diskio::save_arma_binary(*this, "[ostream]", os);
01777       break;
01778       
01779     case ppm_binary:
01780       diskio::save_ppm_binary(*this, "[ostream]", os);
01781       break;
01782 
01783     default:
01784       arma_stop("Cube::save(): unsupported file type");
01785     }
01786   
01787   }

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

01796   {
01797   arma_extra_debug_sigprint();
01798   
01799   switch(type)
01800     {
01801     case auto_detect:
01802       diskio::load_auto_detect(*this, name);
01803       break;
01804     
01805     case raw_ascii:
01806       diskio::load_raw_ascii(*this, name);
01807       break;
01808     
01809     case arma_ascii:
01810       diskio::load_arma_ascii(*this, name);
01811       break;
01812     
01813     case arma_binary:
01814       diskio::load_arma_binary(*this, name);
01815       break;
01816       
01817     case ppm_binary:
01818       diskio::load_ppm_binary(*this, name);
01819       break;
01820 
01821     default:
01822       arma_stop("Cube::load(): unsupported file type");
01823     }
01824   
01825   }

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

load a cube from a stream

Definition at line 1833 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.

01834   {
01835   arma_extra_debug_sigprint();
01836   
01837   switch(type)
01838     {
01839     case auto_detect:
01840       diskio::load_auto_detect(*this, "[istream]", is);
01841       break;
01842     
01843     case raw_ascii:
01844       diskio::load_raw_ascii(*this, "[istream]", is);
01845       break;
01846     
01847     case arma_ascii:
01848       diskio::load_arma_ascii(*this, "[istream]", is);
01849       break;
01850     
01851     case arma_binary:
01852       diskio::load_arma_binary(*this, "[istream]", is);
01853       break;
01854       
01855     case ppm_binary:
01856       diskio::load_ppm_binary(*this, "[istream]", is);
01857       break;
01858     
01859     default:
01860       arma_stop("Cube::load(): unsupported file type");
01861     }
01862   
01863   }

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

Definition at line 1870 of file Cube_meat.hpp.

References Cube< eT >::memptr().

01871   {
01872   arma_extra_debug_sigprint();
01873   
01874   return memptr();
01875   }

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

Definition at line 1882 of file Cube_meat.hpp.

References Cube< eT >::memptr().

01883   {
01884   arma_extra_debug_sigprint();
01885   
01886   return memptr();
01887   }

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

Definition at line 1894 of file Cube_meat.hpp.

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

01895   {
01896   arma_extra_debug_sigprint();
01897   
01898   return memptr() + n_elem;
01899   }

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

Definition at line 1906 of file Cube_meat.hpp.

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

01907   {
01908   arma_extra_debug_sigprint();
01909   
01910   return memptr() + n_elem;
01911   }

template<typename eT >
Cube< eT >::slice_iterator Cube< eT >::begin_slice ( const u32  slice_num  )  [inline, inherited]

Definition at line 1918 of file Cube_meat.hpp.

References Cube< eT >::n_slices, and Cube< eT >::slice_memptr().

01919   {
01920   arma_extra_debug_sigprint();
01921   
01922   arma_debug_check( (slice_num >= n_slices), "begin_slice(): index out of bounds");
01923   
01924   return slice_memptr(slice_num);
01925   }

template<typename eT >
Cube< eT >::const_slice_iterator Cube< eT >::begin_slice ( const u32  slice_num  )  const [inline, inherited]

Definition at line 1932 of file Cube_meat.hpp.

References Cube< eT >::n_slices, and Cube< eT >::slice_memptr().

01933   {
01934   arma_extra_debug_sigprint();
01935   
01936   arma_debug_check( (slice_num >= n_slices), "begin_slice(): index out of bounds");
01937   
01938   return slice_memptr(slice_num);
01939   }

template<typename eT >
Cube< eT >::slice_iterator Cube< eT >::end_slice ( const u32  slice_num  )  [inline, inherited]

Definition at line 1946 of file Cube_meat.hpp.

References Cube< eT >::n_elem_slice, Cube< eT >::n_slices, and Cube< eT >::slice_memptr().

01947   {
01948   arma_extra_debug_sigprint();
01949   
01950   arma_debug_check( (slice_num >= n_slices), "end_slice(): index out of bounds");
01951   
01952   return slice_memptr(slice_num) + n_elem_slice;
01953   }

template<typename eT >
Cube< eT >::const_slice_iterator Cube< eT >::end_slice ( const u32  slice_num  )  const [inline, inherited]

Definition at line 1960 of file Cube_meat.hpp.

References Cube< eT >::n_elem_slice, Cube< eT >::n_slices, and Cube< eT >::slice_memptr().

01961   {
01962   arma_extra_debug_sigprint();
01963   
01964   arma_debug_check( (slice_num >= n_slices), "end_slice(): index out of bounds");
01965   
01966   return slice_memptr(slice_num) + n_elem_slice;
01967   }

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

prefix ++

Definition at line 1975 of file Cube_meat.hpp.

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

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

01976   {
01977         eT* memptr = x.memptr();
01978   const u32 n_elem = x.n_elem;
01979   
01980   u32 i,j;
01981 
01982   for(i=0, j=1; j<n_elem; i+=2, j+=2)
01983     {
01984     ++(memptr[i]);
01985     ++(memptr[j]);
01986     }
01987   
01988   if(i < n_elem)
01989     {
01990     ++(memptr[i]);
01991     }
01992   }

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 2000 of file Cube_meat.hpp.

02001   {
02002   x += T(1);
02003   }

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

postfix ++

Definition at line 2011 of file Cube_meat.hpp.

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

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

02012   {
02013         eT* memptr = x.memptr();
02014   const u32 n_elem = x.n_elem;
02015   
02016   u32 i,j;
02017   
02018   for(i=0, j=1; j<n_elem; i+=2, j+=2)
02019     {
02020     (memptr[i])++;
02021     (memptr[j])++;
02022     }
02023   
02024   if(i < n_elem)
02025     {
02026     (memptr[i])++;
02027     }
02028   }

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 2036 of file Cube_meat.hpp.

02037   {
02038   x += T(1);
02039   }

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

prefix --

Definition at line 2047 of file Cube_meat.hpp.

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

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

02048   {
02049         eT* memptr = x.memptr();
02050   const u32 n_elem = x.n_elem;
02051 
02052   u32 i,j;
02053 
02054   for(i=0, j=1; j<n_elem; i+=2, j+=2)
02055     {
02056     --(memptr[i]);
02057     --(memptr[j]);
02058     }
02059   
02060   if(i < n_elem)
02061     {
02062     --(memptr[i]);
02063     }
02064   }

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 2072 of file Cube_meat.hpp.

02073   {
02074   x -= T(1);
02075   }

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

postfix --

Definition at line 2083 of file Cube_meat.hpp.

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

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

02084   {
02085         eT* memptr = x.memptr();
02086   const u32 n_elem = x.n_elem;
02087 
02088   u32 i,j;
02089 
02090   for(i=0, j=1; j<n_elem; i+=2, j+=2)
02091     {
02092     (memptr[i])--;
02093     (memptr[j])--;
02094     }
02095   
02096   if(i < n_elem)
02097     {
02098     (memptr[i])--;
02099     }
02100   }

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 2108 of file Cube_meat.hpp.

02109   {
02110   x -= T(1);
02111   }