Mat


Classes

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

Functions

 Mat< eT >::~Mat ()
 Mat< eT >::Mat ()
 Mat< eT >::Mat (const u32 in_rows, const u32 in_cols)
 construct the matrix to have user specified dimensions
void Mat< eT >::set_size (const u32 in_rows, const u32 in_cols)
 change the matrix to have user specified dimensions (data is not preserved)
void Mat< eT >::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< eT >::Mat (const char *text)
 create the matrix from a textual description
const MatMat< eT >::operator= (const char *text)
 create the matrix from a textual description
 Mat< eT >::Mat (const std::string &text)
 create the matrix from a textual description
const MatMat< eT >::operator= (const std::string &text)
 create the matrix from a textual description
void Mat< eT >::init (const std::string &text)
 internal function to create the matrix from a textual description
arma_inline const MatMat< eT >::operator= (const eTval)
 Set the matrix to be equal to the specified scalar. NOTE: the size of the matrix will be 1x1.
arma_inline const MatMat< eT >::operator+= (const eTval)
 In-place addition of a scalar to all elements of the matrix.
arma_inline const MatMat< eT >::operator-= (const eTval)
 In-place subtraction of a scalar from all elements of the matrix.
arma_inline const MatMat< eT >::operator*= (const eTval)
 In-place multiplication of all elements of the matrix with a scalar.
arma_inline const MatMat< eT >::operator/= (const eTval)
 In-place division of all elements of the matrix with a scalar.
 Mat< eT >::Mat (const Mat &m)
 construct a matrix from a given matrix
const MatMat< eT >::operator= (const Mat &m)
 construct a matrix from a given matrix
void Mat< eT >::init (const Mat &x)
 construct a matrix from a given matrix
 Mat< eT >::Mat (const eT *aux_mem, const u32 aux_n_rows, const u32 aux_n_cols)
 construct a matrix from a given auxillary array of eTs
const MatMat< eT >::operator+= (const Mat &m)
 in-place matrix addition
const MatMat< eT >::operator-= (const Mat &m)
 in-place matrix subtraction
const MatMat< eT >::operator*= (const Mat &m)
 in-place matrix multiplication
const MatMat< eT >::operator%= (const Mat &m)
 in-place element-wise matrix multiplication
const MatMat< eT >::operator/= (const Mat &m)
 in-place element-wise matrix division
 Mat< eT >::Mat (const subview< eT > &X)
 construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation)
const MatMat< eT >::operator= (const subview< eT > &X)
 construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation)
const MatMat< eT >::operator+= (const subview< eT > &X)
 in-place matrix addition (using a submatrix on the right-hand-side)
const MatMat< eT >::operator-= (const subview< eT > &X)
 in-place matrix subtraction (using a submatrix on the right-hand-side)
const MatMat< eT >::operator*= (const subview< eT > &X)
 in-place matrix mutiplication (using a submatrix on the right-hand-side)
const MatMat< eT >::operator%= (const subview< eT > &X)
 in-place element-wise matrix mutiplication (using a submatrix on the right-hand-side)
const MatMat< eT >::operator/= (const subview< eT > &X)
 in-place element-wise matrix division (using a submatrix on the right-hand-side)
 Mat< eT >::Mat (const diagview< eT > &X)
 construct a matrix from diagview (e.g. construct a matrix from a delayed diag operation)
const MatMat< eT >::operator= (const diagview< eT > &X)
 construct a matrix from diagview (e.g. construct a matrix from a delayed diag operation)
arma_inline subview_row< eT > Mat< eT >::row (const u32 row_num)
 creation of subview (row vector)
arma_inline const subview_row< eT > Mat< eT >::row (const u32 row_num) const
 creation of subview (row vector)
arma_inline subview_col< eT > Mat< eT >::col (const u32 col_num)
 creation of subview (column vector)
arma_inline const subview_col< eT > Mat< eT >::col (const u32 col_num) const
 creation of subview (column vector)
arma_inline subview< eT > Mat< eT >::rows (const u32 in_row1, const u32 in_row2)
 creation of subview (submatrix comprised of specified row vectors)
arma_inline const subview< eT > Mat< eT >::rows (const u32 in_row1, const u32 in_row2) const
 creation of subview (submatrix comprised of specified row vectors)
arma_inline subview< eT > Mat< eT >::cols (const u32 in_col1, const u32 in_col2)
 creation of subview (submatrix comprised of specified column vectors)
arma_inline const subview< eT > Mat< eT >::cols (const u32 in_col1, const u32 in_col2) const
 creation of subview (submatrix comprised of specified column vectors)
