Classes | Functions

Cube

//! More...

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 ()
bool Cube::save (const std::string name, const file_type type=arma_binary, const bool print_status=true) const
 save the cube to a file
bool Cube::save (std::ostream &os, const file_type type=arma_binary, const bool print_status=true) const
 save the cube to a stream
bool Cube::load (const std::string name, const file_type type=auto_detect, const bool print_status=true)
 load a cube from a file
bool Cube::load (std::istream &is, const file_type type=auto_detect, const bool print_status=true)
 load a cube from a stream
bool Cube::quiet_save (const std::string name, const file_type type=arma_binary) const
 save the cube to a file, without printing any error messages
bool Cube::quiet_save (std::ostream &os, const file_type type=arma_binary) const
 save the cube to a stream, without printing any error messages
bool Cube::quiet_load (const std::string name, const file_type type=auto_detect)
 load a cube from a file, without printing any error messages
bool Cube::quiet_load (std::istream &is, const file_type type=auto_detect)
 load a cube from a stream, without printing any error messages
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)

Detailed Description

//!


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.

  {
  arma_extra_debug_sigprint_this(this);
  
  delete_mat();
  
  if(use_aux_mem == false)
    {
    if(n_elem > sizeof(mem_local)/sizeof(eT) )
      {
      delete [] mem;
      }
    }
    
  if(arma_config::debug == true)
    {
    // try to expose buggy user code that accesses deleted objects
    access::rw(n_rows)       = 0;
    access::rw(n_cols)       = 0;
    access::rw(n_elem_slice) = 0;
    access::rw(n_slices)     = 0;
    access::rw(n_elem)       = 0;
    access::rw(mat_ptrs)     = 0;
    access::rw(mem)          = 0;
    }
  
  isnt_supported_elem_type<eT>::check();
  }

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

