Mat

Classes

class  Mat< eT >
 Dense matrix class. More...
class  Mat_aux

Functions

 Mat::~Mat ()
 Mat::Mat ()
 Mat::Mat (const u32 in_rows, const u32 in_cols)
 construct the matrix to have user specified dimensions
void Mat::init (const u32 in_rows, const u32 in_cols)
 internal matrix construction; if the requested size is small enough, memory from the stack is used. otherwise memory is allocated via 'new'
 Mat::Mat (const char *text)
 create the matrix from a textual description
const MatMat::operator= (const char *text)
 create the matrix from a textual description
 Mat::Mat (const std::string &text)
 create the matrix from a textual description
const MatMat::operator= (const std::string &text)
 create the matrix from a textual description
void Mat::init (const std::string &text)
 internal function to create the matrix from a textual description
arma_inline const MatMat::operator= (const eT val)
 Set the matrix to be equal to the specified scalar. NOTE: the size of the matrix will be 1x1.
arma_inline const MatMat::operator+= (const eT val)
 In-place addition of a scalar to all elements of the matrix.
arma_inline const MatMat::operator-= (const eT val)
 In-place subtraction of a scalar from all elements of the matrix.
arma_inline const MatMat::operator*= (const eT val)
 In-place multiplication of all elements of the matrix with a scalar.
arma_inline const MatMat::operator/= (const eT val)
 In-place division of all elements of the matrix with a scalar.
 Mat::Mat (const Mat &m)
 construct a matrix from a given matrix
const MatMat::operator= (const Mat &m)
 construct a matrix from a given matrix
void Mat::init (const Mat &x)
 construct a matrix from a given matrix
 Mat::Mat (eT *aux_mem, const u32 aux_n_rows, const u32 aux_n_cols, const bool copy_aux_mem=true)
 construct a matrix 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). the default is to copy the array.
 Mat::Mat (const eT *aux_mem, const u32 aux_n_rows, const u32 aux_n_cols)
 construct a matrix from a given auxiliary read-only array of eTs. the array is copied.
 Mat::Mat (const char junk, const eT *aux_mem, const u32 aux_n_rows, const u32 aux_n_cols)
 DANGEROUS! Construct a temporary matrix, using auxiliary memory. This constructor is NOT intended for usage by user code. Its sole purpose is to be used by the Cube class.
const MatMat::operator+= (const Mat &m)
 in-place matrix addition
const MatMat::operator-= (const Mat &m)
 in-place matrix subtraction
const MatMat::operator*= (const Mat &m)
 in-place matrix multiplication
const MatMat::operator%= (const Mat &m)
 in-place element-wise matrix multiplication
const MatMat::operator/= (const Mat &m)
 in-place element-wise matrix division
template<typename T1 , typename T2 >
 Mat::Mat (const Base< typename Mat< eT >::pod_type, T1 > &A, const Base< typename Mat< eT >::pod_type, T2 > &B)
 for constructing a complex matrix out of two non-complex matrices
 Mat::Mat (const subview< eT > &X)
 construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation)
const MatMat::operator= (const subview< eT > &X)
 construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation)
const MatMat::operator+= (const subview< eT > &X)
 in-place matrix addition (using a submatrix on the right-hand-side)
const MatMat::operator-= (const subview< eT > &X)
 in-place matrix subtraction (using a submatrix on the right-hand-side)
const MatMat::operator*= (const subview< eT > &X)
 in-place matrix mutiplication (using a submatrix on the right-hand-side)
const MatMat::operator%= (const subview< eT > &X)
 in-place element-wise matrix mutiplication (using a submatrix on the right-hand-side)
const MatMat::operator/= (const subview< eT > &X)
 in-place element-wise matrix division (using a submatrix on the right-hand-side)
 Mat::Mat (const subview_cube< eT > &X)
 construct a matrix from a subview_cube instance
const MatMat::operator= (const subview_cube< eT > &X)
 construct a matrix from a subview_cube instance
const MatMat::operator+= (const subview_cube< eT > &X)
 in-place matrix addition (using a single-slice subcube on the right-hand-side)
const MatMat::operator-= (const subview_cube< eT > &X)
 in-place matrix subtraction (using a single-slice subcube on the right-hand-side)
const MatMat::operator*= (const subview_cube< eT > &X)
 in-place matrix mutiplication (using a single-slice subcube on the right-hand-side)
const MatMat::operator%= (const subview_cube< eT > &X)
 in-place element-wise matrix mutiplication (using a single-slice subcube on the right-hand-side)
const MatMat::operator/= (const subview_cube< eT > &X)
 in-place element-wise matrix division (using a single-slice subcube on the right-hand-side)
 Mat::Mat (const diagview< eT > &X)
 construct a matrix from diagview (e.g. construct a matrix from a delayed diag operation)
const MatMat::operator= (const diagview< eT > &X)
 construct a matrix from diagview (e.g. construct a matrix from a delayed diag operation)
const MatMat::operator+= (const diagview< eT > &X)
 in-place matrix addition (using a diagview on the right-hand-side)
const MatMat::operator-= (const diagview< eT > &X)
 in-place matrix subtraction (using a diagview on the right-hand-side)
const MatMat::operator*= (const diagview< eT > &X)
 in-place matrix mutiplication (using a diagview on the right-hand-side)
const MatMat::operator%= (const diagview< eT > &X)
 in-place element-wise matrix mutiplication (using a diagview on the right-hand-side)
const MatMat::operator/= (const diagview< eT > &X)
 in-place element-wise matrix division (using a diagview on the right-hand-side)
arma_inline subview_row< eT > Mat::row (const u32 row_num)
 creation of subview (row vector)
arma_inline const subview_row< eT > Mat::row (const u32 row_num) const
 creation of subview (row vector)
arma_inline subview_col< eT > Mat::col (const u32 col_num)
 creation of subview (column vector)
arma_inline const subview_col< eT > Mat::col (const u32 col_num) const
 creation of subview (column vector)
arma_inline subview< eT > Mat::rows (const u32 in_row1, const u32 in_row2)
 creation of subview (submatrix comprised of specified row vectors)
arma_inline const subview< eT > Mat::rows (const u32 in_row1, const u32 in_row2) const
 creation of subview (submatrix comprised of specified row vectors)
arma_inline subview< eT > Mat::cols (const u32 in_col1, const u32 in_col2)
 creation of subview (submatrix comprised of specified column vectors)
arma_inline const subview< eT > Mat::cols (const u32 in_col1, const u32 in_col2) const
 creation of subview (submatrix comprised of specified column vectors)
arma_inline subview< eT > Mat::submat (const u32 in_row1, const u32 in_col1, const u32 in_row2, const u32 in_col2)
 creation of subview (submatrix)
arma_inline const subview< eT > Mat::submat (const u32 in_row1, const u32 in_col1, const u32 in_row2, const u32 in_col2) const
 creation of subview (generic submatrix)
arma_inline diagview< eT > Mat::diag (const s32 in_id=0)
 creation of diagview (diagonal)
arma_inline const diagview< eT > Mat::diag (const s32 in_id=0) const
 creation of diagview (diagonal)
void Mat::swap_rows (const u32 in_row1, const u32 in_row2)
void Mat::swap_cols (const u32 in_col1, const u32 in_col2)
template<typename T1 , typename op_type >
 Mat::Mat (const Op< T1, op_type > &X)
 create a matrix from Op, i.e. run the previously delayed unary operations
template<typename T1 , typename op_type >
const MatMat::operator= (const Op< T1, op_type > &X)
 create a matrix from Op, i.e. run the previously delayed unary operations
template<typename T1 , typename op_type >
const MatMat::operator+= (const Op< T1, op_type > &X)
 in-place matrix addition, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const MatMat::operator-= (const Op< T1, op_type > &X)
 in-place matrix subtraction, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const MatMat::operator*= (const Op< T1, op_type > &X)
 in-place matrix multiplication, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const MatMat::operator%= (const Op< T1, op_type > &X)
 in-place matrix element-wise multiplication, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const MatMat::operator/= (const Op< T1, op_type > &X)
 in-place matrix element-wise division, with the right-hand-side operand having delayed operations
template<typename T1 , typename eop_type >
 Mat::Mat (const eOp< T1, eop_type > &X)
 create a matrix from eOp, i.e. run the previously delayed unary operations
template<typename T1 , typename eop_type >
const MatMat::operator= (const eOp< T1, eop_type > &X)
 create a matrix from eOp, i.e. run the previously delayed unary operations
template<typename T1 , typename eop_type >
const MatMat::operator+= (const eOp< T1, eop_type > &X)
template<typename T1 , typename eop_type >
const MatMat::operator-= (const eOp< T1, eop_type > &X)
template<typename T1 , typename eop_type >
const MatMat::operator*= (const eOp< T1, eop_type > &X)
template<typename T1 , typename eop_type >
const MatMat::operator%= (const eOp< T1, eop_type > &X)
template<typename T1 , typename eop_type >
const MatMat::operator/= (const eOp< T1, eop_type > &X)
template<typename T1 , typename T2 , typename glue_type >
 Mat::Mat (const Glue< T1, T2, glue_type > &X)
 create a matrix from Glue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename glue_type >
const MatMat::operator= (const Glue< T1, T2, glue_type > &X)
 create a matrix from Glue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename glue_type >
const MatMat::operator+= (const Glue< T1, T2, glue_type > &X)
 in-place matrix addition, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_type >
const MatMat::operator-= (const Glue< T1, T2, glue_type > &X)
 in-place matrix subtraction, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_type >
const MatMat::operator*= (const Glue< T1, T2, glue_type > &X)
 in-place matrix multiplications, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_type >
const MatMat::operator%= (const Glue< T1, T2, glue_type > &X)
 in-place matrix element-wise multiplication, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_type >
const MatMat::operator/= (const Glue< T1, T2, glue_type > &X)
 in-place matrix element-wise division, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 >
const MatMat::operator+= (const Glue< T1, T2, glue_times > &X)
template<typename T1 , typename T2 >
const MatMat::operator-= (const Glue< T1, T2, glue_times > &X)
template<typename T1 , typename T2 , typename eglue_type >
 Mat::Mat (const eGlue< T1, T2, eglue_type > &X)
 create a matrix from eGlue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename eglue_type >
const MatMat::operator= (const eGlue< T1, T2, eglue_type > &X)
 create a matrix from eGlue, i.e. run the previously delayed binary operations
template<typename T1 , typename T2 , typename eglue_type >
const MatMat::operator+= (const eGlue< T1, T2, eglue_type > &X)
 in-place matrix addition, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename eglue_type >
const MatMat::operator-= (const eGlue< T1, T2, eglue_type > &X)
 in-place matrix subtraction, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename eglue_type >
const MatMat::operator*= (const eGlue< T1, T2, eglue_type > &X)
template<typename T1 , typename T2 , typename eglue_type >
const MatMat::operator%= (const eGlue< T1, T2, eglue_type > &X)
template<typename T1 , typename T2 , typename eglue_type >
const MatMat::operator/= (const eGlue< T1, T2, eglue_type > &X)
arma_inline eT & Mat::operator() (const u32 i)
 linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline eT Mat::operator() (const u32 i) const
 linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline eT & Mat::operator[] (const u32 i)
 linear element accessor (treats the matrix as a vector); no bounds check.
arma_inline eT Mat::operator[] (const u32 i) const
 linear element accessor (treats the matrix as a vector); no bounds check
arma_inline eT & Mat::operator() (const u32 in_row, const u32 in_col)
 element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline eT Mat::operator() (const u32 in_row, const u32 in_col) const
 element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline eT & Mat::at (const u32 in_row, const u32 in_col)
 element accessor; no bounds check
arma_inline eT Mat::at (const u32 in_row, const u32 in_col) const
 element accessor; no bounds check