arma_inline subview< eT > Mat< eT >::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< eT >::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< eT >::diag (const s32 in_id=0)
 creation of diagview (diagonal)
arma_inline const diagview< eT > Mat< eT >::diag (const s32 in_id=0) const
 creation of diagview (diagonal)
void Mat< eT >::swap_rows (const u32 in_row1, const u32 in_row2)
void Mat< eT >::swap_cols (const u32 in_col1, const u32 in_col2)
 Mat< eT >::Mat (const Op< T1, op_type > &X)
 create a matrix from Op, i.e. run the previously delayed unary operations
const MatMat< eT >::operator= (const Op< T1, op_type > &X)
 create a matrix from Op, i.e. run the previously delayed unary operations
const MatMat< eT >::operator+= (const Op< T1, op_type > &X)
 in-place matrix addition, with the right-hand-side operand having delayed operations
const MatMat< eT >::operator-= (const Op< T1, op_type > &X)
 in-place matrix subtraction, with the right-hand-side operand having delayed operations
const MatMat< eT >::operator*= (const Op< T1, op_type > &X)
 in-place matrix multiplication, with the right-hand-side operand having delayed operations
const MatMat< eT >::operator%= (const Op< T1, op_type > &X)
 in-place matrix element-wise multiplication, with the right-hand-side operand having delayed operations
const MatMat< eT >::operator/= (const Op< T1, op_type > &X)
 in-place matrix element-wise division, with the right-hand-side operand having delayed operations
 Mat< eT >::Mat (const Glue< T1, T2, glue_type > &X)
 create a matrix from Glue, i.e. run the previously delayed binary operations
const MatMat< eT >::operator= (const Glue< T1, T2, glue_type > &X)
 create a matrix from Glue, i.e. run the previously delayed binary operations
const MatMat< eT >::operator+= (const Glue< T1, T2, glue_type > &X)
 in-place matrix addition, with the right-hand-side operands having delayed operations
const MatMat< eT >::operator-= (const Glue< T1, T2, glue_type > &X)
 in-place matrix subtraction, with the right-hand-side operands having delayed operations
const MatMat< eT >::operator*= (const Glue< T1, T2, glue_type > &X)
 in-place matrix multiplications, with the right-hand-side operands having delayed operations
const MatMat< eT >::operator%= (const Glue< T1, T2, glue_type > &X)
 in-place matrix element-wise multiplication, with the right-hand-side operands having delayed operations
const MatMat< eT >::operator/= (const Glue< T1, T2, glue_type > &X)
 in-place matrix element-wise division, with the right-hand-side operands having delayed operations
arma_inline eT & Mat< eT >::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< eT >::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< eT >::operator[] (const u32 i)
 linear element accessor (treats the matrix as a vector); no bounds check.
arma_inline eT Mat< eT >::operator[] (const u32 i) const
 linear element accessor (treats the matrix as a vector); no bounds check
arma_inline eT & Mat< eT >::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< eT >::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< eT >::at (const u32 in_row, const u32 in_col)
 element accessor; no bounds check
arma_inline eT Mat< eT >::at (const u32 in_row, const u32 in_col) const
 element accessor; no bounds check
arma_inline const MatMat< eT >::operator++ ()
 prefix ++
arma_inline void Mat< eT >::operator++ (int)
 postfix ++ (must not return the object by reference)
arma_inline const MatMat< eT >::operator-- ()
 prefix --
arma_inline void Mat< eT >::operator-- (int)
 postfix -- (must not return the object by reference)
arma_inline bool Mat< eT >::is_vec () const
 returns true if the object can be interpreted as a column or row vector
arma_inline bool Mat< eT >::is_square () const
 returns true if the object has the same number of non-zero rows and columnns
arma_inline bool Mat< eT >::is_finite () const
 returns true if all of the elements are finite
arma_inline eT * Mat< eT >::colptr (const u32 in_col)
 returns a pointer to array of eTs for a specified column; no bounds check
arma_inline const eT * Mat< eT >::colptr (const u32 in_col) const
 returns a pointer to array of eTs for a specified column; no bounds check
arma_inline eT * Mat< eT >::memptr ()
 returns a pointer to array of eTs used by the matrix
arma_inline const eT * Mat< eT >::memptr () const
 returns a pointer to array of eTs used by the matrix
void Mat< eT >::print (const std::string extra_text="") const
 print contents of the matrix, optionally preceding with a user specified line of text
void Mat< eT >::fill (const eTval)
 fill the matrix with the specified value