Definition at line 56 of file Cube_meat.hpp.

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);
  }

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

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);
  
  init(in_n_rows, in_n_cols, in_n_slices);
  }

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

  {
  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 );
  
  const u32 new_n_elem = in_n_rows * in_n_cols * in_n_slices;

  if(n_elem == new_n_elem)
    {
    if( (n_rows != in_n_rows) || (n_cols != in_n_cols) || (n_slices != in_n_slices) )
      {
      delete_mat();

      access::rw(n_rows)       = in_n_rows;
      access::rw(n_cols)       = in_n_cols;
      access::rw(n_elem_slice) = in_n_rows*in_n_cols;
      access::rw(n_slices)     = in_n_slices;
    
      create_mat();
      }
    }
  else
    {
    arma_debug_check
      (
      (use_aux_mem == true),
      "Cube::init(): can't change the amount of memory as auxiliary memory is in use"
      );
      
    delete_mat();

    if(n_elem > sizeof(mem_local)/sizeof(eT) )
      {
      delete [] mem;
      }
    
    if(new_n_elem <= sizeof(mem_local)/sizeof(eT) )
      {
      access::rw(mem) = mem_local;
      }
    else
      {
      access::rw(mem) = new(std::nothrow) eT[new_n_elem];
      arma_check( (mem == 0), "Cube::init(): out of memory" );
      }
    
    access::rw(n_elem) = new_n_elem;

    if(new_n_elem == 0)
      {
      access::rw(n_rows)       = 0;
      access::rw(n_cols)       = 0;
      access::rw(n_elem_slice) = 0;
      access::rw(n_slices)     = 0;
      }
    else
      {
      access::rw(n_rows)       = in_n_rows;
      access::rw(n_cols)       = in_n_cols;
      access::rw(n_elem_slice) = in_n_rows*in_n_cols;
      access::rw(n_slices)     = in_n_slices;
      }
      
    create_mat();
    }
  }

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

  {
  arma_extra_debug_sigprint();
  
  for(u32 slice = 0; slice < n_slices; ++slice)
    {
    delete access::rw(mat_ptrs[slice]);
    }

  if(n_slices > sizeof(mat_ptrs_local)/sizeof(Mat<eT>*) )
    {
    delete [] mat_ptrs;
    }
  }

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

  {
  arma_extra_debug_sigprint();

  if( n_slices <= sizeof(mat_ptrs_local)/sizeof(Mat<eT>*) )
    {
    access::rw(mat_ptrs) = const_cast< const Mat<eT>** >(mat_ptrs_local);
    }
  else
    {
    access::rw(mat_ptrs) = new(std::nothrow) const Mat<eT>*[n_slices];
    arma_check( (mat_ptrs == 0), "Cube::create_mat(): out of memory" );
    }
    
  for(u32 slice = 0; slice < n_slices; ++slice)
    {
    mat_ptrs[slice] = new Mat<eT>('j', slice_memptr(slice), n_rows, n_cols);
    }
  }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator= ( const eT  val  )  [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().

  {
  arma_extra_debug_sigprint();
  
  init(1,1,1);
  access::rw(mem[0]) = val;
  return *this;
  }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator+= ( const eT  val  )  [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.

  {
  arma_extra_debug_sigprint();
  
        eT* local_ptr    = memptr();
  const u32 local_n_elem = n_elem;
    
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    local_ptr[i] += val;
    local_ptr[j] += val;
    }
  
  if(i < local_n_elem)
    {
    local_ptr[i] += val;
    }
  
  return *this;
  }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator-= ( const eT  val  )  [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.

  {
  arma_extra_debug_sigprint();
  
        eT* local_ptr    = memptr();
  const u32 local_n_elem = n_elem;
    
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    local_ptr[i] -= val;
    local_ptr[j] -= val;
    }
  
  if(i < local_n_elem)
    {
    local_ptr[i] -= val;
    }
  
  return *this;
  }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator*= ( const eT  val  )  [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.

  {
  arma_extra_debug_sigprint();
  
        eT* local_ptr    = memptr();
  const u32 local_n_elem = n_elem;
    
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    local_ptr[i] *= val;
    local_ptr[j] *= val;
    }
  
  if(i < local_n_elem)
    {
    local_ptr[i] *= val;
    }
  
  return *this;
  }

template<typename eT>
arma_inline const Cube< eT > & Cube< eT >::operator/= ( const eT  val  )  [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.

  {
  arma_extra_debug_sigprint();
  
        eT* local_ptr    = memptr();
  const u32 local_n_elem = n_elem;
    
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    local_ptr[i] /= val;
    local_ptr[j] /= val;
    }
  
  if(i < local_n_elem)
    {
    local_ptr[i] /= val;
    }
  
  return *this;
  }

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

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint(arma_boost::format("this = %x   in_cube = %x") % this % &in_cube);
  
  init(in_cube);
  }

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

  {
  arma_extra_debug_sigprint();
  
  init(x);
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  if(this != &x)
    {
    init(x.n_rows, x.n_cols, x.n_slices);
    syslib::copy_elem( memptr(), x.mem, n_elem );
    }
  }

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.

  : n_rows      (copy_aux_mem ? 0     : aux_n_rows                        )
  , n_cols      (copy_aux_mem ? 0     : aux_n_cols                        )
  , n_elem_slice(copy_aux_mem ? 0     : aux_n_rows*aux_n_cols             )
  , n_slices    (copy_aux_mem ? 0     : aux_n_slices                      )
  , n_elem      (copy_aux_mem ? 0     : aux_n_rows*aux_n_cols*aux_n_slices)
  , use_aux_mem (copy_aux_mem ? false : true                              )
  , mat_ptrs    (mat_ptrs                                                 )
  , mem         (copy_aux_mem ? mem   : aux_mem                           )
  {
  arma_extra_debug_sigprint_this(this);
  
  if(copy_aux_mem == true)
    {
    init(aux_n_rows, aux_n_cols, aux_n_slices);
    syslib::copy_elem( memptr(), aux_mem, n_elem );
    }
  else
    {
    create_mat();
    }
  }

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.

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);
  
  init(aux_n_rows, aux_n_cols, aux_n_slices);
  syslib::copy_elem( memptr(), aux_mem, n_elem );
  }

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.

  {
  arma_extra_debug_sigprint();
  
  arma_debug_assert_same_size(*this, m, "cube addition");
  
  const u32 local_n_elem = m.n_elem;
  
        eT* out_mem = (*this).memptr();
  const eT* m_mem   = m.memptr();
  
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    out_mem[i] += m_mem[i];
    out_mem[j] += m_mem[j];
    }
  
  if(i < local_n_elem)
    {
    out_mem[i] += m_mem[i];
    }
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  arma_debug_assert_same_size(*this, m, "cube subtraction");
  
  const u32 local_n_elem = m.n_elem;
  
        eT* out_mem = (*this).memptr();
  const eT* m_mem   = m.memptr();
  
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    out_mem[i] -= m_mem[i];
    out_mem[j] -= m_mem[j];
    }
  
  if(i < local_n_elem)
    {
    out_mem[i] -= m_mem[i];
    }
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  arma_debug_assert_same_size(*this, m, "element-wise cube multiplication");
  
  const u32 local_n_elem = m.n_elem;
  
        eT* out_mem = (*this).memptr();
  const eT* m_mem   = m.memptr();
  
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    out_mem[i] *= m_mem[i];
    out_mem[j] *= m_mem[j];
    }
  
  if(i < local_n_elem)
    {
    out_mem[i] *= m_mem[i];
    }
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  arma_debug_assert_same_size(*this, m, "element-wise cube division");
  
  const u32 local_n_elem = m.n_elem;
  
        eT* out_mem = (*this).memptr();
  const eT* m_mem   = m.memptr();
  
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    out_mem[i] /= m_mem[i];
    out_mem[j] /= m_mem[j];
    }
  
  if(i < local_n_elem)
    {
    out_mem[i] /= m_mem[i];
    }
  
  return *this;
  }

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

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);
  
  arma_type_check< is_complex<eT>::value == false >::apply();   //!< compile-time abort if eT isn't std::complex
  
  typedef typename T1::elem_type T;
  arma_type_check< is_complex<T>::value == true >::apply();   //!< compile-time abort if T is std::complex
  
  isnt_same_type<std::complex<T>, eT>::check();   //!< compile-time abort if types are not compatible
  
  const unwrap_cube<T1> tmp_A(A.get_ref());
  const unwrap_cube<T2> tmp_B(B.get_ref());
  
  const Cube<T>& X = tmp_A.M;
  const Cube<T>& Y = tmp_B.M;
  
  arma_assert_same_size(X, Y, "Cube()");
  
  init(X.n_rows, X.n_cols, X.n_slices);
  
  const T* X_mem = X.mem;
  const T* Y_mem = Y.mem;
  
  for(u32 i=0; i<n_elem; ++i)
    {
    access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]);
    }
  }

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

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);
  
  this->operator=(X);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  subview_cube<eT>::extract(*this, X);
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  subview_cube<eT>::plus_inplace(*this, X);
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  subview_cube<eT>::minus_inplace(*this, X);
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  subview_cube<eT>::schur_inplace(*this, X);
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  subview_cube<eT>::div_inplace(*this, X);
  return *this;
  }