arma_inline const MatMat::operator++ ()
 prefix ++
arma_inline void Mat::operator++ (int)
 postfix ++ (must not return the object by reference)
arma_inline const MatMat::operator-- ()
 prefix --
arma_inline void Mat::operator-- (int)
 postfix -- (must not return the object by reference)
arma_inline bool Mat::is_vec () const
 returns true if the object can be interpreted as a column or row vector
arma_inline bool Mat::is_square () const
 returns true if the object has the same number of non-zero rows and columnns
arma_inline bool Mat::is_finite () const
 returns true if all of the elements are finite
arma_inline eT * Mat::colptr (const u32 in_col)
 returns a pointer to array of eTs for a specified column; no bounds check
arma_inline const eT * Mat::colptr (const u32 in_col) const
 returns a pointer to array of eTs for a specified column; no bounds check
arma_inline eT * Mat::memptr ()
 returns a pointer to array of eTs used by the matrix
arma_inline const eT * Mat::memptr () const
 returns a pointer to array of eTs used by the matrix
void Mat::print (const std::string extra_text="") const
 print contents of the matrix (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 Mat::print (std::ostream &user_stream, const std::string extra_text="") const
 print contents of the matrix 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 Mat::print_trans (const std::string extra_text="") const
 print contents of the transposed version of the matrix (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 Mat::print_trans (std::ostream &user_stream, const std::string extra_text="") const
 print contents of the transposed version of matrix 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 Mat::raw_print (const std::string extra_text="") const
 print contents of the matrix (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 Mat::raw_print (std::ostream &user_stream, const std::string extra_text="") const
 print contents of the matrix 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 Mat::raw_print_trans (const std::string extra_text="") const
 print contents of the transposed version of the matrix (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 Mat::raw_print_trans (std::ostream &user_stream, const std::string extra_text="") const
 print contents of the transposed version of the matrix 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 Mat::set_size (const u32 in_rows, const u32 in_cols)
 change the matrix to have user specified dimensions (data is not preserved)
template<typename eT2 >
void Mat::copy_size (const Mat< eT2 > &m)
 change the matrix (without preserving data) to have the same dimensions as the given matrix
arma_hot void Mat::fill (const eT val)
 fill the matrix with the specified value
void Mat::zeros ()
void Mat::zeros (const u32 in_rows, const u32 in_cols)
void Mat::ones ()
void Mat::ones (const u32 in_rows, const u32 in_cols)
void Mat::reset ()
void Mat::save (const std::string name, const file_type type=arma_binary) const
 save the matrix to a file
void Mat::save (std::ostream &os, const file_type type=arma_binary) const
 save the matrix to a stream
void Mat::load (const std::string name, const file_type type=auto_detect)
 load a matrix from a file
void Mat::load (std::istream &is, const file_type type=auto_detect)
 load a matrix from a stream
 Mat::row_iterator::row_iterator (Mat< eT > &in_M, const u32 in_row)
eT & Mat::row_iterator::operator* ()
row_iterator & Mat::row_iterator::operator++ ()
void Mat::row_iterator::operator++ (int)
row_iterator & Mat::row_iterator::operator-- ()
void Mat::row_iterator::operator-- (int)
 Mat::const_row_iterator::const_row_iterator (const Mat< eT > &in_M, const u32 in_row)
eT Mat::const_row_iterator::operator* () const
const_row_iterator & Mat::const_row_iterator::operator++ ()
void Mat::const_row_iterator::operator++ (int)
const_row_iterator & Mat::const_row_iterator::operator-- ()
void Mat::const_row_iterator::operator-- (int)
iterator Mat::begin ()
const_iterator Mat::begin () const
iterator Mat::end ()
const_iterator Mat::end () const
col_iterator Mat::begin_col (const u32 col_num)
const_col_iterator Mat::begin_col (const u32 col_num) const
col_iterator Mat::end_col (const u32 col_num)
const_col_iterator Mat::end_col (const u32 col_num) const
row_iterator Mat::begin_row (const u32 row_num)
const_row_iterator Mat::begin_row (const u32 row_num) const
row_iterator Mat::end_row (const u32 row_num)
const_row_iterator Mat::end_row (const u32 row_num) const
template<typename eT >
static arma_inline void Mat_aux::prefix_pp (Mat< eT > &x)
 prefix ++
template<typename T >
static arma_inline void Mat_aux::prefix_pp (Mat< std::complex< T > > &x)
 prefix ++ for complex numbers (work around for limitations of the std::complex class)
template<typename eT >
static arma_inline void Mat_aux::postfix_pp (Mat< eT > &x)
 postfix ++
template<typename T >
static arma_inline void Mat_aux::postfix_pp (Mat< std::complex< T > > &x)
 postfix ++ for complex numbers (work around for limitations of the std::complex class)
template<typename eT >
static arma_inline void Mat_aux::prefix_mm (Mat< eT > &x)
 prefix --
template<typename T >
static arma_inline void Mat_aux::prefix_mm (Mat< std::complex< T > > &x)
 prefix -- for complex numbers (work around for limitations of the std::complex class)
template<typename eT >
static arma_inline void Mat_aux::postfix_mm (Mat< eT > &x)
 postfix --
template<typename T >
static arma_inline void Mat_aux::postfix_mm (Mat< std::complex< T > > &x)
 postfix ++ for complex numbers (work around for limitations of the std::complex class)

Function Documentation

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

Definition at line 23 of file Mat_meat.hpp.

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

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

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

Definition at line 51 of file Mat_meat.hpp.

00052   : n_rows(0)
00053   , n_cols(0)
00054   , n_elem(0)
00055   , use_aux_mem(false)
00056   //, mem(0)
00057   , mem(mem)
00058   {
00059   arma_extra_debug_sigprint_this(this);
00060   }

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

construct the matrix to have user specified dimensions

Definition at line 66 of file Mat_meat.hpp.

References Mat< eT >::init().

00067   : n_rows(0)
00068   , n_cols(0)
00069   , n_elem(0)
00070   , use_aux_mem(false)
00071   //, mem(0)
00072   , mem(mem)
00073   {
00074   arma_extra_debug_sigprint_this(this);
00075   
00076   init(in_n_rows, in_n_cols);
00077   }

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

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

Definition at line 85 of file Mat_meat.hpp.

References arma_check(), Mat< eT >::mem, Mat< eT >::mem_local, Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, access::rw(), and Mat< eT >::use_aux_mem.

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

00086   {
00087   arma_extra_debug_sigprint( arma_boost::format("in_n_rows = %d, in_n_cols = %d") % in_n_rows % in_n_cols );
00088   
00089   const u32 new_n_elem = in_n_rows * in_n_cols;
00090 
00091   if(n_elem == new_n_elem)
00092     {
00093     access::rw(n_rows) = in_n_rows;
00094     access::rw(n_cols) = in_n_cols;
00095     }
00096   else
00097     {
00098     arma_debug_check
00099       (
00100       (use_aux_mem == true),
00101       "Mat::init(): can't change the amount of memory as auxiliary memory is in use"
00102       );
00103 
00104     if(n_elem > sizeof(mem_local)/sizeof(eT) )
00105       {
00106       delete [] mem;
00107       }
00108     
00109     if(new_n_elem <= sizeof(mem_local)/sizeof(eT) )
00110       {
00111       access::rw(mem) = mem_local;
00112       }
00113     else
00114       {
00115       access::rw(mem) = new(std::nothrow) eT[new_n_elem];
00116       arma_check( (mem == 0), "Mat::init(): out of memory" );
00117       }
00118     
00119     access::rw(n_elem) = new_n_elem;
00120 
00121     if(new_n_elem == 0)
00122       {
00123       access::rw(n_rows) = 0;
00124       access::rw(n_cols) = 0;
00125       }
00126     else
00127       {
00128       access::rw(n_rows) = in_n_rows;
00129       access::rw(n_cols) = in_n_cols;
00130       }
00131     
00132     }
00133   }

template<typename eT >
Mat< eT >::Mat ( const char *  text  )  [inline, inherited]

create the matrix from a textual description

Definition at line 139 of file Mat_meat.hpp.

References Mat< eT >::init().

00140   : n_rows(0)
00141   , n_cols(0)
00142   , n_elem(0)
00143   , use_aux_mem(false)
00144   //, mem(0)
00145   , mem(mem)
00146   {
00147   arma_extra_debug_sigprint_this(this);
00148   
00149   init( std::string(text) );
00150   }

template<typename eT >
const Mat< eT > & Mat< eT >::operator= ( const char *  text  )  [inline, inherited]

create the matrix from a textual description

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 158 of file Mat_meat.hpp.

References Mat< eT >::init().

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

00159   {
00160   arma_extra_debug_sigprint();
00161   
00162   init( std::string(text) );
00163   return *this;
00164   }

template<typename eT >
Mat< eT >::Mat ( const std::string &  text  )  [inline, inherited]

create the matrix from a textual description

Definition at line 171 of file Mat_meat.hpp.

References Mat< eT >::init().

00172   : n_rows(0)
00173   , n_cols(0)
00174   , n_elem(0)
00175   , use_aux_mem(false)
00176   //, mem(0)
00177   , mem(mem)
00178   {
00179   arma_extra_debug_sigprint_this(this);
00180   
00181   init(text);
00182   }

template<typename eT >
const Mat< eT > & Mat< eT >::operator= ( const std::string &  text  )  [inline, inherited]

create the matrix from a textual description

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 190 of file Mat_meat.hpp.

References Mat< eT >::init().

00191   {
00192   arma_extra_debug_sigprint();
00193   
00194   init(text);
00195   return *this;
00196   }

template<typename eT >
void Mat< eT >::init ( const std::string &  text  )  [inline, protected, inherited]

internal function to create the matrix from a textual description

Definition at line 204 of file Mat_meat.hpp.

References arma_check(), Mat< eT >::at(), Mat< eT >::col(), Mat< eT >::row(), and Mat< eT >::set_size().

00205   {
00206   arma_extra_debug_sigprint();
00207   
00208   //
00209   // work out the size
00210   
00211   u32 t_n_rows = 0;
00212   u32 t_n_cols = 0;
00213   
00214   bool t_n_cols_found = false;
00215   
00216   std::string token;
00217   
00218   std::string::size_type line_start = 0;
00219   std::string::size_type   line_end = 0;
00220   
00221   while( line_start < text.length() )
00222     {
00223     
00224     line_end = text.find(';', line_start);
00225     
00226     if(line_end == std::string::npos)
00227       line_end = text.length()-1;
00228     
00229     std::string::size_type line_len = line_end - line_start + 1;
00230     std::stringstream line_stream( text.substr(line_start,line_len) );
00231     
00232     
00233     u32 line_n_cols = 0;
00234     while(line_stream >> token)
00235       {
00236       ++line_n_cols;
00237       }
00238     
00239     
00240     if(line_n_cols > 0)
00241       {
00242       if(t_n_cols_found == false)
00243         {
00244         t_n_cols = line_n_cols;
00245         t_n_cols_found = true;
00246         }
00247       else
00248         arma_check( (line_n_cols != t_n_cols), "Mat::init(): inconsistent number of columns in given string");
00249       
00250       ++t_n_rows;
00251       }
00252     line_start = line_end+1;
00253     
00254     }
00255     
00256   Mat<eT>& x = *this;
00257   x.set_size(t_n_rows, t_n_cols);
00258   
00259   line_start = 0;
00260   line_end = 0;
00261   
00262   u32 row = 0;
00263   
00264   while( line_start < text.length() )
00265     {
00266     
00267     line_end = text.find(';', line_start);
00268     
00269     if(line_end == std::string::npos)
00270       line_end = text.length()-1;
00271     
00272     std::string::size_type line_len = line_end - line_start + 1;
00273     std::stringstream line_stream( text.substr(line_start,line_len) );
00274     
00275 //     u32 col = 0;
00276 //     while(line_stream >> token)
00277 //       {
00278 //       x.at(row,col) = strtod(token.c_str(), 0);
00279 //       ++col;
00280 //       }
00281     
00282     u32 col = 0;
00283     eT val;
00284     while(line_stream >> val)
00285       {
00286       x.at(row,col) = val;
00287       ++col;
00288       }
00289     
00290     ++row;
00291     line_start = line_end+1;
00292     }
00293   
00294   }

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

Set the matrix to be equal to the specified scalar. NOTE: the size of the matrix will be 1x1.

Definition at line 303 of file Mat_meat.hpp.

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

00304   {
00305   arma_extra_debug_sigprint();
00306   
00307   init(1,1);
00308   access::rw(mem[0]) = val;
00309   return *this;
00310   }

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

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

Definition at line 318 of file Mat_meat.hpp.

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

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

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

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

Definition at line 347 of file Mat_meat.hpp.

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

00348   {
00349   arma_extra_debug_sigprint();
00350   
00351         eT* local_ptr    = memptr();
00352   const u32 local_n_elem = n_elem;
00353     
00354   u32 i,j;
00355   
00356   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00357     {
00358     local_ptr[i] -= val;
00359     local_ptr[j] -= val;
00360     }
00361   
00362   if(i < local_n_elem)
00363     {
00364     local_ptr[i] -= val;
00365     }
00366   
00367   return *this;
00368   }

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

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

Definition at line 376 of file Mat_meat.hpp.

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

00377   {
00378   arma_extra_debug_sigprint();
00379   
00380         eT* local_ptr    = memptr();
00381   const u32 local_n_elem = n_elem;
00382     
00383   u32 i,j;
00384   
00385   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00386     {
00387     local_ptr[i] *= val;
00388     local_ptr[j] *= val;
00389     }
00390   
00391   if(i < local_n_elem)
00392     {
00393     local_ptr[i] *= val;
00394     }
00395   
00396   return *this;
00397   }

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

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

Definition at line 405 of file Mat_meat.hpp.

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

00406   {
00407   arma_extra_debug_sigprint();
00408   
00409         eT* local_ptr    = memptr();
00410   const u32 local_n_elem = n_elem;
00411     
00412   u32 i,j;
00413   
00414   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00415     {
00416     local_ptr[i] /= val;
00417     local_ptr[j] /= val;
00418     }
00419   
00420   if(i < local_n_elem)
00421     {
00422     local_ptr[i] /= val;
00423     }
00424   
00425   return *this;
00426   }

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

construct a matrix from a given matrix

Definition at line 433 of file Mat_meat.hpp.

References Mat< eT >::init().

00434   : n_rows(0)
00435   , n_cols(0)
00436   , n_elem(0)
00437   , use_aux_mem(false)
00438   //, mem(0)
00439   , mem(mem)
00440   {
00441   arma_extra_debug_sigprint(arma_boost::format("this = %x   in_mat = %x") % this % &in_mat);
00442   
00443   init(in_mat);
00444   }

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

construct a matrix from a given matrix

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 452 of file Mat_meat.hpp.

References Mat< eT >::init().

00453   {
00454   arma_extra_debug_sigprint();
00455   
00456   init(x);
00457   return *this;
00458   }

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

construct a matrix from a given matrix

Definition at line 466 of file Mat_meat.hpp.

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

00467   {
00468   arma_extra_debug_sigprint();
00469   
00470   if(this != &x)
00471     {
00472     init(x.n_rows, x.n_cols);
00473     syslib::copy_elem( memptr(), x.mem, n_elem );
00474     }
00475   }

template<typename eT>
Mat< eT >::Mat ( eT *  aux_mem,
const u32  aux_n_rows,
const u32  aux_n_cols,
const bool  copy_aux_mem = true 
) [inline, inherited]

construct a matrix 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). the default is to copy the array.

Definition at line 486 of file Mat_meat.hpp.

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

00487   : n_rows     (copy_aux_mem ? 0     : aux_n_rows           )
00488   , n_cols     (copy_aux_mem ? 0     : aux_n_cols           )
00489   , n_elem     (copy_aux_mem ? 0     : aux_n_rows*aux_n_cols)
00490   , use_aux_mem(copy_aux_mem ? false : true                 )
00491   , mem        (copy_aux_mem ? mem   : aux_mem              )
00492   {
00493   arma_extra_debug_sigprint_this(this);
00494   
00495   if(copy_aux_mem == true)
00496     {
00497     init(aux_n_rows, aux_n_cols);
00498     syslib::copy_elem( memptr(), aux_mem, n_elem );
00499     }
00500   }

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

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

Definition at line 508 of file Mat_meat.hpp.

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

00509   : n_rows(0)
00510   , n_cols(0)
00511   , n_elem(0)
00512   , use_aux_mem(false)
00513   //, mem(0)
00514   , mem(mem)
00515   {
00516   arma_extra_debug_sigprint_this(this);
00517   
00518   init(aux_n_rows, aux_n_cols);
00519   syslib::copy_elem( memptr(), aux_mem, n_elem );
00520   }

template<typename eT>
Mat< eT >::Mat ( const char  junk,
const eT *  aux_mem,
const u32  aux_n_rows,
const u32  aux_n_cols 
) [inline, protected, inherited]

DANGEROUS! Construct a temporary matrix, using auxiliary memory. This constructor is NOT intended for usage by user code. Its sole purpose is to be used by the Cube class.

Definition at line 530 of file Mat_meat.hpp.

00531   : n_rows     (aux_n_rows           )
00532   , n_cols     (aux_n_cols           )
00533   , n_elem     (aux_n_rows*aux_n_cols)
00534   , use_aux_mem(true                 )
00535   , mem        (aux_mem              )
00536   {
00537   arma_extra_debug_sigprint_this(this);
00538   }

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

in-place matrix addition

Definition at line 546 of file Mat_meat.hpp.

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

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

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

in-place matrix subtraction

Definition at line 579 of file Mat_meat.hpp.

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

00580   {
00581   arma_extra_debug_sigprint();
00582   
00583   arma_debug_assert_same_size(*this, m, "matrix subtraction");
00584   
00585   const u32 local_n_elem = m.n_elem;
00586   
00587         eT* out_mem = (*this).memptr();
00588   const eT* m_mem   = m.memptr();
00589   
00590   u32 i,j;
00591   
00592   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00593     {
00594     out_mem[i] -= m_mem[i];
00595     out_mem[j] -= m_mem[j];
00596     }
00597   
00598   if(i < local_n_elem)
00599     {
00600     out_mem[i] -= m_mem[i];
00601     }
00602   
00603   return *this;
00604   }

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

in-place matrix multiplication

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 612 of file Mat_meat.hpp.

References glue_times::apply_inplace().

00613   {
00614   arma_extra_debug_sigprint();
00615   
00616   glue_times::apply_inplace(*this, m);
00617   return *this;
00618   }

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

in-place element-wise matrix multiplication

Definition at line 626 of file Mat_meat.hpp.

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

00627   {
00628   arma_extra_debug_sigprint();
00629   
00630   arma_debug_assert_same_size(*this, m, "element-wise matrix multplication");
00631   
00632   const u32 local_n_elem = m.n_elem;
00633   
00634         eT* out_mem = (*this).memptr();
00635   const eT* m_mem   = m.memptr();
00636   
00637   u32 i,j;
00638   
00639   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00640     {
00641     out_mem[i] *= m_mem[i];
00642     out_mem[j] *= m_mem[j];
00643     }
00644   
00645   if(i < local_n_elem)
00646     {
00647     out_mem[i] *= m_mem[i];
00648     }
00649   
00650   return *this;
00651   }

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

in-place element-wise matrix division

Definition at line 659 of file Mat_meat.hpp.

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

00660   {
00661   arma_extra_debug_sigprint();
00662   
00663   arma_debug_assert_same_size(*this, m, "element-wise matrix division");
00664   
00665   const u32 local_n_elem = m.n_elem;
00666   
00667         eT* out_mem = (*this).memptr();
00668   const eT* m_mem   = m.memptr();
00669   
00670   u32 i,j;
00671   
00672   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
00673     {
00674     out_mem[i] /= m_mem[i];
00675     out_mem[j] /= m_mem[j];
00676     }
00677   
00678   if(i < local_n_elem)
00679     {
00680     out_mem[i] /= m_mem[i];
00681     }
00682   
00683   return *this;
00684   }

template<typename eT>
template<typename T1 , typename T2 >
Mat< eT >::Mat ( const Base< typename Mat< eT >::pod_type, T1 > &  A,
const Base< typename Mat< eT >::pod_type, T2 > &  B 
) [inline, inherited]

for constructing a complex matrix out of two non-complex matrices

< 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 693 of file Mat_meat.hpp.

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

00697   : n_rows(0)
00698   , n_cols(0)
00699   , n_elem(0)
00700   , use_aux_mem(false)
00701   //, mem(0)
00702   , mem(mem)
00703   {
00704   arma_extra_debug_sigprint_this(this);
00705   
00706   arma_type_check< is_complex<eT>::value == false >::apply();   //!< compile-time abort if eT isn't std::complex
00707   
00708   typedef typename T1::elem_type T;
00709   arma_type_check< is_complex<T>::value == true >::apply();   //!< compile-time abort if T is std::complex
00710   
00711   isnt_same_type<std::complex<T>, eT>::check();   //!< compile-time abort if types are not compatible
00712   
00713   const unwrap<T1> tmp_A(A.get_ref());
00714   const unwrap<T2> tmp_B(B.get_ref());
00715   
00716   const Mat<T>& X = tmp_A.M;
00717   const Mat<T>& Y = tmp_B.M;
00718   
00719   arma_assert_same_size(X, Y, "Mat()");
00720   
00721   init(X.n_rows, Y.n_cols);
00722   
00723   const T* X_mem = X.mem;
00724   const T* Y_mem = Y.mem;
00725   
00726   for(u32 i=0; i<n_elem; ++i)
00727     {
00728     access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]);
00729     }
00730   }

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

construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation)