void Mat< eT >::zeros ()
void Mat< eT >::zeros (const u32 in_rows, const u32 in_cols)
void Mat< eT >::reset ()
void Mat< eT >::save (const std::string name, const file_type type=arma_binary) const
 save the matrix to a file
void Mat< eT >::load (const std::string name, const file_type type=auto_detect)
 load a matrix from a file
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

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

Definition at line 22 of file Mat_meat.hpp.

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

00023   {
00024   arma_extra_debug_sigprint_this(this);
00025   
00026   if(n_elem > sizeof(mem_local)/sizeof(eT) )
00027     {
00028     delete [] mem;
00029     }
00030     
00031   if(arma_config::debug == true)
00032     {
00033     access::rw(mem) = 0;  // try to expose buggy code that still accesses deleted objects
00034     }
00035   
00036   isnt_supported_elem_type<eT>::check();
00037   }

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

Definition at line 43 of file Mat_meat.hpp.

00044   : n_rows(0)
00045   , n_cols(0)
00046   , n_elem(0)
00047   //, mem(0)
00048   , mem(mem)
00049   {
00050   arma_extra_debug_sigprint_this(this);
00051   }

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

Definition at line 57 of file Mat_meat.hpp.

References Mat< eT >::init().

00058   : n_rows(0)
00059   , n_cols(0)
00060   , n_elem(0)
00061   //, mem(0)
00062   , mem(mem)
00063   {
00064   arma_extra_debug_sigprint_this(this);
00065   
00066   init(in_n_rows, in_n_cols);
00067   }

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

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

Definition at line 75 of file Mat_meat.hpp.

References Mat< eT >::init().

00076   {
00077   arma_extra_debug_sigprint(arma_boost::format("in_n_rows = %d, in_n_cols = %d") % in_n_rows % in_n_cols);
00078   
00079   init(in_n_rows,in_n_cols);
00080   }

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

Definition at line 87 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, and access::rw().

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

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

Definition at line 138 of file Mat_meat.hpp.

References Mat< eT >::init().

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

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

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

Definition at line 156 of file Mat_meat.hpp.

References Mat< eT >::init().

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

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

Definition at line 169 of file Mat_meat.hpp.

References Mat< eT >::init().

00170   : n_rows(0)
00171   , n_cols(0)
00172   , n_elem(0)
00173   //, mem(0)
00174   , mem(mem)
00175   {
00176   arma_extra_debug_sigprint_this(this);
00177   
00178   init(text);
00179   }

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

Definition at line 187 of file Mat_meat.hpp.

References Mat< eT >::init().

00188   {
00189   arma_extra_debug_sigprint();
00190   
00191   init(text);
00192   return *this;
00193   }

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

Definition at line 201 of file Mat_meat.hpp.

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

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

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

Definition at line 300 of file Mat_meat.hpp.

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

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

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

Definition at line 315 of file Mat_meat.hpp.

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

00316   {
00317   arma_extra_debug_sigprint();
00318   
00319   for(u32 i=0; i<n_elem; ++i)
00320     {
00321     access::rw(mem[i]) += val;
00322     }
00323   
00324   return *this;
00325   }

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

Definition at line 333 of file Mat_meat.hpp.

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

00334   {
00335   arma_extra_debug_sigprint();
00336   
00337   for(u32 i=0; i<n_elem; ++i)
00338     {
00339     access::rw(mem[i]) -= val;
00340     }
00341       
00342   return *this;
00343   }

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

Definition at line 351 of file Mat_meat.hpp.

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

00352   {
00353   arma_extra_debug_sigprint();
00354   
00355   for(u32 i=0; i<n_elem; ++i)
00356     {
00357     access::rw(mem[i]) *= val;
00358     }
00359   
00360   return *this;
00361   }

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

Definition at line 369 of file Mat_meat.hpp.

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

00370   {
00371   arma_extra_debug_sigprint();
00372   
00373   for(u32 i=0; i<n_elem; ++i)
00374     {
00375     access::rw(mem[i]) /= val;
00376     }
00377   
00378   return *this;
00379   }

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

Definition at line 386 of file Mat_meat.hpp.

References Mat< eT >::init().

00387   : n_rows(0)
00388   , n_cols(0)
00389   , n_elem(0)
00390   //, mem(0)
00391   , mem(mem)
00392   {
00393   arma_extra_debug_sigprint(arma_boost::format("this = %x   in_mat = %x") % this % &in_mat);
00394   
00395   init(in_mat);
00396   }

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

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

Definition at line 404 of file Mat_meat.hpp.

References Mat< eT >::init().

00405   {
00406   arma_extra_debug_sigprint();
00407   
00408   init(x);
00409   return *this;
00410   }

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

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