template<typename eT >
arma_inline Mat< eT > & Cube< eT >::slice ( const u32  in_slice  )  [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().

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check
    (
    (in_slice >= n_slices),
    "Cube::slice(): index out of bounds"
    );
  
  return const_cast< Mat<eT>& >( *(mat_ptrs[in_slice]) );
  }

template<typename eT >
arma_inline const Mat< eT > & Cube< eT >::slice ( const u32  in_slice  )  const [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.

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check
    (
    (in_slice >= n_slices),
    "Cube::slice(): index out of bounds"
    );
   
  return *(mat_ptrs[in_slice]);
  }

template<typename eT >
arma_inline subview_cube< eT > Cube< eT >::slices ( const u32  in_slice1,
const u32  in_slice2 
) [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.

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check
    (
    (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
    "Cube::slices(): indices out of bounds or incorrectly used"
    );
  
  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);
  }

template<typename eT >
arma_inline const subview_cube< eT > Cube< eT >::slices ( const u32  in_slice1,
const u32  in_slice2 
) const [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.

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check
    (
    (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
    "Cube::rows(): indices out of bounds or incorrectly used"
    );
  
  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);
  }

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

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check
    (
    (in_row1 >  in_row2) || (in_col1 >  in_col2) || (in_slice1 >  in_slice2) ||
    (in_row2 >= n_rows)  || (in_col2 >= n_cols)  || (in_slice2 >= n_slices),
    "Cube::subcube(): indices out of bounds or incorrectly used"
    );
  
  return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_col2, in_slice2);
  }

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

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check
    (
    (in_row1 >  in_row2) || (in_col1 >  in_col2) || (in_slice1 >  in_slice2) ||
    (in_row2 >= n_rows)  || (in_col2 >= n_cols)  || (in_slice2 >= n_slices),
    "Cube::subcube(): indices out of bounds or incorrectly used"
    );
    
  return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_col2, in_slice2);
  }

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.

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);

  isnt_same_type<eT, typename T1::elem_type>::check();
  
  op_type::apply(*this, X);
  }

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.

  {
  arma_extra_debug_sigprint();

  isnt_same_type<eT, typename T1::elem_type>::check();
  
  op_type::apply(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  
  const Cube<eT> m(X);
  
  return (*this).operator+=(m);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  
  const Cube<eT> m(X);
  
  return (*this).operator-=(m);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  
  const Cube<eT> m(X);
  
  return (*this).operator%=(m);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  
  const Cube<eT> m(X);
  
  return (*this).operator/=(m);
  }

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.

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);

  isnt_same_type<eT, typename T1::elem_type>::check();
  
  eop_type::apply(*this, X);
  }

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.

  {
  arma_extra_debug_sigprint();

  isnt_same_type<eT, typename T1::elem_type>::check();
  
  eop_type::apply(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  
  eop_type::apply_inplace_plus(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  
  eop_type::apply_inplace_minus(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();

  eop_type::apply_inplace_schur(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();

  eop_type::apply_inplace_div(*this, X);
  
  return *this;
  }

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

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);
  this->operator=(X);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  glue_type::apply(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  const Cube<eT> m(X);
  
  return (*this).operator+=(m);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  const Cube<eT> m(X);
  
  return (*this).operator-=(m);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  const Cube<eT> m(X);
  
  return (*this).operator%=(m);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  const Cube<eT> m(X);
  
  return (*this).operator/=(m);
  }

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

  : n_rows(0)
  , n_cols(0)
  , n_elem_slice(0)
  , n_slices(0)
  , n_elem(0)
  , use_aux_mem(false)
  , mat_ptrs(mat_ptrs)
  , mem(mem)
  {
  arma_extra_debug_sigprint_this(this);
  this->operator=(X);
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  eglue_type::apply(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  eglue_type::apply_inplace_plus(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  eglue_type::apply_inplace_minus(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  eglue_type::apply_inplace_schur(*this, X);
  
  return *this;
  }

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.

  {
  arma_extra_debug_sigprint();
  
  isnt_same_type<eT, typename T1::elem_type>::check();
  isnt_same_type<eT, typename T2::elem_type>::check();
  
  eglue_type::apply_inplace_div(*this, X);
  
  return *this;
  }

template<typename eT >
arma_inline eT & Cube< eT >::operator() ( const u32  i  )  [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().

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

template<typename eT >
arma_inline eT Cube< eT >::operator() ( const u32  i  )  const [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.

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

template<typename eT >
arma_inline eT & Cube< eT >::operator[] ( const u32  i  )  [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().

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

template<typename eT >
arma_inline eT Cube< eT >::operator[] ( const u32  i  )  const [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.

  {
  return mem[i];
  }

template<typename eT >
arma_inline eT & Cube< eT >::operator() ( const u32  in_row,
const u32  in_col,
const u32  in_slice 
) [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().

  {
  arma_debug_check
    (
    (in_row >= n_rows) ||
    (in_col >= n_cols) ||
    (in_slice >= n_slices)
    ,
    "Cube::operator(): index out of bounds"
    );

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

template<typename eT >
arma_inline eT Cube< eT >::operator() ( const u32  in_row,
const u32  in_col,
const u32  in_slice 
) const [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.

  {
  arma_debug_check
    (
    (in_row >= n_rows) ||
    (in_col >= n_cols) ||
    (in_slice >= n_slices)
    ,
    "Cube::operator(): index out of bounds"
    );

  return mem[in_slice*n_elem_slice + in_col*n_rows + in_row];
  }

template<typename eT >
arma_inline eT & Cube< eT >::at ( const u32  in_row,
const u32  in_col,
const u32  in_slice 
) [inherited]
template<typename eT >
arma_inline eT Cube< eT >::at ( const u32  in_row,
const u32  in_col,
const u32  in_slice 
) const [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.

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

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

prefix ++

Definition at line 1397 of file Cube_meat.hpp.

References Cube_aux::prefix_pp().

  {
  Cube_aux::prefix_pp(*this);
  return *this;
  }

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

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

Definition at line 1409 of file Cube_meat.hpp.

References Cube_aux::postfix_pp().

  {
  Cube_aux::postfix_pp(*this);
  }

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

prefix --

Definition at line 1420 of file Cube_meat.hpp.

References Cube_aux::prefix_mm().

  {
  Cube_aux::prefix_mm(*this);
  return *this;
  }

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

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

Definition at line 1432 of file Cube_meat.hpp.

References Cube_aux::postfix_mm().

  {
  Cube_aux::postfix_mm(*this);
  }

template<typename eT >
arma_inline bool Cube< eT >::is_finite (  )  const [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.

  {
  for(u32 i=0; i<n_elem; ++i)
    {
    if(arma_isfinite(mem[i]) == false)
      {
      return false;
      }
    }

  return true;
  }

template<typename eT >
arma_inline eT * Cube< eT >::memptr (  )  [inherited]
template<typename eT >
arma_inline const eT * Cube< eT >::memptr (  )  const [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.

  {
  return mem;
  }

template<typename eT >
arma_inline eT * Cube< eT >::slice_memptr ( const u32  slice  )  [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().

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

template<typename eT >
arma_inline const eT * Cube< eT >::slice_memptr ( const u32  slice  )  const [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.

  {
  return &mem[ slice*n_elem_slice ];
  }

template<typename eT >
arma_inline eT * Cube< eT >::slice_colptr ( const u32  in_slice,
const u32  in_col 
) [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().

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

template<typename eT >
arma_inline const eT * Cube< eT >::slice_colptr ( const u32  in_slice,
const u32  in_col 
) const [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.

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

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

  {
  arma_extra_debug_sigprint();
  
  if(extra_text.length() != 0)
    {
    cout << extra_text << '\n';
    }
  
  arma_ostream::print(cout, *this, true);
  }

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

  {
  arma_extra_debug_sigprint();
  
  if(extra_text.length() != 0)
    {
    user_stream << extra_text << '\n';
    }
  
  arma_ostream::print(user_stream, *this, true);
  }

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

  {
  arma_extra_debug_sigprint();
  
  if(extra_text.length() != 0)
    {
    cout << extra_text << '\n';
    }
  
  arma_ostream::print(cout, *this, false);
  }

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

  {
  arma_extra_debug_sigprint();
  
  if(extra_text.length() != 0)
    {
    user_stream << extra_text << '\n';
    }
  
  arma_ostream::print(user_stream, *this, false);
  }

template<typename eT >
void Cube< eT >::set_size ( const u32  in_rows,
const u32  in_cols,
const u32  in_slices 
) [inline, inherited]
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.

  {
  arma_extra_debug_sigprint();
  
  init(m.n_rows, m.n_cols, m.n_slices);
  }

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

  {
  arma_extra_debug_sigprint();
  
        eT* local_ptr    = memptr();
  const u32 local_n_elem = n_elem;
  
  u32 i,j;
  
  for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
    {
    local_ptr[i] = val;
    local_ptr[j] = val;
    }
  
  if(i < local_n_elem)
    {
    local_ptr[i] = val;
    }
  }

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

Definition at line 1664 of file Cube_meat.hpp.

References Cube< eT >::fill().

  {
  arma_extra_debug_sigprint();
  
  fill(eT(0));
  }

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

  {
  arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d, in_slices = %d") % in_rows % in_cols % in_slices );

  set_size(in_rows, in_cols, in_slices);
  fill(eT(0));
  }

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

Definition at line 1689 of file Cube_meat.hpp.

References Cube< eT >::fill().

  {
  arma_extra_debug_sigprint();
  
  fill(eT(1));
  }

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

  {
  arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d, in_slices = %d") % in_rows % in_cols % in_slices );

  set_size(in_rows, in_cols, in_slices);
  fill(eT(1));
  }

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

Definition at line 1714 of file Cube_meat.hpp.

References Cube< eT >::init().

  {
  arma_extra_debug_sigprint();
  
  init(0,0,0);
  }

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

save the cube to a file

Definition at line 1727 of file Cube_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  bool save_okay;
  
  switch(type)
    {
    case raw_ascii:
      save_okay = diskio::save_raw_ascii(*this, name);
      break;
    
    case arma_ascii:
      save_okay = diskio::save_arma_ascii(*this, name);
      break;
    
    case arma_binary:
      save_okay = diskio::save_arma_binary(*this, name);
      break;
      
    case ppm_binary:
      save_okay = diskio::save_ppm_binary(*this, name);
      break;

    default:
      arma_warn(print_status, "Cube::save(): unsupported file type");
      save_okay = false;
    }
  
  arma_warn( (print_status && (save_okay == false)), "Cube::save(): couldn't write to ", name);
  
  return save_okay;
  }

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

save the cube to a stream

Definition at line 1767 of file Cube_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  bool save_okay;
  
  switch(type)
    {
    case raw_ascii:
      save_okay = diskio::save_raw_ascii(*this, os);
      break;
    
    case arma_ascii:
      save_okay = diskio::save_arma_ascii(*this, os);
      break;
    
    case arma_binary:
      save_okay = diskio::save_arma_binary(*this, os);
      break;
      
    case ppm_binary:
      save_okay = diskio::save_ppm_binary(*this, os);
      break;

    default:
      arma_warn(print_status, "Cube::save(): unsupported file type");
      save_okay = false;
    }
  
  arma_warn( (print_status && (save_okay == false)), "Cube::save(): couldn't write to given stream");
  
  return save_okay;
  }

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

load a cube from a file

Definition at line 1807 of file Cube_meat.hpp.

References arma_ascii, arma_binary, arma_print(), arma_warn(), 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.

  {
  arma_extra_debug_sigprint();
  
  bool load_okay;
  std::string err_msg;
  
  switch(type)
    {
    case auto_detect:
      load_okay = diskio::load_auto_detect(*this, name, err_msg);
      break;
    
    case raw_ascii:
      load_okay = diskio::load_raw_ascii(*this, name, err_msg);
      break;
    
    case arma_ascii:
      load_okay = diskio::load_arma_ascii(*this, name, err_msg);
      break;
    
    case arma_binary:
      load_okay = diskio::load_arma_binary(*this, name, err_msg);
      break;
      
    case ppm_binary:
      load_okay = diskio::load_ppm_binary(*this, name, err_msg);
      break;

    default:
      arma_warn(print_status, "Cube::load(): unsupported file type");
      load_okay = false;
    }
  
  if( (print_status == true) && (load_okay == false) )
    {
    if(err_msg.length() > 0)
      {
      arma_print("Cube::load(): ", err_msg, name);
      }
    else
      {
      arma_print("Cube::load(): couldn't read ", name);
      }
    }
  
  if(load_okay == false)
    {
    (*this).reset();
    }
    
  return load_okay;
  }

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

load a cube from a stream

Definition at line 1867 of file Cube_meat.hpp.

References arma_ascii, arma_binary, arma_print(), arma_warn(), 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.

  {
  arma_extra_debug_sigprint();
  
  bool load_okay;
  std::string err_msg;
  
  switch(type)
    {
    case auto_detect:
      load_okay = diskio::load_auto_detect(*this, is, err_msg);
      break;
    
    case raw_ascii:
      load_okay = diskio::load_raw_ascii(*this, is, err_msg);
      break;
    
    case arma_ascii:
      load_okay = diskio::load_arma_ascii(*this, is, err_msg);
      break;
    
    case arma_binary:
      load_okay = diskio::load_arma_binary(*this, is, err_msg);
      break;
      
    case ppm_binary:
      load_okay = diskio::load_ppm_binary(*this, is, err_msg);
      break;
    
    default:
      arma_warn(print_status, "Cube::load(): unsupported file type");
      load_okay = false;
    }
  
  
  if( (print_status == true) && (load_okay == false) )
    {
    if(err_msg.length() > 0)
      {
      arma_print("Cube::load(): ", err_msg, "the given stream");
      }
    else
      {
      arma_print("Cube::load(): couldn't load from the given stream");
      }
    }
  
  if(load_okay == false)
    {
    (*this).reset();
    }
    
  return load_okay;
  }

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

save the cube to a file, without printing any error messages

Definition at line 1928 of file Cube_meat.hpp.

  {
  arma_extra_debug_sigprint();
  
  return (*this).save(name, type, false);
  }

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

save the cube to a stream, without printing any error messages

Definition at line 1941 of file Cube_meat.hpp.

  {
  arma_extra_debug_sigprint();
  
  return (*this).save(os, type, false);
  }

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

load a cube from a file, without printing any error messages

Definition at line 1954 of file Cube_meat.hpp.

  {
  arma_extra_debug_sigprint();
  
  return (*this).load(name, type, false);
  }

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

load a cube from a stream, without printing any error messages

Definition at line 1967 of file Cube_meat.hpp.

  {
  arma_extra_debug_sigprint();
  
  return (*this).load(is, type, false);
  }

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

Definition at line 1979 of file Cube_meat.hpp.

References Cube< eT >::memptr().

  {
  arma_extra_debug_sigprint();
  
  return memptr();
  }

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

Definition at line 1991 of file Cube_meat.hpp.

References Cube< eT >::memptr().

  {
  arma_extra_debug_sigprint();
  
  return memptr();
  }

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

Definition at line 2003 of file Cube_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  return memptr() + n_elem;
  }

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

Definition at line 2015 of file Cube_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  return memptr() + n_elem;
  }

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

Definition at line 2027 of file Cube_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check( (slice_num >= n_slices), "begin_slice(): index out of bounds");
  
  return slice_memptr(slice_num);
  }

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

Definition at line 2041 of file Cube_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check( (slice_num >= n_slices), "begin_slice(): index out of bounds");
  
  return slice_memptr(slice_num);
  }

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

Definition at line 2055 of file Cube_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check( (slice_num >= n_slices), "end_slice(): index out of bounds");
  
  return slice_memptr(slice_num) + n_elem_slice;
  }

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

Definition at line 2069 of file Cube_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  arma_debug_check( (slice_num >= n_slices), "end_slice(): index out of bounds");
  
  return slice_memptr(slice_num) + n_elem_slice;
  }

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

prefix ++

Definition at line 2084 of file Cube_meat.hpp.

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

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

  {
        eT* memptr = x.memptr();
  const u32 n_elem = x.n_elem;
  
  u32 i,j;

  for(i=0, j=1; j<n_elem; i+=2, j+=2)
    {
    ++(memptr[i]);
    ++(memptr[j]);
    }
  
  if(i < n_elem)
    {
    ++(memptr[i]);
    }
  }

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

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

Definition at line 2109 of file Cube_meat.hpp.

  {
  x += T(1);
  }

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

postfix ++

Definition at line 2120 of file Cube_meat.hpp.

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

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

  {
        eT* memptr = x.memptr();
  const u32 n_elem = x.n_elem;
  
  u32 i,j;
  
  for(i=0, j=1; j<n_elem; i+=2, j+=2)
    {
    (memptr[i])++;
    (memptr[j])++;
    }
  
  if(i < n_elem)
    {
    (memptr[i])++;
    }
  }

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

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

Definition at line 2145 of file Cube_meat.hpp.

  {
  x += T(1);
  }

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

prefix --

Definition at line 2156 of file Cube_meat.hpp.

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

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

  {
        eT* memptr = x.memptr();
  const u32 n_elem = x.n_elem;

  u32 i,j;

  for(i=0, j=1; j<n_elem; i+=2, j+=2)
    {
    --(memptr[i]);
    --(memptr[j]);
    }
  
  if(i < n_elem)
    {
    --(memptr[i]);
    }
  }

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

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

Definition at line 2181 of file Cube_meat.hpp.

  {
  x -= T(1);
  }

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

postfix --

Definition at line 2192 of file Cube_meat.hpp.

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

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

  {
        eT* memptr = x.memptr();
  const u32 n_elem = x.n_elem;

  u32 i,j;

  for(i=0, j=1; j<n_elem; i+=2, j+=2)
    {
    (memptr[i])--;
    (memptr[j])--;
    }
  
  if(i < n_elem)
    {
    (memptr[i])--;
    }
  }

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

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

Definition at line 2217 of file Cube_meat.hpp.

  {
  x -= T(1);
  }