Definition at line 737 of file Mat_meat.hpp.

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

00738   : n_rows(0)
00739   , n_cols(0)
00740   , n_elem(0)
00741   , use_aux_mem(false)
00742   //, mem(0)
00743   , mem(mem)
00744   {
00745   arma_extra_debug_sigprint_this(this);
00746   
00747   this->operator=(X);
00748   }

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

construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation)

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 756 of file Mat_meat.hpp.

00757   {
00758   arma_extra_debug_sigprint();
00759   
00760   subview<eT>::extract(*this, X);
00761   return *this;
00762   }

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

in-place matrix addition (using a submatrix on the right-hand-side)

Definition at line 769 of file Mat_meat.hpp.

00770   {
00771   arma_extra_debug_sigprint();
00772   
00773   subview<eT>::plus_inplace(*this, X);
00774   return *this;
00775   }

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

in-place matrix subtraction (using a submatrix on the right-hand-side)

Definition at line 782 of file Mat_meat.hpp.

00783   {
00784   arma_extra_debug_sigprint();
00785   
00786   subview<eT>::minus_inplace(*this, X);
00787   return *this;
00788   }

template<typename eT>
const Mat< eT > & Mat< eT >::operator*= ( const subview< eT > &  X  )  [inline, inherited]

in-place matrix mutiplication (using a submatrix on the right-hand-side)

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 796 of file Mat_meat.hpp.

References glue_times::apply_inplace().

00797   {
00798   arma_extra_debug_sigprint();
00799   
00800   glue_times::apply_inplace(*this, X);
00801   return *this;
00802   }

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

in-place element-wise matrix mutiplication (using a submatrix on the right-hand-side)

Definition at line 810 of file Mat_meat.hpp.