00419   {
00420   arma_extra_debug_sigprint();
00421   
00422   if(this != &x)
00423     {
00424     init(x.n_rows, x.n_cols);
00425     syslib::copy_elem( memptr(), x.mem, n_elem );
00426     }
00427   }

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

Definition at line 434 of file Mat_meat.hpp.

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

00435   : n_rows(0)
00436   , n_cols(0)
00437   , n_elem(0)
00438   //, mem(0)
00439   , mem(mem)
00440   {
00441   arma_extra_debug_sigprint_this(this);
00442   
00443   init(aux_n_rows, aux_n_cols);
00444   syslib::copy_elem( memptr(), aux_mem, n_elem );
00445   }

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

Definition at line 453 of file Mat_meat.hpp.

References glue_plus::apply_inplace().

00454   {
00455   arma_extra_debug_sigprint();
00456   
00457   glue_plus::apply_inplace(*this, m);
00458   return *this;
00459   }

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

Definition at line 467 of file Mat_meat.hpp.

References glue_minus::apply_inplace().

00468   {
00469   arma_extra_debug_sigprint();
00470   
00471   glue_minus::apply_inplace(*this, m);
00472   return *this;
00473   }

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

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

Definition at line 481 of file Mat_meat.hpp.

References glue_times::apply_inplace().

00482   {
00483   arma_extra_debug_sigprint();
00484   
00485   glue_times::apply_inplace(*this, m);
00486   return *this;
00487   }

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

Definition at line 495 of file Mat_meat.hpp.

References glue_schur::apply_inplace().

00496   {
00497   arma_extra_debug_sigprint();
00498   
00499   glue_schur::apply_inplace(*this, m);
00500   return *this;
00501   }

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

Definition at line 509 of file Mat_meat.hpp.

References glue_div::apply_inplace().

00510   {
00511   arma_extra_debug_sigprint();
00512   
00513   glue_div::apply_inplace(*this, m);
00514   return *this;
00515   }

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

Definition at line 567 of file Mat_meat.hpp.

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

00568   : n_rows(0)
00569   , n_cols(0)
00570   , n_elem(0)
00571   //, mem(0)
00572   , mem(mem)
00573   {
00574   arma_extra_debug_sigprint_this(this);
00575   
00576   this->operator=(X);
00577   }

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

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

Definition at line 585 of file Mat_meat.hpp.

00586   {
00587   arma_extra_debug_sigprint();
00588   
00589   subview<eT>::extract(*this, X);
00590   return *this;
00591   }

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

Definition at line 598 of file Mat_meat.hpp.

00599   {
00600   arma_extra_debug_sigprint();
00601   
00602   subview<eT>::plus_inplace(*this, X);
00603   return *this;
00604   }

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

Definition at line 611 of file Mat_meat.hpp.

00612   {
00613   arma_extra_debug_sigprint();
00614   
00615   subview<eT>::minus_inplace(*this, X);
00616   return *this;
00617   }

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

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

Definition at line 625 of file Mat_meat.hpp.

00626   {
00627   arma_extra_debug_sigprint();
00628   
00629   subview<eT>::times_inplace(*this, X);
00630   return *this;
00631   }

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

Definition at line 639 of file Mat_meat.hpp.

00640   {
00641   arma_extra_debug_sigprint();
00642   
00643   subview<eT>::schur_inplace(*this, X);
00644   return *this;
00645   }

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

Definition at line 653 of file Mat_meat.hpp.

00654   {
00655   arma_extra_debug_sigprint();
00656   
00657   subview<eT>::div_inplace(*this, X);
00658   return *this;
00659   }

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

Definition at line 666 of file Mat_meat.hpp.

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

00667   : n_rows(0)
00668   , n_cols(0)
00669   , n_elem(0)
00670   //, mem(0)
00671   , mem(mem)
00672   {
00673   arma_extra_debug_sigprint_this(this);
00674   
00675   this->operator=(X);
00676   }

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

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

Definition at line 684 of file Mat_meat.hpp.

00685   {
00686   arma_extra_debug_sigprint();
00687   
00688   diagview<eT>::extract(*this, X);
00689   return *this;
00690   }

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

Definition at line 698 of file Mat_meat.hpp.

References Mat< eT >::n_rows.

00699   {
00700   arma_extra_debug_sigprint();
00701   
00702   arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" );
00703   
00704   return subview_row<eT>(*this, row_num);
00705   }

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

Definition at line 713 of file Mat_meat.hpp.

References Mat< eT >::n_rows.

00714   {
00715   arma_extra_debug_sigprint();
00716   
00717   arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" );
00718   
00719   return subview_row<eT>(*this, row_num);
00720   }

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

Definition at line 728 of file Mat_meat.hpp.

References Mat< eT >::n_cols.

00729   {
00730   arma_extra_debug_sigprint();
00731   
00732   arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds");
00733   
00734   return subview_col<eT>(*this, col_num);
00735   }

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

Definition at line 743 of file Mat_meat.hpp.

References Mat< eT >::n_cols.

00744   {
00745   arma_extra_debug_sigprint();
00746   
00747   arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds");
00748   
00749   return subview_col<eT>(*this, col_num);
00750   }

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

Definition at line 758 of file Mat_meat.hpp.

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

00759   {
00760   arma_extra_debug_sigprint();
00761   
00762   arma_debug_check
00763     (
00764     (in_row1 > in_row2) || (in_row2 >= n_rows),
00765     "Mat::rows(): indices out of bounds or incorrectly used"
00766     );
00767   
00768   return subview<eT>(*this, in_row1, 0, in_row2, n_cols-1);
00769   }

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

Definition at line 777 of file Mat_meat.hpp.

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

00778   {
00779   arma_extra_debug_sigprint();
00780   
00781   arma_debug_check
00782     (
00783     (in_row1 > in_row2) || (in_row2 >= n_rows),
00784     "Mat::rows(): indices out of bounds or incorrectly used"
00785     );
00786   
00787   return subview<eT>(*this, in_row1, 0, in_row2, n_cols-1);
00788   }

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

Definition at line 796 of file Mat_meat.hpp.

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

00797   {
00798   arma_extra_debug_sigprint();
00799   
00800   arma_debug_check
00801     (
00802     (in_col1 > in_col2) || (in_col2 >= n_cols),
00803     "Mat::cols(): indices out of bounds or incorrectly used"
00804     );
00805   
00806   return subview<eT>(*this, 0, in_col1, n_rows-1, in_col2);
00807   }

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

Definition at line 815 of file Mat_meat.hpp.

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

00816   {
00817   arma_extra_debug_sigprint();
00818   
00819   arma_debug_check
00820     (
00821     (in_col1 > in_col2) || (in_col2 >= n_cols),
00822     "Mat::cols(): indices out of bounds or incorrectly used"
00823     );
00824   
00825   return subview<eT>(*this, 0, in_col1, n_rows-1, in_col2);
00826   }

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]

Definition at line 834 of file Mat_meat.hpp.

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

00835   {
00836   arma_extra_debug_sigprint();
00837   
00838   arma_debug_check
00839     (
00840     (in_row1 > in_row2) || (in_col1 >  in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
00841     "Mat::submat(): indices out of bounds or incorrectly used"
00842     );
00843   
00844   return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2);
00845   }

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]

Definition at line 853 of file Mat_meat.hpp.

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

00854   {
00855   arma_extra_debug_sigprint();
00856   
00857   arma_debug_check
00858     (
00859     (in_row1 > in_row2) || (in_col1 >  in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
00860     "Mat::submat(): indices out of bounds or incorrectly used"
00861     );
00862     
00863   return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2);
00864   }

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

Definition at line 872 of file Mat_meat.hpp.

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

00873   {
00874   arma_extra_debug_sigprint();
00875   
00876   const u32 row_offset = (in_id < 0) ? -in_id : 0;
00877   const u32 col_offset = (in_id > 0) ?  in_id : 0;
00878   
00879   arma_debug_check
00880     (
00881     (row_offset >= n_rows) || (col_offset >= n_cols),
00882     "Mat::diag(): out of bounds"
00883     );
00884   
00885   const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
00886   
00887   return diagview<eT>(*this, row_offset, col_offset, len);
00888   }

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

Definition at line 896 of file Mat_meat.hpp.

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

00897   {
00898   arma_extra_debug_sigprint();
00899   
00900   const u32 row_offset = (in_id < 0) ? -in_id : 0;
00901   const u32 col_offset = (in_id > 0) ?  in_id : 0;
00902   
00903   arma_debug_check
00904     (
00905     (row_offset >= n_rows) || (col_offset >= n_cols),
00906     "Mat::diag(): out of bounds"
00907     );
00908   
00909   
00910   const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
00911   
00912   return diagview<eT>(*this, row_offset, col_offset, len);
00913   }

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

Definition at line 920 of file Mat_meat.hpp.

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