00811   {
00812   arma_extra_debug_sigprint();
00813   
00814   subview<eT>::schur_inplace(*this, X);
00815   return *this;
00816   }

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

in-place element-wise matrix division (using a submatrix on the right-hand-side)

Definition at line 824 of file Mat_meat.hpp.

00825   {
00826   arma_extra_debug_sigprint();
00827   
00828   subview<eT>::div_inplace(*this, X);
00829   return *this;
00830   }

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

construct a matrix from a subview_cube instance

Definition at line 837 of file Mat_meat.hpp.

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

00838   : n_rows(0)
00839   , n_cols(0)
00840   , n_elem(0)
00841   , use_aux_mem(false)
00842   //, mem(0)
00843   , mem(mem)
00844   {
00845   arma_extra_debug_sigprint_this(this);
00846   
00847   this->operator=(x);
00848   }

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

construct a matrix from a subview_cube instance

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 856 of file Mat_meat.hpp.

00857   {
00858   arma_extra_debug_sigprint();
00859   
00860   subview_cube<eT>::extract(*this, X);
00861   return *this;
00862   }

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

in-place matrix addition (using a single-slice subcube on the right-hand-side)

Definition at line 870 of file Mat_meat.hpp.

00871   {
00872   arma_extra_debug_sigprint();
00873 
00874   subview_cube<eT>::plus_inplace(*this, X);
00875   return *this;
00876   }

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

in-place matrix subtraction (using a single-slice subcube on the right-hand-side)

Definition at line 884 of file Mat_meat.hpp.

00885   {
00886   arma_extra_debug_sigprint();
00887   
00888   subview_cube<eT>::minus_inplace(*this, X);
00889   return *this;
00890   }

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

in-place matrix mutiplication (using a single-slice subcube on the right-hand-side)

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 898 of file Mat_meat.hpp.

References glue_times::apply_inplace().

00899   {
00900   arma_extra_debug_sigprint();
00901 
00902   const Mat<eT> tmp(X);
00903   glue_times::apply_inplace(*this, tmp);
00904   return *this;
00905   }

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

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

Definition at line 913 of file Mat_meat.hpp.

00914   {
00915   arma_extra_debug_sigprint();
00916   
00917   subview_cube<eT>::schur_inplace(*this, X);
00918   return *this;
00919   }

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

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

Definition at line 927 of file Mat_meat.hpp.

00928   {
00929   arma_extra_debug_sigprint();
00930   
00931   subview_cube<eT>::div_inplace(*this, X);
00932   return *this;
00933   }

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

construct a matrix from diagview (e.g. construct a matrix from a delayed diag operation)

Definition at line 940 of file Mat_meat.hpp.

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

00941   : n_rows(0)
00942   , n_cols(0)
00943   , n_elem(0)
00944   , use_aux_mem(false)
00945   //, mem(0)
00946   , mem(mem)
00947   {
00948   arma_extra_debug_sigprint_this(this);
00949   
00950   this->operator=(X);
00951   }

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

construct a matrix from diagview (e.g. construct a matrix from a delayed diag operation)

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 959 of file Mat_meat.hpp.

00960   {
00961   arma_extra_debug_sigprint();
00962   
00963   diagview<eT>::extract(*this, X);
00964   return *this;
00965   }

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

in-place matrix addition (using a diagview on the right-hand-side)

Definition at line 973 of file Mat_meat.hpp.

00974   {
00975   arma_extra_debug_sigprint();
00976   
00977   diagview<eT>::plus_inplace(*this, X);
00978   return *this;
00979   }

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

in-place matrix subtraction (using a diagview on the right-hand-side)

Definition at line 986 of file Mat_meat.hpp.

00987   {
00988   arma_extra_debug_sigprint();
00989   
00990   diagview<eT>::minus_inplace(*this, X);
00991   return *this;
00992   }

template<typename eT>
const Mat< eT > & Mat< eT >::operator*= ( const diagview< eT > &  X  )  [inline, inherited]

in-place matrix mutiplication (using a diagview on the right-hand-side)

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1000 of file Mat_meat.hpp.

References glue_times::apply_inplace().

01001   {
01002   arma_extra_debug_sigprint();
01003   
01004   glue_times::apply_inplace(*this, X);
01005   return *this;
01006   }

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

in-place element-wise matrix mutiplication (using a diagview on the right-hand-side)

Definition at line 1014 of file Mat_meat.hpp.

01015   {
01016   arma_extra_debug_sigprint();
01017   
01018   diagview<eT>::schur_inplace(*this, X);
01019   return *this;
01020   }

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

in-place element-wise matrix division (using a diagview on the right-hand-side)

Definition at line 1028 of file Mat_meat.hpp.

01029   {
01030   arma_extra_debug_sigprint();
01031   
01032   diagview<eT>::div_inplace(*this, X);
01033   return *this;
01034   }

template<typename eT >
arma_inline subview_row< eT > Mat< eT >::row ( const u32  row_num  )  [inline, inherited]

creation of subview (row vector)

Reimplemented in Col< eT >.

Definition at line 1042 of file Mat_meat.hpp.

References Mat< eT >::n_rows.

Referenced by op_shuffle::apply(), op_flipud::apply(), Mat< eT >::init(), diskio::load_arma_ascii(), diskio::load_pgm_binary(), diskio::load_ppm_binary(), diskio::load_raw_ascii(), diskio::load_std_string(), diskio::save_arma_ascii(), diskio::save_pgm_binary(), diskio::save_ppm_binary(), diskio::save_raw_ascii(), diskio::save_std_string(), and Mat< eT >::swap_cols().

01043   {
01044   arma_extra_debug_sigprint();
01045   
01046   arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" );
01047   
01048   return subview_row<eT>(*this, row_num);
01049   }

template<typename eT >
arma_inline const subview_row< eT > Mat< eT >::row ( const u32  row_num  )  const [inline, inherited]

creation of subview (row vector)

Reimplemented in Col< eT >.

Definition at line 1057 of file Mat_meat.hpp.

References Mat< eT >::n_rows.

01058   {
01059   arma_extra_debug_sigprint();
01060   
01061   arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" );
01062   
01063   return subview_row<eT>(*this, row_num);
01064   }

template<typename eT >
arma_inline subview_col< eT > Mat< eT >::col ( const u32  col_num  )  [inline, inherited]

creation of subview (column vector)

Reimplemented in Row< eT >.

Definition at line 1072 of file Mat_meat.hpp.

References Mat< eT >::n_cols.

Referenced by op_shuffle::apply(), op_fliplr::apply(), Mat< eT >::init(), diskio::load_arma_ascii(), diskio::load_pgm_binary(), diskio::load_ppm_binary(), diskio::load_raw_ascii(), diskio::load_std_string(), diskio::save_arma_ascii(), diskio::save_pgm_binary(), diskio::save_ppm_binary(), diskio::save_raw_ascii(), diskio::save_std_string(), and Mat< eT >::swap_rows().

01073   {
01074   arma_extra_debug_sigprint();
01075   
01076   arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds");
01077   
01078   return subview_col<eT>(*this, col_num);
01079   }

template<typename eT >
arma_inline const subview_col< eT > Mat< eT >::col ( const u32  col_num  )  const [inline, inherited]

creation of subview (column vector)

Reimplemented in Row< eT >.

Definition at line 1087 of file Mat_meat.hpp.

References Mat< eT >::n_cols.

01088   {
01089   arma_extra_debug_sigprint();
01090   
01091   arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds");
01092   
01093   return subview_col<eT>(*this, col_num);
01094   }

template<typename eT >
arma_inline subview< eT > Mat< eT >::rows ( const u32  in_row1,
const u32  in_row2 
) [inline, inherited]

creation of subview (submatrix comprised of specified row vectors)

Reimplemented in Col< eT >.

Definition at line 1102 of file Mat_meat.hpp.

References Mat< eT >::n_cols, and Mat< eT >::n_rows.

Referenced by find().

01103   {
01104   arma_extra_debug_sigprint();
01105   
01106   arma_debug_check
01107     (
01108     (in_row1 > in_row2) || (in_row2 >= n_rows),
01109     "Mat::rows(): indices out of bounds or incorrectly used"
01110     );
01111   
01112   return subview<eT>(*this, in_row1, 0, in_row2, ((n_cols>0) ? n_cols-1 : 0) );
01113   }

template<typename eT >
arma_inline const subview< eT > Mat< eT >::rows ( const u32  in_row1,
const u32  in_row2 
) const [inline, inherited]

creation of subview (submatrix comprised of specified row vectors)

Reimplemented in Col< eT >.

Definition at line 1121 of file Mat_meat.hpp.

References Mat< eT >::n_cols, and Mat< eT >::n_rows.

01122   {
01123   arma_extra_debug_sigprint();
01124   
01125   arma_debug_check
01126     (
01127     (in_row1 > in_row2) || (in_row2 >= n_rows),
01128     "Mat::rows(): indices out of bounds or incorrectly used"
01129     );
01130   
01131   return subview<eT>(*this, in_row1, 0, in_row2, ((n_cols>0) ? n_cols-1 : 0) );
01132   }

template<typename eT >
arma_inline subview< eT > Mat< eT >::cols ( const u32  in_col1,
const u32  in_col2 
) [inline, inherited]

creation of subview (submatrix comprised of specified column vectors)

Reimplemented in Row< eT >.

Definition at line 1140 of file Mat_meat.hpp.

References Mat< eT >::n_cols, and Mat< eT >::n_rows.

Referenced by op_pinv::direct_pinv(), and op_princomp::direct_princomp().

01141   {
01142   arma_extra_debug_sigprint();
01143   
01144   arma_debug_check
01145     (
01146     (in_col1 > in_col2) || (in_col2 >= n_cols),
01147     "Mat::cols(): indices out of bounds or incorrectly used"
01148     );
01149   
01150   return subview<eT>(*this, 0, in_col1, ((n_rows>0) ? n_rows-1 : 0), in_col2);
01151   }

template<typename eT >
arma_inline const subview< eT > Mat< eT >::cols ( const u32  in_col1,
const u32  in_col2 
) const [inline, inherited]

creation of subview (submatrix comprised of specified column vectors)

Reimplemented in Row< eT >.

Definition at line 1159 of file Mat_meat.hpp.

References Mat< eT >::n_cols, and Mat< eT >::n_rows.

01160   {
01161   arma_extra_debug_sigprint();
01162   
01163   arma_debug_check
01164     (
01165     (in_col1 > in_col2) || (in_col2 >= n_cols),
01166     "Mat::cols(): indices out of bounds or incorrectly used"
01167     );
01168   
01169   return subview<eT>(*this, 0, in_col1, ((n_rows>0) ? n_rows-1 : 0), in_col2);
01170   }

template<typename eT >
arma_inline subview< eT > Mat< eT >::submat ( const u32  in_row1,
const u32  in_col1,
const u32  in_row2,
const u32  in_col2 
) [inline, inherited]

creation of subview (submatrix)

Definition at line 1178 of file Mat_meat.hpp.

References Mat< eT >::n_cols, and Mat< eT >::n_rows.

Referenced by op_repmat::apply(), glue_join::apply(), and glue_kron::direct_kron().

01179   {
01180   arma_extra_debug_sigprint();
01181   
01182   arma_debug_check
01183     (
01184     (in_row1 > in_row2) || (in_col1 >  in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
01185     "Mat::submat(): indices out of bounds or incorrectly used"
01186     );
01187   
01188   return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2);
01189   }

template<typename eT >
arma_inline const subview< eT > Mat< eT >::submat ( const u32  in_row1,
const u32  in_col1,
const u32  in_row2,
const u32  in_col2 
) const [inline, inherited]

creation of subview (generic submatrix)

Definition at line 1197 of file Mat_meat.hpp.