00921   {
00922   arma_extra_debug_sigprint();
00923   
00924   arma_debug_check
00925     (
00926     (in_row1 >= n_rows) || (in_row2 >= n_rows),
00927     "Mat::swap_rows(): out of bounds"
00928     );
00929   
00930   for(u32 col=0; col<n_cols; ++col)
00931     {
00932     const u32 offset = col*n_rows;
00933     const u32 pos1   = in_row1 + offset;
00934     const u32 pos2   = in_row2 + offset;
00935     
00936     const eT tmp          = mem[pos1];
00937     access::rw(mem[pos1]) = mem[pos2];
00938     access::rw(mem[pos2]) = tmp;
00939     }
00940   
00941   }

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

Definition at line 948 of file Mat_meat.hpp.

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

00949   {
00950   arma_extra_debug_sigprint();
00951   
00952   arma_debug_check
00953     (
00954     (in_col1 >= n_cols) || (in_col2 >= n_cols),
00955     "Mat::swap_cols(): out of bounds"
00956     );
00957   
00958   eT* ptr1 = colptr(in_col1);
00959   eT* ptr2 = colptr(in_col2);
00960   
00961   for(u32 row=0; row<n_rows; ++row)
00962     {
00963     const eT tmp = ptr1[row];
00964     ptr1[row]    = ptr2[row];
00965     ptr2[row]    = tmp;
00966     }
00967   
00968   }

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

Definition at line 976 of file Mat_meat.hpp.

00977   : n_rows(0)
00978   , n_cols(0)
00979   , n_elem(0)
00980   //, mem(0)
00981   , mem(mem)
00982   {
00983   arma_extra_debug_sigprint_this(this);
00984 
00985   isnt_same_type<eT, typename T1::elem_type>::check();
00986   
00987   op_type::apply(*this, X);
00988   }

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

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

Definition at line 997 of file Mat_meat.hpp.

00998   {
00999   arma_extra_debug_sigprint();
01000 
01001   isnt_same_type<eT, typename T1::elem_type>::check();
01002   
01003   op_type::apply(*this, X);
01004   
01005   return *this;
01006   }

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

Definition at line 1015 of file Mat_meat.hpp.

References glue_plus::apply_inplace().

01016   {
01017   arma_extra_debug_sigprint();
01018   
01019   isnt_same_type<eT, typename T1::elem_type>::check();
01020   
01021   glue_plus::apply_inplace(*this, X);
01022   
01023   return *this;
01024   }

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

Definition at line 1033 of file Mat_meat.hpp.

References glue_minus::apply_inplace().

01034   {
01035   arma_extra_debug_sigprint();
01036   
01037   isnt_same_type<eT, typename T1::elem_type>::check();
01038   
01039   glue_minus::apply_inplace(*this, X);
01040   
01041   return *this;
01042   }

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

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

Definition at line 1051 of file Mat_meat.hpp.

References glue_times::apply_inplace().

01052   {
01053   arma_extra_debug_sigprint();
01054   
01055   isnt_same_type<eT, typename T1::elem_type>::check();
01056   
01057   glue_times::apply_inplace(*this, X);
01058   
01059   return *this;
01060   }

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

Definition at line 1069 of file Mat_meat.hpp.

References glue_schur::apply_inplace().

01070   {
01071   arma_extra_debug_sigprint();
01072   
01073   isnt_same_type<eT, typename T1::elem_type>::check();
01074   glue_schur::apply_inplace(*this, X);
01075   
01076   return *this;
01077   }

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

Definition at line 1086 of file Mat_meat.hpp.

References glue_div::apply_inplace().

01087   {
01088   arma_extra_debug_sigprint();
01089   
01090   isnt_same_type<eT, typename T1::elem_type>::check();
01091   glue_div::apply_inplace(*this, X);
01092   
01093   return *this;
01094   }

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

Definition at line 1102 of file Mat_meat.hpp.

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

01103   : n_rows(0)
01104   , n_cols(0)
01105   , n_elem(0)
01106   //, mem(0)
01107   , mem(mem)
01108   {
01109   arma_extra_debug_sigprint_this(this);
01110   this->operator=(X);
01111   }

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

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

Definition at line 1120 of file Mat_meat.hpp.

01121   {
01122   arma_extra_debug_sigprint();
01123   
01124   // TODO:
01125   // it may be simpler to pass the two objects (currently wrapped in X)
01126   // directly to the apply function.
01127   // (many adjustments throughout the source code will be required)
01128   
01129   isnt_same_type<eT, typename T1::elem_type>::check();
01130   isnt_same_type<eT, typename T2::elem_type>::check();
01131   
01132   glue_type::apply(*this, X);
01133   
01134   return *this;
01135   }

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