References Mat< eT >::n_cols, and Mat< eT >::n_rows.

01198   {
01199   arma_extra_debug_sigprint();
01200   
01201   arma_debug_check
01202     (
01203     (in_row1 > in_row2) || (in_col1 >  in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
01204     "Mat::submat(): indices out of bounds or incorrectly used"
01205     );
01206     
01207   return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2);
01208   }

template<typename eT >
arma_inline diagview< eT > Mat< eT >::diag ( const s32  in_id = 0  )  [inline, inherited]

creation of diagview (diagonal)

Definition at line 1216 of file Mat_meat.hpp.

References min(), Mat< eT >::n_cols, and Mat< eT >::n_rows.

Referenced by op_diagvec::apply().

01217   {
01218   arma_extra_debug_sigprint();
01219   
01220   const u32 row_offset = (in_id < 0) ? -in_id : 0;
01221   const u32 col_offset = (in_id > 0) ?  in_id : 0;
01222   
01223   arma_debug_check
01224     (
01225     (row_offset >= n_rows) || (col_offset >= n_cols),
01226     "Mat::diag(): requested diagonal out of bounds"
01227     );
01228   
01229   const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
01230   
01231   return diagview<eT>(*this, row_offset, col_offset, len);
01232   }

template<typename eT >
arma_inline const diagview< eT > Mat< eT >::diag ( const s32  in_id = 0  )  const [inline, inherited]

creation of diagview (diagonal)

Definition at line 1240 of file Mat_meat.hpp.

References min(), Mat< eT >::n_cols, and Mat< eT >::n_rows.

01241   {
01242   arma_extra_debug_sigprint();
01243   
01244   const u32 row_offset = (in_id < 0) ? -in_id : 0;
01245   const u32 col_offset = (in_id > 0) ?  in_id : 0;
01246   
01247   arma_debug_check
01248     (
01249     (row_offset >= n_rows) || (col_offset >= n_cols),
01250     "Mat::diag(): requested diagonal out of bounds"
01251     );
01252   
01253   
01254   const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
01255   
01256   return diagview<eT>(*this, row_offset, col_offset, len);
01257   }

template<typename eT >
void Mat< eT >::swap_rows ( const u32  in_row1,
const u32  in_row2 
) [inline, inherited]

Definition at line 1264 of file Mat_meat.hpp.

References Mat< eT >::col(), Mat< eT >::mem, Mat< eT >::n_cols, Mat< eT >::n_rows, and access::rw().

Referenced by op_shuffle::apply(), op_flipud::apply(), and auxlib::lu().

01265   {
01266   arma_extra_debug_sigprint();
01267   
01268   arma_debug_check
01269     (
01270     (in_row1 >= n_rows) || (in_row2 >= n_rows),
01271     "Mat::swap_rows(): out of bounds"
01272     );
01273   
01274   for(u32 col=0; col<n_cols; ++col)
01275     {
01276     const u32 offset = col*n_rows;
01277     const u32 pos1   = in_row1 + offset;
01278     const u32 pos2   = in_row2 + offset;
01279     
01280     const eT tmp          = mem[pos1];
01281     access::rw(mem[pos1]) = mem[pos2];
01282     access::rw(mem[pos2]) = tmp;
01283     }
01284   
01285   }

template<typename eT >
void Mat< eT >::swap_cols ( const u32  in_col1,
const u32  in_col2 
) [inline, inherited]

Definition at line 1292 of file Mat_meat.hpp.

References Mat< eT >::colptr(), Mat< eT >::n_cols, Mat< eT >::n_rows, and Mat< eT >::row().

Referenced by op_shuffle::apply(), and op_fliplr::apply().

01293   {
01294   arma_extra_debug_sigprint();
01295   
01296   arma_debug_check
01297     (
01298     (in_col1 >= n_cols) || (in_col2 >= n_cols),
01299     "Mat::swap_cols(): out of bounds"
01300     );
01301   
01302   eT* ptr1 = colptr(in_col1);
01303   eT* ptr2 = colptr(in_col2);
01304   
01305   for(u32 row=0; row<n_rows; ++row)
01306     {
01307     const eT tmp = ptr1[row];
01308     ptr1[row]    = ptr2[row];
01309     ptr2[row]    = tmp;
01310     }
01311   
01312   }

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

create a matrix from Op, i.e. run the previously delayed unary operations

Definition at line 1320 of file Mat_meat.hpp.

01321   : n_rows(0)
01322   , n_cols(0)
01323   , n_elem(0)
01324   , use_aux_mem(false)
01325   //, mem(0)
01326   , mem(mem)
01327   {
01328   arma_extra_debug_sigprint_this(this);
01329 
01330   isnt_same_type<eT, typename T1::elem_type>::check();
01331   
01332   op_type::apply(*this, X);
01333   }

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

create a matrix from Op, i.e. run the previously delayed unary operations

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1342 of file Mat_meat.hpp.

01343   {
01344   arma_extra_debug_sigprint();
01345 
01346   isnt_same_type<eT, typename T1::elem_type>::check();
01347   
01348   op_type::apply(*this, X);
01349   
01350   return *this;
01351   }

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

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

Definition at line 1360 of file Mat_meat.hpp.

01361   {
01362   arma_extra_debug_sigprint();
01363   
01364   isnt_same_type<eT, typename T1::elem_type>::check();
01365   
01366   const Mat<eT> m(X);
01367   
01368   return (*this).operator+=(m);
01369   }

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

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

Definition at line 1378 of file Mat_meat.hpp.

01379   {
01380   arma_extra_debug_sigprint();
01381   
01382   isnt_same_type<eT, typename T1::elem_type>::check();
01383   
01384   const Mat<eT> m(X);
01385   
01386   return (*this).operator-=(m);
01387   }

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

in-place matrix multiplication, with the right-hand-side operand having delayed operations

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1396 of file Mat_meat.hpp.

References glue_times::apply_inplace().

01397   {
01398   arma_extra_debug_sigprint();
01399   
01400   isnt_same_type<eT, typename T1::elem_type>::check();
01401   
01402   glue_times::apply_inplace(*this, X);
01403   
01404   return *this;
01405   }

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

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

Definition at line 1414 of file Mat_meat.hpp.

01415   {
01416   arma_extra_debug_sigprint();
01417   
01418   isnt_same_type<eT, typename T1::elem_type>::check();
01419   
01420   const Mat<eT> m(X);
01421   
01422   return (*this).operator%=(m);
01423   }

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

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

Definition at line 1432 of file Mat_meat.hpp.

01433   {
01434   arma_extra_debug_sigprint();
01435   
01436   isnt_same_type<eT, typename T1::elem_type>::check();
01437   
01438   const Mat<eT> m(X);
01439   
01440   return (*this).operator/=(m);
01441   }

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

create a matrix from eOp, i.e. run the previously delayed unary operations

Definition at line 1449 of file Mat_meat.hpp.

01450   : n_rows(0)
01451   , n_cols(0)
01452   , n_elem(0)
01453   , use_aux_mem(false)
01454   //, mem(0)
01455   , mem(mem)
01456   {
01457   arma_extra_debug_sigprint_this(this);
01458 
01459   isnt_same_type<eT, typename T1::elem_type>::check();
01460   
01461   eop_type::apply(*this, X);
01462   }

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

create a matrix from eOp, i.e. run the previously delayed unary operations

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1471 of file Mat_meat.hpp.

01472   {
01473   arma_extra_debug_sigprint();
01474 
01475   isnt_same_type<eT, typename T1::elem_type>::check();
01476   
01477   eop_type::apply(*this, X);
01478   
01479   return *this;
01480   }

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

Definition at line 1488 of file Mat_meat.hpp.

01489   {
01490   arma_extra_debug_sigprint();
01491 
01492   isnt_same_type<eT, typename T1::elem_type>::check();
01493   
01494   eop_type::apply_inplace_plus(*this, X);
01495   
01496   return *this;
01497   }

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

Definition at line 1505 of file Mat_meat.hpp.

01506   {
01507   arma_extra_debug_sigprint();
01508 
01509   isnt_same_type<eT, typename T1::elem_type>::check();
01510   
01511   eop_type::apply_inplace_minus(*this, X);
01512   
01513   return *this;
01514   }

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1522 of file Mat_meat.hpp.

References glue_times::apply_inplace().

01523   {
01524   arma_extra_debug_sigprint();
01525   
01526   isnt_same_type<eT, typename T1::elem_type>::check();
01527   
01528   glue_times::apply_inplace(*this, X);
01529   
01530   return *this;
01531   }

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

Definition at line 1539 of file Mat_meat.hpp.

01540   {
01541   arma_extra_debug_sigprint();
01542 
01543   isnt_same_type<eT, typename T1::elem_type>::check();
01544   
01545   eop_type::apply_inplace_schur(*this, X);
01546   
01547   return *this;
01548   }

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

Definition at line 1556 of file Mat_meat.hpp.

01557   {
01558   arma_extra_debug_sigprint();
01559 
01560   isnt_same_type<eT, typename T1::elem_type>::check();
01561   
01562   eop_type::apply_inplace_div(*this, X);
01563   
01564   return *this;
01565   }

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

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

Definition at line 1573 of file Mat_meat.hpp.

01574   : n_rows(0)
01575   , n_cols(0)
01576   , n_elem(0)
01577   , use_aux_mem(false)
01578   //, mem(0)
01579   , mem(mem)
01580   {
01581   arma_extra_debug_sigprint_this(this);
01582   
01583   isnt_same_type<eT, typename T1::elem_type>::check();
01584   isnt_same_type<eT, typename T2::elem_type>::check();
01585   
01586   glue_type::apply(*this, X);
01587   }

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

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1596 of file Mat_meat.hpp.

01597   {
01598   arma_extra_debug_sigprint();
01599   
01600   isnt_same_type<eT, typename T1::elem_type>::check();
01601   isnt_same_type<eT, typename T2::elem_type>::check();
01602   
01603   glue_type::apply(*this, X);
01604   
01605   return *this;
01606   }

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

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

Definition at line 1615 of file Mat_meat.hpp.

01616   {
01617   arma_extra_debug_sigprint();
01618   
01619   isnt_same_type<eT, typename T1::elem_type>::check();
01620   isnt_same_type<eT, typename T2::elem_type>::check();
01621   
01622   const Mat<eT> m(X);
01623   
01624   return (*this).operator+=(m);
01625   }

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

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

Definition at line 1634 of file Mat_meat.hpp.

01635   {
01636   arma_extra_debug_sigprint();
01637   
01638   isnt_same_type<eT, typename T1::elem_type>::check();
01639   isnt_same_type<eT, typename T2::elem_type>::check();
01640   
01641   const Mat<eT> m(X);
01642   
01643   return (*this).operator-=(m);
01644   }

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

in-place matrix multiplications, with the right-hand-side operands having delayed operations

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1653 of file Mat_meat.hpp.

References glue_times::apply_inplace().

01654   {
01655   arma_extra_debug_sigprint();
01656   
01657   isnt_same_type<eT, typename T1::elem_type>::check();
01658   isnt_same_type<eT, typename T2::elem_type>::check();
01659   
01660   glue_times::apply_inplace(*this, X);
01661   
01662   return *this;
01663   }

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

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

Definition at line 1672 of file Mat_meat.hpp.

01673   {
01674   arma_extra_debug_sigprint();
01675   
01676   isnt_same_type<eT, typename T1::elem_type>::check();
01677   isnt_same_type<eT, typename T2::elem_type>::check();
01678   
01679   const Mat<eT> m(X);
01680   
01681   return (*this).operator%=(m);
01682   }

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

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

Definition at line 1691 of file Mat_meat.hpp.