Definition at line 1143 of file Mat_meat.hpp.

References glue_plus::apply_inplace().

01144   {
01145   arma_extra_debug_sigprint();
01146   
01147   isnt_same_type<eT, typename T1::elem_type>::check();
01148   isnt_same_type<eT, typename T2::elem_type>::check();
01149   
01150   glue_plus::apply_inplace(*this, X);
01151   
01152   return *this;
01153   }

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

Definition at line 1162 of file Mat_meat.hpp.

References glue_minus::apply_inplace().

01163   {
01164   arma_extra_debug_sigprint();
01165   
01166   isnt_same_type<eT, typename T1::elem_type>::check();
01167   isnt_same_type<eT, typename T2::elem_type>::check();
01168   
01169   glue_minus::apply_inplace(*this, X);
01170   
01171   return *this;
01172   }

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

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

Definition at line 1181 of file Mat_meat.hpp.

References glue_times::apply_inplace().

01182   {
01183   arma_extra_debug_sigprint();
01184   
01185   isnt_same_type<eT, typename T1::elem_type>::check();
01186   isnt_same_type<eT, typename T2::elem_type>::check();
01187   
01188   glue_times::apply_inplace(*this, X);
01189   return *this;
01190   }

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

Definition at line 1199 of file Mat_meat.hpp.

References glue_schur::apply_inplace().

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

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

Definition at line 1217 of file Mat_meat.hpp.

References glue_div::apply_inplace().

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

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

Definition at line 1234 of file Mat_meat.hpp.

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

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

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

Definition at line 1246 of file Mat_meat.hpp.

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

01247   {
01248   arma_debug_check( (i >= n_elem), "Mat::operator(): index out of bounds");
01249   return mem[i];
01250   }

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

Definition at line 1257 of file Mat_meat.hpp.

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

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

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

Definition at line 1268 of file Mat_meat.hpp.

References Mat< eT >::mem.

01269   {
01270   return mem[i];
01271   }

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

Definition at line 1279 of file Mat_meat.hpp.

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

01280   {
01281   arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator(): index out of bounds");
01282   return access::rw(mem[in_row + in_col*n_rows]);
01283   }

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

Definition at line 1291 of file Mat_meat.hpp.

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

01292   {
01293   arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator(): index out of bounds");
01294   return mem[in_row + in_col*n_rows];
01295   }

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

Definition at line 1303 of file Mat_meat.hpp.

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

01304   {
01305   return access::rw( mem[in_row + in_col*n_rows] );
01306   }

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

Definition at line 1314 of file Mat_meat.hpp.

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

01315   {
01316   return mem[in_row + in_col*n_rows];
01317   }

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

Definition at line 1325 of file Mat_meat.hpp.

References Mat_aux::prefix_pp().

01326   {
01327   Mat_aux::prefix_pp(*this);
01328   return *this;
01329   }

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

Definition at line 1337 of file Mat_meat.hpp.

References Mat_aux::postfix_pp().

01338   {
01339   Mat_aux::postfix_pp(*this);
01340   }

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

Definition at line 1348 of file Mat_meat.hpp.

References Mat_aux::prefix_mm().

01349   {
01350   Mat_aux::prefix_mm(*this);
01351   return *this;
01352   }

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

Definition at line 1360 of file Mat_meat.hpp.

References Mat_aux::postfix_mm().

01361   {
01362   Mat_aux::postfix_mm(*this);
01363   }

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

Definition at line 1371 of file Mat_meat.hpp.

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

01372   {
01373   return ( (n_rows == 1) || (n_cols == 1) );
01374   }

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

Definition at line 1382 of file Mat_meat.hpp.

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

01383   {
01384   return ( (n_rows == n_cols) && (n_elem > 0) );
01385   }

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

Definition at line 1393 of file Mat_meat.hpp.

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

01394   {
01395   for(u32 i=0; i<n_elem; ++i)
01396     {
01397     if(arma_isfinite(mem[i]) == false)
01398       {
01399       return false;
01400       }
01401     }
01402 
01403   return true;
01404   }

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

Definition at line 1412 of file Mat_meat.hpp.

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

01413   {
01414   return & access::rw(mem[in_col*n_rows]);
01415   }

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

Definition at line 1423 of file Mat_meat.hpp.

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

01424   {
01425   return & mem[in_col*n_rows];
01426   }

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

Definition at line 1434 of file Mat_meat.hpp.

References Mat< eT >::mem.

Referenced by op_randn::apply(), op_rand::apply(), auxlib::eig_sym(), conv_to< Col< out_eT > >::from(), conv_to< Row< out_eT > >::from(), and auxlib::svd().