01692   {
01693   arma_extra_debug_sigprint();
01694   
01695   isnt_same_type<eT, typename T1::elem_type>::check();
01696   isnt_same_type<eT, typename T2::elem_type>::check();
01697   
01698   const Mat<eT> m(X);
01699   
01700   return (*this).operator/=(m);
01701   }

template<typename eT >
template<typename T1 , typename T2 >
const Mat< eT > & Mat< eT >::operator+= ( const Glue< T1, T2, glue_times > &  X  )  [inline, inherited]

Definition at line 1709 of file Mat_meat.hpp.

References glue_times::apply_inplace_plus().

01710   {
01711   arma_extra_debug_sigprint();
01712   
01713   glue_times::apply_inplace_plus(*this, X, s32(+1));
01714   
01715   return *this;
01716   }

template<typename eT >
template<typename T1 , typename T2 >
const Mat< eT > & Mat< eT >::operator-= ( const Glue< T1, T2, glue_times > &  X  )  [inline, inherited]

Definition at line 1724 of file Mat_meat.hpp.

References glue_times::apply_inplace_plus().

01725   {
01726   arma_extra_debug_sigprint();
01727   
01728   glue_times::apply_inplace_plus(*this, X, s32(-1));
01729   
01730   return *this;
01731   }

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

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

Definition at line 1739 of file Mat_meat.hpp.

01740   : n_rows(0)
01741   , n_cols(0)
01742   , n_elem(0)
01743   , use_aux_mem(false)
01744   //, mem(0)
01745   , mem(mem)
01746   {
01747   arma_extra_debug_sigprint_this(this);
01748   
01749   isnt_same_type<eT, typename T1::elem_type>::check();
01750   isnt_same_type<eT, typename T2::elem_type>::check();
01751   
01752   eglue_type::apply(*this, X);
01753   }

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

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1762 of file Mat_meat.hpp.

01763   {
01764   arma_extra_debug_sigprint();
01765   
01766   isnt_same_type<eT, typename T1::elem_type>::check();
01767   isnt_same_type<eT, typename T2::elem_type>::check();
01768   
01769   eglue_type::apply(*this, X);
01770   
01771   return *this;
01772   }

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

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

Definition at line 1781 of file Mat_meat.hpp.

01782   {
01783   arma_extra_debug_sigprint();
01784   
01785   isnt_same_type<eT, typename T1::elem_type>::check();
01786   isnt_same_type<eT, typename T2::elem_type>::check();
01787   
01788   eglue_type::apply_inplace_plus(*this, X);
01789   
01790   return *this;
01791   }

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

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

Definition at line 1800 of file Mat_meat.hpp.

01801   {
01802   arma_extra_debug_sigprint();
01803   
01804   isnt_same_type<eT, typename T1::elem_type>::check();
01805   isnt_same_type<eT, typename T2::elem_type>::check();
01806   
01807   eglue_type::apply_inplace_minus(*this, X);
01808   
01809   return *this;
01810   }

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 1818 of file Mat_meat.hpp.

References glue_times::apply_inplace().

01819   {
01820   arma_extra_debug_sigprint();
01821   
01822   isnt_same_type<eT, typename T1::elem_type>::check();
01823   isnt_same_type<eT, typename T2::elem_type>::check();
01824   
01825   glue_times::apply_inplace(*this, X);
01826   return *this;
01827   }

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

Definition at line 1835 of file Mat_meat.hpp.

01836   {
01837   arma_extra_debug_sigprint();
01838   
01839   isnt_same_type<eT, typename T1::elem_type>::check();
01840   isnt_same_type<eT, typename T2::elem_type>::check();
01841   
01842   eglue_type::apply_inplace_schur(*this, X);
01843   return *this;
01844   }

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

Definition at line 1852 of file Mat_meat.hpp.

01853   {
01854   arma_extra_debug_sigprint();
01855   
01856   isnt_same_type<eT, typename T1::elem_type>::check();
01857   isnt_same_type<eT, typename T2::elem_type>::check();
01858   
01859   eglue_type::apply_inplace_div(*this, X);
01860   return *this;
01861   }

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

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

Definition at line 1869 of file Mat_meat.hpp.

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

01870   {
01871   arma_debug_check( (i >= n_elem), "Mat::operator(): out of bounds");
01872   return access::rw(mem[i]);
01873   }

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

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

Definition at line 1881 of file Mat_meat.hpp.

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

01882   {
01883   arma_debug_check( (i >= n_elem), "Mat::operator(): out of bounds");
01884   return mem[i];
01885   }

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

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

Definition at line 1892 of file Mat_meat.hpp.

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

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

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

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

Definition at line 1903 of file Mat_meat.hpp.

References Mat< eT >::mem.

01904   {
01905   return mem[i];
01906   }

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

element accessor; bounds checking not done when ARMA_NO_DEBUG is defined

Definition at line 1914 of file Mat_meat.hpp.

References Mat< eT >::mem, Mat< eT >::n_cols, Mat< eT >::n_rows, and access::rw().

01915   {
01916   arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator(): out of bounds");
01917   return access::rw(mem[in_row + in_col*n_rows]);
01918   }

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

element accessor; bounds checking not done when ARMA_NO_DEBUG is defined

Definition at line 1926 of file Mat_meat.hpp.

References Mat< eT >::mem, Mat< eT >::n_cols, and Mat< eT >::n_rows.

01927   {
01928   arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator(): out of bounds");
01929   return mem[in_row + in_col*n_rows];
01930   }

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

element accessor; no bounds check

Definition at line 1938 of file Mat_meat.hpp.

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

Referenced by accu(), op_var::apply(), op_trans::apply(), op_sum::apply(), op_stddev::apply(), op_sort::apply(), op_reshape::apply(), op_prod::apply(), op_min::apply(), op_median::apply(), op_mean::apply(), op_max::apply(), op_diagmat::apply(), glue_times_diag::apply(), gemv_arma< do_trans_A, use_alpha, use_beta >::apply(), gemm_mixed_simple< do_trans_A, do_trans_B, use_alpha, use_beta >::apply(), gemm_mixed_cache< do_trans_A, do_trans_B, use_alpha, use_beta >::apply(), gemm_emul_simple< do_trans_A, do_trans_B, use_alpha, use_beta >::apply(), gemm_emul_cache< do_trans_A, do_trans_B, use_alpha, use_beta >::apply(), op_inv::apply_diag(), glue_times::apply_inplace(), eop_core< eop_type >::apply_inplace_div(), eop_core< eop_type >::apply_inplace_minus(), eop_core< eop_type >::apply_inplace_plus(), eop_core< eop_type >::apply_inplace_schur(), op_trans::apply_noalias(), eop_core< eop_type >::apply_proxy(), eop_core< eop_type >::apply_unwrap(), diagmat_proxy_check< Col< eT > >::at(), diagmat_proxy_check< Row< eT > >::at(), diagmat_proxy_check< Mat< eT > >::at(), diagmat_proxy_check< T1 >::at(), auxlib::det(), op_dotext::direct_rowvec_diagmat_colvec(), op_dotext::direct_rowvec_invdiagmat_colvec(), op_dotext::direct_rowvec_mat_colvec(), op_dotext::direct_rowvec_transmat_colvec(), diagview< eT >::div_inplace(), eig_gen(), subview< eT >::extract(), diagview< eT >::extract(), diagview< eT >::fill(), Mat< eT >::init(), auxlib::inv_inplace(), auxlib::inv_noalias(), diskio::load_arma_ascii(), diskio::load_pgm_binary(), diskio::load_ppm_binary(), diskio::load_raw_ascii(), auxlib::log_det(), auxlib::lu(), diagview< eT >::minus_inplace(), diagview< eT >::ones(), operator*(), diagview< eT >::operator=(), diagmat_proxy_check< Col< eT > >::operator[](), diagmat_proxy_check< Row< eT > >::operator[](), diagmat_proxy_check< Mat< eT > >::operator[](), diagmat_proxy_check< T1 >::operator[](), diagview< eT >::plus_inplace(), arma_ostream::print(), prod(), auxlib::qr(), diskio::save_arma_ascii(), diskio::save_ppm_binary(), diskio::save_raw_ascii(), diagview< eT >::schur_inplace(), and diagview< eT >::zeros().

01939   {
01940   return access::rw( mem[in_row + in_col*n_rows] );
01941   }

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

element accessor; no bounds check

Definition at line 1949 of file Mat_meat.hpp.

References Mat< eT >::mem, and Mat< eT >::n_rows.

01950   {
01951   return mem[in_row + in_col*n_rows];
01952   }

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

prefix ++

Definition at line 1960 of file Mat_meat.hpp.

References Mat_aux::prefix_pp().

01961   {
01962   Mat_aux::prefix_pp(*this);
01963   return *this;
01964   }

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

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

Definition at line 1972 of file Mat_meat.hpp.

References Mat_aux::postfix_pp().

01973   {
01974   Mat_aux::postfix_pp(*this);
01975   }

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

prefix --

Definition at line 1983 of file Mat_meat.hpp.

References Mat_aux::prefix_mm().

01984   {
01985   Mat_aux::prefix_mm(*this);
01986   return *this;
01987   }

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

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

Definition at line 1995 of file Mat_meat.hpp.

References Mat_aux::postfix_mm().

01996   {
01997   Mat_aux::postfix_mm(*this);
01998   }

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

returns true if the object can be interpreted as a column or row vector

Definition at line 2006 of file Mat_meat.hpp.

References Mat< eT >::n_cols, and Mat< eT >::n_rows.

Referenced by op_shuffle::apply(), op_diagmat::apply(), as_scalar_redirect< 3 >::apply(), as_scalar_diag(), op_cor::direct_cor(), glue_cor::direct_cor(), op_cov::direct_cov(), glue_cov::direct_cov(), and running_stat_vec_aux::update_stats().

02007   {
02008   return ( (n_rows == 1) || (n_cols == 1) );
02009   }

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

returns true if the object has the same number of non-zero rows and columnns

Definition at line 2017 of file Mat_meat.hpp.

References Mat< eT >::n_cols, Mat< eT >::n_elem, and Mat< eT >::n_rows.

Referenced by op_inv::apply(), op_diagmat::apply(), and as_scalar_redirect< 3 >::apply().

02018   {
02019   return ( (n_rows == n_cols) && (n_elem > 0) );
02020   }

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

returns true if all of the elements are finite

Definition at line 2028 of file Mat_meat.hpp.

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

Referenced by op_sort::apply().

02029   {
02030   for(u32 i=0; i<n_elem; ++i)
02031     {
02032     if(arma_isfinite(mem[i]) == false)
02033       {
02034       return false;
02035       }
02036     }
02037 
02038   return true;
02039   }

template<typename eT >
arma_inline eT * Mat< eT >::colptr ( const u32  in_col  )  [inline, inherited]
template<typename eT >
arma_inline const eT * Mat< eT >::colptr ( const u32  in_col  )  const [inline, inherited]

returns a pointer to array of eTs for a specified column; no bounds check

Definition at line 2058 of file Mat_meat.hpp.

References Mat< eT >::mem, and Mat< eT >::n_rows.

02059   {
02060   return & mem[in_col*n_rows];
02061   }

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

returns a pointer to array of eTs used by the matrix

Definition at line 2069 of file Mat_meat.hpp.

References Mat< eT >::mem.