01435   {
01436   return const_cast<eT*>(mem);
01437   }

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

Definition at line 1445 of file Mat_meat.hpp.

References Mat< eT >::mem.

01446   {
01447   return mem;
01448   }

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

Definition at line 1456 of file Mat_meat.hpp.

01457   {
01458   arma_extra_debug_sigprint();
01459   
01460   if(extra_text.length() != 0)
01461     {
01462     cout << extra_text << '\n';
01463     }
01464   
01465   cout << *this << '\n';
01466   }

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

Definition at line 1474 of file Mat_meat.hpp.

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

Referenced by op_ones_full::apply().

01475   {
01476   arma_extra_debug_sigprint();
01477   
01478   for(u32 i=0; i<n_elem; ++i)
01479     {
01480     access::rw(mem[i]) = val;
01481     }
01482   }

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

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

Definition at line 1489 of file Mat_meat.hpp.

References Mat< eT >::fill().

01490   {
01491   arma_extra_debug_sigprint();
01492   
01493   fill(eT(0));
01494   }

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

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

Definition at line 1501 of file Mat_meat.hpp.

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

01502   {
01503   arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d") % in_rows % in_cols );
01504 
01505   set_size(in_rows, in_cols);
01506   fill(eT(0));
01507   }

void Mat< eT >::reset (  )  [inline, inherited]

Definition at line 1514 of file Mat_meat.hpp.

References Mat< eT >::init().

01515   {
01516   arma_extra_debug_sigprint();
01517   
01518   init(0,0);
01519   }

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

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

01528   {
01529   arma_extra_debug_sigprint();
01530   
01531   switch(type)
01532     {
01533     case raw_ascii:
01534       diskio::save_raw_ascii(*this, name);
01535       break;
01536     
01537     case arma_ascii:
01538       diskio::save_arma_ascii(*this, name);
01539       break;
01540     
01541     case arma_binary:
01542       diskio::save_arma_binary(*this, name);
01543       break;
01544       
01545     case pgm_binary:
01546       diskio::save_pgm_binary(*this, name);
01547       break;
01548     
01549     default:
01550       arma_stop("Mat::save(): unsupported type");
01551     }
01552   
01553   }

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

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

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

01562   {
01563   arma_extra_debug_sigprint();
01564   
01565   switch(type)
01566     {
01567     case auto_detect:
01568       diskio::load_auto_detect(*this, name);
01569       break;
01570     
01571     case raw_ascii:
01572       diskio::load_raw_ascii(*this, name);
01573       break;
01574     
01575     case arma_ascii:
01576       diskio::load_arma_ascii(*this, name);
01577       break;
01578     
01579     case arma_binary:
01580       diskio::load_arma_binary(*this, name);
01581       break;
01582       
01583     case pgm_binary:
01584       diskio::load_pgm_binary(*this, name);
01585       break;
01586     
01587     default:
01588       arma_stop("Mat::load(): unsupported type");
01589     }
01590   
01591   }

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

prefix ++

Definition at line 1599 of file Mat_meat.hpp.

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

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

01600   {
01601         eT* memptr = x.memptr();
01602   const u32 n_elem = x.n_elem;
01603 
01604   for(u32 i=0; i<n_elem; ++i)
01605     {
01606     ++(memptr[i]);
01607     }
01608   }

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

01617   {
01618   x += T(1);
01619   }

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

postfix ++

Definition at line 1627 of file Mat_meat.hpp.

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

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

01628   {
01629         eT* memptr = x.memptr();
01630   const u32 n_elem = x.n_elem;
01631 
01632   for(u32 i=0; i<n_elem; ++i)
01633     {
01634     (memptr[i])++;
01635     }
01636   }

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

01645   {
01646   x += T(1);
01647   }

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

prefix --

Definition at line 1655 of file Mat_meat.hpp.

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

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

01656   {
01657         eT* memptr = x.memptr();
01658   const u32 n_elem = x.n_elem;
01659 
01660   for(u32 i=0; i<n_elem; ++i)
01661     {
01662     --(memptr[i]);
01663     }
01664   }

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

01673   {
01674   x -= T(1);
01675   }

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

postfix --

Definition at line 1683 of file Mat_meat.hpp.

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

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

01684   {
01685         eT* memptr = x.memptr();
01686   const u32 n_elem = x.n_elem;
01687 
01688   for(u32 i=0; i<n_elem; ++i)
01689     {
01690     (memptr[i])--;
01691     }
01692   }

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

01701   {
01702   x -= T(1);
01703   }