Referenced by abs(), op_trans2::apply(), op_sort::apply(), op_reshape::apply(), op_diagmat::apply(), glue_times::apply(), glue_cross::apply(), gemm< do_trans_A, do_trans_B, use_alpha, use_beta >::apply_blas_type(), eop_core< eop_type >::apply_inplace_div(), eglue_core< eglue_type >::apply_inplace_div(), eop_core< eop_type >::apply_inplace_minus(), eglue_core< eglue_type >::apply_inplace_minus(), glue_times::apply_inplace_plus(), eop_core< eop_type >::apply_inplace_plus(), eglue_core< eglue_type >::apply_inplace_plus(), eop_core< eop_type >::apply_inplace_schur(), eglue_core< eglue_type >::apply_inplace_schur(), op_trans::apply_noalias(), eop_core< eop_type >::apply_proxy(), eglue_core< eglue_type >::apply_proxy(), op_norm_dot::apply_unwrap(), eop_core< eop_type >::apply_unwrap(), eglue_core< eglue_type >::apply_unwrap(), Mat< eT >::begin(), Row< eT >::begin_row(), Col< eT >::begin_row(), subview_cube< eT >::check_overlap(), auxlib::chol(), auxlib::det(), glue_cor::direct_cor(), glue_cov::direct_cov(), diagview< eT >::div_inplace(), auxlib::eig_gen(), auxlib::eig_sym(), Mat< eT >::end(), Row< eT >::end_row(), Col< eT >::end_row(), eps(), subview< eT >::extract(), diagview< eT >::extract(), Mat< eT >::fill(), find(), conv_to< Col< out_eT > >::from(), conv_to< Row< out_eT > >::from(), conv_to< Mat< out_eT > >::from(), Mat< eT >::init(), auxlib::inv_inplace(), auxlib::inv_noalias(), linspace(), diskio::load_arma_binary(), auxlib::log_det(), auxlib::lu(), Mat< eT >::Mat(), diagview< eT >::minus_inplace(), operator!=(), operator%(), Mat< eT >::operator%=(), Mat< eT >::operator*=(), operator+(), Mat< eT >::operator+=(), operator-(), Mat< eT >::operator-=(), operator/(), Mat< eT >::operator/=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), diagview< eT >::plus_inplace(), Mat_aux::postfix_mm(), Mat_aux::postfix_pp(), Mat_aux::prefix_mm(), Mat_aux::prefix_pp(), arma_ostream::print(), prod(), auxlib::qr(), rank(), diagview< eT >::schur_inplace(), auxlib::solve(), auxlib::solve_od(), auxlib::solve_ud(), sort_index(), auxlib::svd(), and running_stat_vec_aux::update_stats().

02070   {
02071   return const_cast<eT*>(mem);
02072   }

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

returns a pointer to array of eTs used by the matrix

Definition at line 2080 of file Mat_meat.hpp.

References Mat< eT >::mem.

02081   {
02082   return mem;
02083   }

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

print contents of the matrix (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 2094 of file Mat_meat.hpp.

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

02095   {
02096   arma_extra_debug_sigprint();
02097   
02098   if(extra_text.length() != 0)
02099     {
02100     const std::streamsize orig_width = cout.width();
02101     
02102     cout << extra_text << '\n';
02103   
02104     cout.width(orig_width);
02105     }
02106   
02107   arma_ostream::print(cout, *this, true);
02108   }

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

print contents of the matrix 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 2119 of file Mat_meat.hpp.

References Mat< eT >::print().

02120   {
02121   arma_extra_debug_sigprint();
02122   
02123   if(extra_text.length() != 0)
02124     {
02125     const std::streamsize orig_width = user_stream.width();
02126     
02127     user_stream << extra_text << '\n';
02128     
02129     user_stream.width(orig_width);
02130     }
02131   
02132   arma_ostream::print(user_stream, *this, true);
02133   }

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

print contents of the transposed version of the matrix (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 2144 of file Mat_meat.hpp.

References op_trans::apply_noalias(), and Mat< eT >::print().

02145   {
02146   arma_extra_debug_sigprint();
02147   
02148   Mat<eT> tmp;
02149   op_trans::apply_noalias(tmp, *this);
02150   
02151   tmp.print(extra_text);
02152   }

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

print contents of the transposed version of matrix 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 2163 of file Mat_meat.hpp.

References op_trans::apply_noalias(), and Mat< eT >::print().

02164   {
02165   arma_extra_debug_sigprint();
02166   
02167   Mat<eT> tmp;
02168   op_trans::apply_noalias(tmp, *this);
02169   
02170   tmp.print(user_stream, extra_text);
02171   }

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

print contents of the matrix (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 2182 of file Mat_meat.hpp.

References Mat< eT >::print().

Referenced by Mat< eT >::raw_print_trans().

02183   {
02184   arma_extra_debug_sigprint();
02185   
02186   if(extra_text.length() != 0)
02187     {
02188     const std::streamsize orig_width = cout.width();
02189     
02190     cout << extra_text << '\n';
02191   
02192     cout.width(orig_width);
02193     }
02194   
02195   arma_ostream::print(cout, *this, false);
02196   }

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

print contents of the matrix 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 2207 of file Mat_meat.hpp.

References Mat< eT >::print().

02208   {
02209   arma_extra_debug_sigprint();
02210   
02211   if(extra_text.length() != 0)
02212     {
02213     const std::streamsize orig_width = user_stream.width();
02214   
02215     user_stream << extra_text << '\n';
02216   
02217     user_stream.width(orig_width);
02218     }
02219   
02220   arma_ostream::print(user_stream, *this, false);
02221   }

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

print contents of the transposed version of the matrix (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 2232 of file Mat_meat.hpp.

References op_trans::apply_noalias(), and Mat< eT >::raw_print().

02233   {
02234   arma_extra_debug_sigprint();
02235   
02236   Mat<eT> tmp;
02237   op_trans::apply_noalias(tmp, *this);
02238   
02239   tmp.raw_print(extra_text);
02240   }

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

print contents of the transposed version of the matrix 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 2251 of file Mat_meat.hpp.

References op_trans::apply_noalias(), and Mat< eT >::raw_print().

02252   {
02253   arma_extra_debug_sigprint();
02254   
02255   Mat<eT> tmp;
02256   op_trans::apply_noalias(tmp, *this);
02257   
02258   tmp.raw_print(user_stream, extra_text);
02259   }

template<typename eT >
void Mat< eT >::set_size ( const u32  in_rows,
const u32  in_cols 
) [inline, inherited]
template<typename eT >
template<typename eT2 >
void Mat< eT >::copy_size ( const Mat< eT2 > &  m  )  [inline, inherited]

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2281 of file Mat_meat.hpp.

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

Referenced by op_sort::apply(), op_shuffle::apply(), op_fliplr::apply(), op_flipud::apply(), and op_princomp::direct_princomp().

02282   {
02283   arma_extra_debug_sigprint();
02284   
02285   init(m.n_rows, m.n_cols);
02286   }

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

fill the matrix with the specified value

Definition at line 2295 of file Mat_meat.hpp.

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

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

02296   {
02297   arma_extra_debug_sigprint();
02298   
02299         eT* local_ptr    = memptr();
02300   const u32 local_n_elem = n_elem;
02301   
02302   u32 i,j;
02303   
02304   for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
02305     {
02306     local_ptr[i] = val;
02307     local_ptr[j] = val;
02308     }
02309   
02310   if(i < local_n_elem)
02311     {
02312     local_ptr[i] = val;
02313     }
02314   }

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2321 of file Mat_meat.hpp.

References Mat< eT >::fill().

Referenced by op_diagmat::apply(), glue_times_diag::apply(), op_pinv::direct_pinv(), op_princomp::direct_princomp(), operator*(), auxlib::solve_ud(), and running_stat_vec_aux::update_stats().

02322   {
02323   arma_extra_debug_sigprint();
02324   
02325   fill(eT(0));
02326   }

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2333 of file Mat_meat.hpp.

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

02334   {
02335   arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d") % in_rows % in_cols );
02336 
02337   set_size(in_rows, in_cols);
02338   fill(eT(0));
02339   }

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2346 of file Mat_meat.hpp.

References Mat< eT >::fill().

02347   {
02348   arma_extra_debug_sigprint();
02349   
02350   fill(eT(1));
02351   }

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

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2358 of file Mat_meat.hpp.

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

02359   {
02360   arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d") % in_rows % in_cols );
02361 
02362   set_size(in_rows, in_cols);
02363   fill(eT(1));
02364   }

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

save the matrix to a file

Definition at line 2384 of file Mat_meat.hpp.

References arma_ascii, arma_binary, arma_stop(), pgm_binary, raw_ascii, diskio::save_arma_ascii(), diskio::save_arma_binary(), diskio::save_pgm_binary(), and diskio::save_raw_ascii().

02385   {
02386   arma_extra_debug_sigprint();
02387   
02388   switch(type)
02389     {
02390     case raw_ascii:
02391       diskio::save_raw_ascii(*this, name);
02392       break;
02393     
02394     case arma_ascii:
02395       diskio::save_arma_ascii(*this, name);
02396       break;
02397     
02398     case arma_binary:
02399       diskio::save_arma_binary(*this, name);
02400       break;
02401       
02402     case pgm_binary:
02403       diskio::save_pgm_binary(*this, name);
02404       break;
02405     
02406     default:
02407       arma_stop("Mat::save(): unsupported file type");
02408     }
02409   
02410   }

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

save the matrix to a stream

Definition at line 2418 of file Mat_meat.hpp.

References arma_ascii, arma_binary, arma_stop(), pgm_binary, raw_ascii, diskio::save_arma_ascii(), diskio::save_arma_binary(), diskio::save_pgm_binary(), and diskio::save_raw_ascii().

02419   {
02420   arma_extra_debug_sigprint();
02421   
02422   switch(type)
02423     {
02424     case raw_ascii:
02425       diskio::save_raw_ascii(*this, "[ostream]", os);
02426       break;
02427     
02428     case arma_ascii:
02429       diskio::save_arma_ascii(*this, "[ostream]", os);
02430       break;
02431     
02432     case arma_binary:
02433       diskio::save_arma_binary(*this, "[ostream]", os);
02434       break;
02435       
02436     case pgm_binary:
02437       diskio::save_pgm_binary(*this, "[ostream]", os);
02438       break;
02439     
02440     default:
02441       arma_stop("Mat::save(): unsupported file type");
02442     }
02443   
02444   }

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

load a matrix from a file

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2452 of file Mat_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_pgm_binary(), diskio::load_raw_ascii(), pgm_binary, and raw_ascii.

02453   {
02454   arma_extra_debug_sigprint();
02455   
02456   switch(type)
02457     {
02458     case auto_detect:
02459       diskio::load_auto_detect(*this, name);
02460       break;
02461     
02462     case raw_ascii:
02463       diskio::load_raw_ascii(*this, name);
02464       break;
02465     
02466     case arma_ascii:
02467       diskio::load_arma_ascii(*this, name);
02468       break;
02469     
02470     case arma_binary:
02471       diskio::load_arma_binary(*this, name);
02472       break;
02473       
02474     case pgm_binary:
02475       diskio::load_pgm_binary(*this, name);
02476       break;
02477     
02478     default:
02479       arma_stop("Mat::load(): unsupported file type");
02480     }
02481   
02482   }

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

load a matrix from a stream

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2490 of file Mat_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_pgm_binary(), diskio::load_raw_ascii(), pgm_binary, and raw_ascii.

02491   {
02492   arma_extra_debug_sigprint();
02493   
02494   switch(type)
02495     {
02496     case auto_detect:
02497       diskio::load_auto_detect(*this, "[istream]", is);
02498       break;
02499     
02500     case raw_ascii:
02501       diskio::load_raw_ascii(*this, "[istream]", is);
02502       break;
02503     
02504     case arma_ascii:
02505       diskio::load_arma_ascii(*this, "[istream]", is);
02506       break;
02507     
02508     case arma_binary:
02509       diskio::load_arma_binary(*this, "[istream]", is);
02510       break;
02511       
02512     case pgm_binary:
02513       diskio::load_pgm_binary(*this, "[istream]", is);
02514       break;
02515     
02516     default:
02517       arma_stop("Mat::load(): unsupported file type");
02518     }
02519   
02520   }

template<typename eT>
Mat< eT >::row_iterator::row_iterator ( Mat< eT > &  in_M,
const u32  in_row 
) [inline, inherited]

Definition at line 2526 of file Mat_meat.hpp.

02527   : M  (in_M  )
02528   , row(in_row)
02529   , col(0     )
02530   {
02531   arma_extra_debug_sigprint();
02532   }

template<typename eT >
eT & Mat< eT >::row_iterator::operator* (  )  [inline, inherited]

Definition at line 2539 of file Mat_meat.hpp.

References Mat< eT >::row_iterator::col, Mat< eT >::row_iterator::M, and Mat< eT >::row_iterator::row.

02540   {
02541   return M.at(row,col);
02542   }

template<typename eT >
Mat< eT >::row_iterator & Mat< eT >::row_iterator::operator++ (  )  [inline, inherited]

Definition at line 2549 of file Mat_meat.hpp.

References Mat< eT >::row_iterator::col, Mat< eT >::row_iterator::M, and Mat< eT >::row_iterator::row.

Referenced by Mat< eT >::row_iterator::operator++().

02550   {
02551   ++col;
02552   
02553   if(col >= M.n_cols)
02554     {
02555     col = 0;
02556     ++row;
02557     }
02558   
02559   return *this;
02560   }

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

Definition at line 2567 of file Mat_meat.hpp.

References Mat< eT >::row_iterator::operator++().

02568   {
02569   operator++();
02570   }

template<typename eT >
Mat< eT >::row_iterator & Mat< eT >::row_iterator::operator-- (  )  [inline, inherited]

Definition at line 2577 of file Mat_meat.hpp.

References Mat< eT >::row_iterator::col, Mat< eT >::row_iterator::M, and Mat< eT >::row_iterator::row.

Referenced by Mat< eT >::row_iterator::operator--().

02578   {
02579   if(col > 0)
02580     {
02581     --col;
02582     }
02583   else
02584     {
02585     if(row > 0)
02586       {
02587       col = M.n_cols - 1;
02588       --row;
02589       }
02590     }
02591   
02592   return *this;
02593   }

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

Definition at line 2600 of file Mat_meat.hpp.

References Mat< eT >::row_iterator::operator--().

02601   {
02602   operator--();
02603   }

template<typename eT>
Mat< eT >::const_row_iterator::const_row_iterator ( const Mat< eT > &  in_M,
const u32  in_row 
) [inline, inherited]

Definition at line 2629 of file Mat_meat.hpp.

02630   : M  (in_M  )
02631   , row(in_row)
02632   , col(0     )
02633   {
02634   arma_extra_debug_sigprint();
02635   }

template<typename eT >
eT Mat< eT >::const_row_iterator::operator* (  )  const [inline, inherited]

Definition at line 2654 of file Mat_meat.hpp.

References Mat< eT >::const_row_iterator::col, Mat< eT >::const_row_iterator::M, and Mat< eT >::const_row_iterator::row.

02655   {
02656   return M.at(row,col);
02657   }

template<typename eT >
Mat< eT >::const_row_iterator & Mat< eT >::const_row_iterator::operator++ (  )  [inline, inherited]

Definition at line 2664 of file Mat_meat.hpp.

References Mat< eT >::const_row_iterator::col, Mat< eT >::const_row_iterator::M, and Mat< eT >::const_row_iterator::row.

Referenced by Mat< eT >::const_row_iterator::operator++().

02665   {
02666   ++col;
02667   
02668   if(col >= M.n_cols)
02669     {
02670     col = 0;
02671     ++row;
02672     }
02673   
02674   return *this;
02675   }

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

Definition at line 2682 of file Mat_meat.hpp.

References Mat< eT >::const_row_iterator::operator++().

02683   {
02684   operator++();
02685   }

template<typename eT >
Mat< eT >::const_row_iterator & Mat< eT >::const_row_iterator::operator-- (  )  [inline, inherited]

Definition at line 2692 of file Mat_meat.hpp.

References Mat< eT >::const_row_iterator::col, Mat< eT >::const_row_iterator::M, and Mat< eT >::const_row_iterator::row.

Referenced by Mat< eT >::const_row_iterator::operator--().

02693   {
02694   if(col > 0)
02695     {
02696     --col;
02697     }
02698   else
02699     {
02700     if(row > 0)
02701       {
02702       col = M.n_cols - 1;
02703       --row;
02704       }
02705     }
02706   
02707   return *this;
02708   }

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

Definition at line 2715 of file Mat_meat.hpp.

References Mat< eT >::const_row_iterator::operator--().

02716   {
02717   operator--();
02718   }

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

Definition at line 2745 of file Mat_meat.hpp.

References Mat< eT >::memptr().

02746   {
02747   arma_extra_debug_sigprint();
02748   
02749   return memptr();
02750   }

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

Definition at line 2757 of file Mat_meat.hpp.

References Mat< eT >::memptr().

02758   {
02759   arma_extra_debug_sigprint();
02760   
02761   return memptr();
02762   }

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

Definition at line 2769 of file Mat_meat.hpp.

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

02770   {
02771   arma_extra_debug_sigprint();
02772   
02773   return memptr() + n_elem;
02774   }

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

Definition at line 2781 of file Mat_meat.hpp.

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

02782   {
02783   arma_extra_debug_sigprint();
02784   
02785   return memptr() + n_elem;
02786   }

template<typename eT >
Mat< eT >::col_iterator Mat< eT >::begin_col ( const u32  col_num  )  [inline, inherited]

Definition at line 2793 of file Mat_meat.hpp.

References Mat< eT >::colptr(), and Mat< eT >::n_cols.

02794   {
02795   arma_extra_debug_sigprint();
02796   
02797   arma_debug_check( (col_num >= n_cols), "begin_col(): index out of bounds");
02798   
02799   return colptr(col_num);
02800   }

template<typename eT >
Mat< eT >::const_col_iterator Mat< eT >::begin_col ( const u32  col_num  )  const [inline, inherited]

Definition at line 2807 of file Mat_meat.hpp.

References Mat< eT >::colptr(), and Mat< eT >::n_cols.

02808   {
02809   arma_extra_debug_sigprint();
02810   
02811   arma_debug_check( (col_num >= n_cols), "begin_col(): index out of bounds");
02812   
02813   return colptr(col_num);
02814   }

template<typename eT >
Mat< eT >::col_iterator Mat< eT >::end_col ( const u32  col_num  )  [inline, inherited]

Definition at line 2821 of file Mat_meat.hpp.

References Mat< eT >::colptr(), Mat< eT >::n_cols, and Mat< eT >::n_rows.

02822   {
02823   arma_extra_debug_sigprint();
02824   
02825   arma_debug_check( (col_num >= n_cols), "end_col(): index out of bounds");
02826   
02827   return colptr(col_num) + n_rows;
02828   }

template<typename eT >
Mat< eT >::const_col_iterator Mat< eT >::end_col ( const u32  col_num  )  const [inline, inherited]

Definition at line 2835 of file Mat_meat.hpp.

References Mat< eT >::colptr(), Mat< eT >::n_cols, and Mat< eT >::n_rows.

02836   {
02837   arma_extra_debug_sigprint();
02838   
02839   arma_debug_check( (col_num >= n_cols), "end_col(): index out of bounds");
02840   
02841   return colptr(col_num) + n_rows;
02842   }

template<typename eT >
Mat< eT >::row_iterator Mat< eT >::begin_row ( const u32  row_num  )  [inline, inherited]

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2849 of file Mat_meat.hpp.

References Mat< eT >::n_rows.

02850   {
02851   arma_extra_debug_sigprint();
02852   
02853   arma_debug_check( (row_num >= n_rows), "Mat::begin_row(): index out of bounds" );
02854   
02855   return typename Mat<eT>::row_iterator(*this, row_num);
02856   }

template<typename eT >
Mat< eT >::const_row_iterator Mat< eT >::begin_row ( const u32  row_num  )  const [inline, inherited]

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2863 of file Mat_meat.hpp.

References Mat< eT >::n_rows.

02864   {
02865   arma_extra_debug_sigprint();
02866   
02867   arma_debug_check( (row_num >= n_rows), "Mat::begin_row(): index out of bounds" );
02868   
02869   return typename Mat<eT>::const_row_iterator(*this, row_num);
02870   }

template<typename eT >
Mat< eT >::row_iterator Mat< eT >::end_row ( const u32  row_num  )  [inline, inherited]

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2877 of file Mat_meat.hpp.

References Mat< eT >::n_rows.

02878   {
02879   arma_extra_debug_sigprint();
02880   
02881   arma_debug_check( (row_num >= n_rows), "Mat::end_row(): index out of bounds" );
02882   
02883   return typename Mat<eT>::row_iterator(*this, row_num + 1);
02884   }

template<typename eT >
Mat< eT >::const_row_iterator Mat< eT >::end_row ( const u32  row_num  )  const [inline, inherited]

Reimplemented in Col< eT >, and Row< eT >.

Definition at line 2891 of file Mat_meat.hpp.

References Mat< eT >::n_rows.

02892   {
02893   arma_extra_debug_sigprint();
02894   
02895   arma_debug_check( (row_num >= n_rows), "Mat::end_row(): index out of bounds" );
02896   
02897   return typename Mat<eT>::const_row_iterator(*this, row_num + 1);
02898   }

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

prefix ++

Definition at line 2906 of file Mat_meat.hpp.

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

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

02907   {
02908         eT* memptr = x.memptr();
02909   const u32 n_elem = x.n_elem;
02910   
02911   u32 i,j;
02912 
02913   for(i=0, j=1; j<n_elem; i+=2, j+=2)
02914     {
02915     ++(memptr[i]);
02916     ++(memptr[j]);
02917     }
02918   
02919   if(i < n_elem)
02920     {
02921     ++(memptr[i]);
02922     }
02923   }

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

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

Definition at line 2931 of file Mat_meat.hpp.

02932   {
02933   x += T(1);
02934   }

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

postfix ++

Definition at line 2942 of file Mat_meat.hpp.

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

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

02943   {
02944         eT* memptr = x.memptr();
02945   const u32 n_elem = x.n_elem;
02946   
02947   u32 i,j;
02948   
02949   for(i=0, j=1; j<n_elem; i+=2, j+=2)
02950     {
02951     (memptr[i])++;
02952     (memptr[j])++;
02953     }
02954   
02955   if(i < n_elem)
02956     {
02957     (memptr[i])++;
02958     }
02959   }

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

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

Definition at line 2967 of file Mat_meat.hpp.

02968   {
02969   x += T(1);
02970   }

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

prefix --

Definition at line 2978 of file Mat_meat.hpp.

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

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

02979   {
02980         eT* memptr = x.memptr();
02981   const u32 n_elem = x.n_elem;
02982 
02983   u32 i,j;
02984 
02985   for(i=0, j=1; j<n_elem; i+=2, j+=2)
02986     {
02987     --(memptr[i]);
02988     --(memptr[j]);
02989     }
02990   
02991   if(i < n_elem)
02992     {
02993     --(memptr[i]);
02994     }
02995   }

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

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

Definition at line 3003 of file Mat_meat.hpp.

03004   {
03005   x -= T(1);
03006   }

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

postfix --

Definition at line 3014 of file Mat_meat.hpp.

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

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

03015   {
03016         eT* memptr = x.memptr();
03017   const u32 n_elem = x.n_elem;
03018 
03019   u32 i,j;
03020 
03021   for(i=0, j=1; j<n_elem; i+=2, j+=2)
03022     {
03023     (memptr[i])--;
03024     (memptr[j])--;
03025     }
03026   
03027   if(i < n_elem)
03028     {
03029     (memptr[i])--;
03030     }
03031   }

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

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

Definition at line 3039 of file Mat_meat.hpp.

03040   {
03041   x -= T(1);
03042   }