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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::operator+= (const eT val) |
In-place addition of a scalar to all elements of the matrix. | |
arma_inline const Mat & | Mat::operator-= (const eT val) |
In-place subtraction of a scalar from all elements of the matrix. | |
arma_inline const Mat & | Mat::operator*= (const eT val) |
In-place multiplication of all elements of the matrix with a scalar. | |
arma_inline const Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::operator+= (const Mat &m) |
in-place matrix addition | |
const Mat & | Mat::operator-= (const Mat &m) |
in-place matrix subtraction | |
const Mat & | Mat::operator*= (const Mat &m) |
in-place matrix multiplication | |
const Mat & | Mat::operator%= (const Mat &m) |
in-place element-wise matrix multiplication | |
const Mat & | Mat::operator/= (const Mat &m) |
in-place element-wise matrix division | |
template<typename T1 , typename T2 > | |
Mat::Mat (const Base< pod_type, T1 > &A, const Base< 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 Mat & | Mat::operator= (const subview< eT > &X) |
construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation) | |
const Mat & | Mat::operator+= (const subview< eT > &X) |
in-place matrix addition (using a submatrix on the right-hand-side) | |
const Mat & | Mat::operator-= (const subview< eT > &X) |
in-place matrix subtraction (using a submatrix on the right-hand-side) | |
const Mat & | Mat::operator*= (const subview< eT > &X) |
in-place matrix mutiplication (using a submatrix on the right-hand-side) | |
const Mat & | Mat::operator%= (const subview< eT > &X) |
in-place element-wise matrix mutiplication (using a submatrix on the right-hand-side) | |
const Mat & | Mat::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 Mat & | Mat::operator= (const subview_cube< eT > &X) |
construct a matrix from a subview_cube instance | |
const Mat & | Mat::operator+= (const subview_cube< eT > &X) |
in-place matrix addition (using a single-slice subcube on the right-hand-side) | |
const Mat & | Mat::operator-= (const subview_cube< eT > &X) |
in-place matrix subtraction (using a single-slice subcube on the right-hand-side) | |
const Mat & | Mat::operator*= (const subview_cube< eT > &X) |
in-place matrix mutiplication (using a single-slice subcube on the right-hand-side) | |
const Mat & | Mat::operator%= (const subview_cube< eT > &X) |
in-place element-wise matrix mutiplication (using a single-slice subcube on the right-hand-side) | |
const Mat & | Mat::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 Mat & | Mat::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::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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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 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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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 Mat & | Mat::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::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 Mat & | Mat::operator++ () |
prefix ++ | |
arma_inline void | Mat::operator++ (int) |
postfix ++ (must not return the object by reference) | |
arma_inline const Mat & | Mat::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 | |
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::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) |
Definition at line 22 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.
00023 { 00024 arma_extra_debug_sigprint_this(this); 00025 00026 if(use_aux_mem == false) 00027 { 00028 if(n_elem > sizeof(mem_local)/sizeof(eT) ) 00029 { 00030 delete [] mem; 00031 } 00032 } 00033 00034 if(arma_config::debug == true) 00035 { 00036 // try to expose buggy user code that accesses deleted objects 00037 access::rw(n_rows) = 0; 00038 access::rw(n_cols) = 0; 00039 access::rw(n_elem) = 0; 00040 access::rw(mem) = 0; 00041 } 00042 00043 isnt_supported_elem_type<eT>::check(); 00044 }
Definition at line 50 of file Mat_meat.hpp.
construct the matrix to have user specified dimensions
Definition at line 65 of file Mat_meat.hpp.
References Mat< eT >::init().
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 84 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().
00085 { 00086 arma_extra_debug_sigprint( arma_boost::format("in_n_rows = %d, in_n_cols = %d") % in_n_rows % in_n_cols ); 00087 00088 const u32 new_n_elem = in_n_rows * in_n_cols; 00089 00090 if(n_elem == new_n_elem) 00091 { 00092 access::rw(n_rows) = in_n_rows; 00093 access::rw(n_cols) = in_n_cols; 00094 } 00095 else 00096 { 00097 arma_debug_check 00098 ( 00099 (use_aux_mem == true), 00100 "Mat::init(): can't change the amount of memory as auxiliary memory is in use" 00101 ); 00102 00103 if(n_elem > sizeof(mem_local)/sizeof(eT) ) 00104 { 00105 delete [] mem; 00106 } 00107 00108 if(new_n_elem <= sizeof(mem_local)/sizeof(eT) ) 00109 { 00110 access::rw(mem) = mem_local; 00111 } 00112 else 00113 { 00114 access::rw(mem) = new(std::nothrow) eT[new_n_elem]; 00115 arma_check( (mem == 0), "Mat::init(): out of memory" ); 00116 } 00117 00118 access::rw(n_elem) = new_n_elem; 00119 00120 if(new_n_elem == 0) 00121 { 00122 access::rw(n_rows) = 0; 00123 access::rw(n_cols) = 0; 00124 } 00125 else 00126 { 00127 access::rw(n_rows) = in_n_rows; 00128 access::rw(n_cols) = in_n_cols; 00129 } 00130 00131 } 00132 }
create the matrix from a textual description
Definition at line 138 of file Mat_meat.hpp.
References Mat< eT >::init().
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 157 of file Mat_meat.hpp.
References Mat< eT >::init().
Referenced by Mat< eT >::Mat().
00158 { 00159 arma_extra_debug_sigprint(); 00160 00161 init( std::string(text) ); 00162 return *this; 00163 }
create the matrix from a textual description
Definition at line 170 of file Mat_meat.hpp.
References Mat< eT >::init().
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 189 of file Mat_meat.hpp.
References Mat< eT >::init().
00190 { 00191 arma_extra_debug_sigprint(); 00192 00193 init(text); 00194 return *this; 00195 }
void Mat< eT >::init | ( | const std::string & | text | ) | [inline, protected, inherited] |
internal function to create the matrix from a textual description
Definition at line 203 of file Mat_meat.hpp.
References arma_check(), Mat< eT >::at(), Mat< eT >::col(), Mat< eT >::row(), and Mat< eT >::set_size().
00204 { 00205 arma_extra_debug_sigprint(); 00206 00207 // 00208 // work out the size 00209 00210 u32 t_n_rows = 0; 00211 u32 t_n_cols = 0; 00212 00213 bool t_n_cols_found = false; 00214 00215 std::string token; 00216 00217 std::string::size_type line_start = 0; 00218 std::string::size_type line_end = 0; 00219 00220 while( line_start < text.length() ) 00221 { 00222 00223 line_end = text.find(';', line_start); 00224 00225 if(line_end == std::string::npos) 00226 line_end = text.length()-1; 00227 00228 std::string::size_type line_len = line_end - line_start + 1; 00229 std::stringstream line_stream( text.substr(line_start,line_len) ); 00230 00231 00232 u32 line_n_cols = 0; 00233 while(line_stream >> token) 00234 { 00235 ++line_n_cols; 00236 } 00237 00238 00239 if(line_n_cols > 0) 00240 { 00241 if(t_n_cols_found == false) 00242 { 00243 t_n_cols = line_n_cols; 00244 t_n_cols_found = true; 00245 } 00246 else 00247 arma_check( (line_n_cols != t_n_cols), "Mat::init(): inconsistent number of columns in given string"); 00248 00249 ++t_n_rows; 00250 } 00251 line_start = line_end+1; 00252 00253 } 00254 00255 Mat<eT>& x = *this; 00256 x.set_size(t_n_rows, t_n_cols); 00257 00258 line_start = 0; 00259 line_end = 0; 00260 00261 u32 row = 0; 00262 00263 while( line_start < text.length() ) 00264 { 00265 00266 line_end = text.find(';', line_start); 00267 00268 if(line_end == std::string::npos) 00269 line_end = text.length()-1; 00270 00271 std::string::size_type line_len = line_end - line_start + 1; 00272 std::stringstream line_stream( text.substr(line_start,line_len) ); 00273 00274 // u32 col = 0; 00275 // while(line_stream >> token) 00276 // { 00277 // x.at(row,col) = strtod(token.c_str(), 0); 00278 // ++col; 00279 // } 00280 00281 u32 col = 0; 00282 eT val; 00283 while(line_stream >> val) 00284 { 00285 x.at(row,col) = val; 00286 ++col; 00287 } 00288 00289 ++row; 00290 line_start = line_end+1; 00291 } 00292 00293 }
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 302 of file Mat_meat.hpp.
References Mat< eT >::init(), Mat< eT >::mem, and access::rw().
00303 { 00304 arma_extra_debug_sigprint(); 00305 00306 init(1,1); 00307 access::rw(mem[0]) = val; 00308 return *this; 00309 }
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 317 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_elem, and access::rw().
00318 { 00319 arma_extra_debug_sigprint(); 00320 00321 for(u32 i=0; i<n_elem; ++i) 00322 { 00323 access::rw(mem[i]) += val; 00324 } 00325 00326 return *this; 00327 }
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 335 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_elem, and access::rw().
00336 { 00337 arma_extra_debug_sigprint(); 00338 00339 for(u32 i=0; i<n_elem; ++i) 00340 { 00341 access::rw(mem[i]) -= val; 00342 } 00343 00344 return *this; 00345 }
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 353 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_elem, and access::rw().
00354 { 00355 arma_extra_debug_sigprint(); 00356 00357 for(u32 i=0; i<n_elem; ++i) 00358 { 00359 access::rw(mem[i]) *= val; 00360 } 00361 00362 return *this; 00363 }
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 371 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_elem, and access::rw().
00372 { 00373 arma_extra_debug_sigprint(); 00374 00375 for(u32 i=0; i<n_elem; ++i) 00376 { 00377 access::rw(mem[i]) /= val; 00378 } 00379 00380 return *this; 00381 }
construct a matrix from a given matrix
Definition at line 388 of file Mat_meat.hpp.
References Mat< eT >::init().
00389 : n_rows(0) 00390 , n_cols(0) 00391 , n_elem(0) 00392 , use_aux_mem(false) 00393 //, mem(0) 00394 , mem(mem) 00395 { 00396 arma_extra_debug_sigprint(arma_boost::format("this = %x in_mat = %x") % this % &in_mat); 00397 00398 init(in_mat); 00399 }
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 407 of file Mat_meat.hpp.
References Mat< eT >::init().
00408 { 00409 arma_extra_debug_sigprint(); 00410 00411 init(x); 00412 return *this; 00413 }
construct a matrix from a given matrix
Definition at line 421 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.
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 441 of file Mat_meat.hpp.
References syslib::copy_elem(), Mat< eT >::init(), Mat< eT >::memptr(), and Mat< eT >::n_elem.
00442 : n_rows (copy_aux_mem ? 0 : aux_n_rows ) 00443 , n_cols (copy_aux_mem ? 0 : aux_n_cols ) 00444 , n_elem (copy_aux_mem ? 0 : aux_n_rows*aux_n_cols) 00445 , use_aux_mem(copy_aux_mem ? false : true ) 00446 , mem (copy_aux_mem ? mem : aux_mem ) 00447 { 00448 arma_extra_debug_sigprint_this(this); 00449 00450 if(copy_aux_mem == true) 00451 { 00452 init(aux_n_rows, aux_n_cols); 00453 syslib::copy_elem( memptr(), aux_mem, n_elem ); 00454 } 00455 }
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 463 of file Mat_meat.hpp.
References syslib::copy_elem(), Mat< eT >::init(), Mat< eT >::memptr(), and Mat< eT >::n_elem.
00464 : n_rows(0) 00465 , n_cols(0) 00466 , n_elem(0) 00467 , use_aux_mem(false) 00468 //, mem(0) 00469 , mem(mem) 00470 { 00471 arma_extra_debug_sigprint_this(this); 00472 00473 init(aux_n_rows, aux_n_cols); 00474 syslib::copy_elem( memptr(), aux_mem, n_elem ); 00475 }
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 485 of file Mat_meat.hpp.
00486 : n_rows (aux_n_rows ) 00487 , n_cols (aux_n_cols ) 00488 , n_elem (aux_n_rows*aux_n_cols) 00489 , use_aux_mem(true ) 00490 , mem (aux_mem ) 00491 { 00492 arma_extra_debug_sigprint_this(this); 00493 }
const Mat< eT > & Mat< eT >::operator+= | ( | const Mat< eT > & | m | ) | [inline, inherited] |
in-place matrix addition
Definition at line 501 of file Mat_meat.hpp.
References glue_plus::apply_inplace().
00502 { 00503 arma_extra_debug_sigprint(); 00504 00505 glue_plus::apply_inplace(*this, m); 00506 return *this; 00507 }
const Mat< eT > & Mat< eT >::operator-= | ( | const Mat< eT > & | m | ) | [inline, inherited] |
in-place matrix subtraction
Definition at line 515 of file Mat_meat.hpp.
References glue_minus::apply_inplace().
00516 { 00517 arma_extra_debug_sigprint(); 00518 00519 glue_minus::apply_inplace(*this, m); 00520 return *this; 00521 }
const Mat< eT > & Mat< eT >::operator*= | ( | const Mat< eT > & | m | ) | [inline, inherited] |
in-place matrix multiplication
Reimplemented in Row< eT >.
Definition at line 529 of file Mat_meat.hpp.
References glue_times::apply_inplace().
00530 { 00531 arma_extra_debug_sigprint(); 00532 00533 glue_times::apply_inplace(*this, m); 00534 return *this; 00535 }
const Mat< eT > & Mat< eT >::operator%= | ( | const Mat< eT > & | m | ) | [inline, inherited] |
in-place element-wise matrix multiplication
Definition at line 543 of file Mat_meat.hpp.
References glue_schur::apply_inplace().
00544 { 00545 arma_extra_debug_sigprint(); 00546 00547 glue_schur::apply_inplace(*this, m); 00548 return *this; 00549 }
const Mat< eT > & Mat< eT >::operator/= | ( | const Mat< eT > & | m | ) | [inline, inherited] |
in-place element-wise matrix division
Definition at line 557 of file Mat_meat.hpp.
References glue_div::apply_inplace().
00558 { 00559 arma_extra_debug_sigprint(); 00560 00561 glue_div::apply_inplace(*this, m); 00562 return *this; 00563 }
Mat< eT >::Mat | ( | const Base< pod_type, T1 > & | A, | |
const Base< pod_type, T2 > & | B | |||
) | [inline, explicit, 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 572 of file Mat_meat.hpp.
References arma_assert_same_size(), Mat< eT >::mem, Mat< eT >::n_cols, and access::rw().
00576 : n_rows(0) 00577 , n_cols(0) 00578 , n_elem(0) 00579 , use_aux_mem(false) 00580 //, mem(0) 00581 , mem(mem) 00582 { 00583 arma_extra_debug_sigprint_this(this); 00584 00585 arma_type_check< is_complex<eT>::value == false >::apply(); //!< compile-time abort if eT isn't std::complex 00586 00587 typedef typename T1::elem_type T; 00588 arma_type_check< is_complex<T>::value == true >::apply(); //!< compile-time abort if T is std::complex 00589 00590 isnt_same_type<std::complex<T>, eT>::check(); //!< compile-time abort if types are not compatible 00591 00592 const unwrap<T1> tmp_A(A.get_ref()); 00593 const unwrap<T2> tmp_B(B.get_ref()); 00594 00595 const Mat<T>& X = tmp_A.M; 00596 const Mat<T>& Y = tmp_B.M; 00597 00598 arma_assert_same_size(X, Y, "Mat()"); 00599 00600 init(X.n_rows, Y.n_cols); 00601 00602 const T* X_mem = X.mem; 00603 const T* Y_mem = Y.mem; 00604 00605 for(u32 i=0; i<n_elem; ++i) 00606 { 00607 access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]); 00608 } 00609 }
construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation)
Definition at line 616 of file Mat_meat.hpp.
References Mat< eT >::operator=().
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 635 of file Mat_meat.hpp.
00636 { 00637 arma_extra_debug_sigprint(); 00638 00639 subview<eT>::extract(*this, X); 00640 return *this; 00641 }
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 648 of file Mat_meat.hpp.
00649 { 00650 arma_extra_debug_sigprint(); 00651 00652 subview<eT>::plus_inplace(*this, X); 00653 return *this; 00654 }
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 661 of file Mat_meat.hpp.
00662 { 00663 arma_extra_debug_sigprint(); 00664 00665 subview<eT>::minus_inplace(*this, X); 00666 return *this; 00667 }
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 675 of file Mat_meat.hpp.
00676 { 00677 arma_extra_debug_sigprint(); 00678 00679 subview<eT>::times_inplace(*this, X); 00680 return *this; 00681 }
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 689 of file Mat_meat.hpp.
00690 { 00691 arma_extra_debug_sigprint(); 00692 00693 subview<eT>::schur_inplace(*this, X); 00694 return *this; 00695 }
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 703 of file Mat_meat.hpp.
00704 { 00705 arma_extra_debug_sigprint(); 00706 00707 subview<eT>::div_inplace(*this, X); 00708 return *this; 00709 }
Mat< eT >::Mat | ( | const subview_cube< eT > & | X | ) | [inline, inherited] |
construct a matrix from a subview_cube instance
Definition at line 716 of file Mat_meat.hpp.
References Mat< eT >::operator=().
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 735 of file Mat_meat.hpp.
00736 { 00737 arma_extra_debug_sigprint(); 00738 00739 subview_cube<eT>::extract(*this, X); 00740 return *this; 00741 }
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 749 of file Mat_meat.hpp.
00750 { 00751 arma_extra_debug_sigprint(); 00752 00753 subview_cube<eT>::plus_inplace(*this, X); 00754 return *this; 00755 }
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 763 of file Mat_meat.hpp.
00764 { 00765 arma_extra_debug_sigprint(); 00766 00767 subview_cube<eT>::minus_inplace(*this, X); 00768 return *this; 00769 }
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 777 of file Mat_meat.hpp.
References glue_times::apply_inplace().
00778 { 00779 arma_extra_debug_sigprint(); 00780 00781 const Mat<eT> tmp(X); 00782 glue_times::apply_inplace(*this, tmp); 00783 return *this; 00784 }
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 792 of file Mat_meat.hpp.
00793 { 00794 arma_extra_debug_sigprint(); 00795 00796 subview_cube<eT>::schur_inplace(*this, X); 00797 return *this; 00798 }
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 806 of file Mat_meat.hpp.
00807 { 00808 arma_extra_debug_sigprint(); 00809 00810 subview_cube<eT>::div_inplace(*this, X); 00811 return *this; 00812 }
construct a matrix from diagview (e.g. construct a matrix from a delayed diag operation)
Definition at line 819 of file Mat_meat.hpp.
References Mat< eT >::operator=().
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 838 of file Mat_meat.hpp.
00839 { 00840 arma_extra_debug_sigprint(); 00841 00842 diagview<eT>::extract(*this, X); 00843 return *this; 00844 }
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 852 of file Mat_meat.hpp.
References Mat< eT >::n_rows.
Referenced by op_shuffle::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().
00853 { 00854 arma_extra_debug_sigprint(); 00855 00856 arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" ); 00857 00858 return subview_row<eT>(*this, row_num); 00859 }
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 867 of file Mat_meat.hpp.
References Mat< eT >::n_rows.
00868 { 00869 arma_extra_debug_sigprint(); 00870 00871 arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" ); 00872 00873 return subview_row<eT>(*this, row_num); 00874 }
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 882 of file Mat_meat.hpp.
References Mat< eT >::n_cols.
Referenced by op_shuffle::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().
00883 { 00884 arma_extra_debug_sigprint(); 00885 00886 arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds"); 00887 00888 return subview_col<eT>(*this, col_num); 00889 }
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 897 of file Mat_meat.hpp.
References Mat< eT >::n_cols.
00898 { 00899 arma_extra_debug_sigprint(); 00900 00901 arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds"); 00902 00903 return subview_col<eT>(*this, col_num); 00904 }
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 912 of file Mat_meat.hpp.
References Mat< eT >::n_cols, and Mat< eT >::n_rows.
00913 { 00914 arma_extra_debug_sigprint(); 00915 00916 arma_debug_check 00917 ( 00918 (in_row1 > in_row2) || (in_row2 >= n_rows), 00919 "Mat::rows(): indices out of bounds or incorrectly used" 00920 ); 00921 00922 return subview<eT>(*this, in_row1, 0, in_row2, ((n_cols>0) ? n_cols-1 : 0) ); 00923 }
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 931 of file Mat_meat.hpp.
References Mat< eT >::n_cols, and Mat< eT >::n_rows.
00932 { 00933 arma_extra_debug_sigprint(); 00934 00935 arma_debug_check 00936 ( 00937 (in_row1 > in_row2) || (in_row2 >= n_rows), 00938 "Mat::rows(): indices out of bounds or incorrectly used" 00939 ); 00940 00941 return subview<eT>(*this, in_row1, 0, in_row2, ((n_cols>0) ? n_cols-1 : 0) ); 00942 }
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 950 of file Mat_meat.hpp.
References Mat< eT >::n_cols, and Mat< eT >::n_rows.
Referenced by op_pinv::direct_pinv().
00951 { 00952 arma_extra_debug_sigprint(); 00953 00954 arma_debug_check 00955 ( 00956 (in_col1 > in_col2) || (in_col2 >= n_cols), 00957 "Mat::cols(): indices out of bounds or incorrectly used" 00958 ); 00959 00960 return subview<eT>(*this, 0, in_col1, ((n_rows>0) ? n_rows-1 : 0), in_col2); 00961 }
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 969 of file Mat_meat.hpp.
References Mat< eT >::n_cols, and Mat< eT >::n_rows.
00970 { 00971 arma_extra_debug_sigprint(); 00972 00973 arma_debug_check 00974 ( 00975 (in_col1 > in_col2) || (in_col2 >= n_cols), 00976 "Mat::cols(): indices out of bounds or incorrectly used" 00977 ); 00978 00979 return subview<eT>(*this, 0, in_col1, ((n_rows>0) ? n_rows-1 : 0), in_col2); 00980 }
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 988 of file Mat_meat.hpp.
References Mat< eT >::n_cols, and Mat< eT >::n_rows.
Referenced by op_repmat::apply(), and glue_kron::direct_kron().
00989 { 00990 arma_extra_debug_sigprint(); 00991 00992 arma_debug_check 00993 ( 00994 (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), 00995 "Mat::submat(): indices out of bounds or incorrectly used" 00996 ); 00997 00998 return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2); 00999 }
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 1007 of file Mat_meat.hpp.
References Mat< eT >::n_cols, and Mat< eT >::n_rows.
01008 { 01009 arma_extra_debug_sigprint(); 01010 01011 arma_debug_check 01012 ( 01013 (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols), 01014 "Mat::submat(): indices out of bounds or incorrectly used" 01015 ); 01016 01017 return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2); 01018 }
arma_inline diagview< eT > Mat< eT >::diag | ( | const s32 | in_id = 0 |
) | [inline, inherited] |
creation of diagview (diagonal)
Definition at line 1026 of file Mat_meat.hpp.
References min(), Mat< eT >::n_cols, and Mat< eT >::n_rows.
01027 { 01028 arma_extra_debug_sigprint(); 01029 01030 const u32 row_offset = (in_id < 0) ? -in_id : 0; 01031 const u32 col_offset = (in_id > 0) ? in_id : 0; 01032 01033 arma_debug_check 01034 ( 01035 (row_offset >= n_rows) || (col_offset >= n_cols), 01036 "Mat::diag(): out of bounds" 01037 ); 01038 01039 const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset); 01040 01041 return diagview<eT>(*this, row_offset, col_offset, len); 01042 }
arma_inline const diagview< eT > Mat< eT >::diag | ( | const s32 | in_id = 0 |
) | const [inline, inherited] |
creation of diagview (diagonal)
Definition at line 1050 of file Mat_meat.hpp.
References min(), Mat< eT >::n_cols, and Mat< eT >::n_rows.
01051 { 01052 arma_extra_debug_sigprint(); 01053 01054 const u32 row_offset = (in_id < 0) ? -in_id : 0; 01055 const u32 col_offset = (in_id > 0) ? in_id : 0; 01056 01057 arma_debug_check 01058 ( 01059 (row_offset >= n_rows) || (col_offset >= n_cols), 01060 "Mat::diag(): out of bounds" 01061 ); 01062 01063 01064 const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset); 01065 01066 return diagview<eT>(*this, row_offset, col_offset, len); 01067 }
void Mat< eT >::swap_rows | ( | const u32 | in_row1, | |
const u32 | in_row2 | |||
) | [inline, inherited] |
Definition at line 1074 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(), and auxlib::lu().
01075 { 01076 arma_extra_debug_sigprint(); 01077 01078 arma_debug_check 01079 ( 01080 (in_row1 >= n_rows) || (in_row2 >= n_rows), 01081 "Mat::swap_rows(): out of bounds" 01082 ); 01083 01084 for(u32 col=0; col<n_cols; ++col) 01085 { 01086 const u32 offset = col*n_rows; 01087 const u32 pos1 = in_row1 + offset; 01088 const u32 pos2 = in_row2 + offset; 01089 01090 const eT tmp = mem[pos1]; 01091 access::rw(mem[pos1]) = mem[pos2]; 01092 access::rw(mem[pos2]) = tmp; 01093 } 01094 01095 }
void Mat< eT >::swap_cols | ( | const u32 | in_col1, | |
const u32 | in_col2 | |||
) | [inline, inherited] |
Definition at line 1102 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().
01103 { 01104 arma_extra_debug_sigprint(); 01105 01106 arma_debug_check 01107 ( 01108 (in_col1 >= n_cols) || (in_col2 >= n_cols), 01109 "Mat::swap_cols(): out of bounds" 01110 ); 01111 01112 eT* ptr1 = colptr(in_col1); 01113 eT* ptr2 = colptr(in_col2); 01114 01115 for(u32 row=0; row<n_rows; ++row) 01116 { 01117 const eT tmp = ptr1[row]; 01118 ptr1[row] = ptr2[row]; 01119 ptr2[row] = tmp; 01120 } 01121 01122 }
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 1130 of file Mat_meat.hpp.
01131 : n_rows(0) 01132 , n_cols(0) 01133 , n_elem(0) 01134 , use_aux_mem(false) 01135 //, mem(0) 01136 , mem(mem) 01137 { 01138 arma_extra_debug_sigprint_this(this); 01139 01140 isnt_same_type<eT, typename T1::elem_type>::check(); 01141 01142 op_type::apply(*this, X); 01143 }
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 1152 of file Mat_meat.hpp.
01153 { 01154 arma_extra_debug_sigprint(); 01155 01156 isnt_same_type<eT, typename T1::elem_type>::check(); 01157 01158 op_type::apply(*this, X); 01159 01160 return *this; 01161 }
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 1170 of file Mat_meat.hpp.
References glue_plus::apply_inplace().
01171 { 01172 arma_extra_debug_sigprint(); 01173 01174 isnt_same_type<eT, typename T1::elem_type>::check(); 01175 01176 glue_plus::apply_inplace(*this, X); 01177 01178 return *this; 01179 }
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 1188 of file Mat_meat.hpp.
References glue_minus::apply_inplace().
01189 { 01190 arma_extra_debug_sigprint(); 01191 01192 isnt_same_type<eT, typename T1::elem_type>::check(); 01193 01194 glue_minus::apply_inplace(*this, X); 01195 01196 return *this; 01197 }
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 1206 of file Mat_meat.hpp.
References glue_times::apply_inplace().
01207 { 01208 arma_extra_debug_sigprint(); 01209 01210 isnt_same_type<eT, typename T1::elem_type>::check(); 01211 01212 glue_times::apply_inplace(*this, X); 01213 01214 return *this; 01215 }
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 1224 of file Mat_meat.hpp.
References glue_schur::apply_inplace().
01225 { 01226 arma_extra_debug_sigprint(); 01227 01228 isnt_same_type<eT, typename T1::elem_type>::check(); 01229 glue_schur::apply_inplace(*this, X); 01230 01231 return *this; 01232 }
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 1241 of file Mat_meat.hpp.
References glue_div::apply_inplace().
01242 { 01243 arma_extra_debug_sigprint(); 01244 01245 isnt_same_type<eT, typename T1::elem_type>::check(); 01246 glue_div::apply_inplace(*this, X); 01247 01248 return *this; 01249 }
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 1257 of file Mat_meat.hpp.
References Mat< eT >::operator=().
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 1276 of file Mat_meat.hpp.
01277 { 01278 arma_extra_debug_sigprint(); 01279 01280 // TODO: 01281 // it may be simpler to pass the two objects (currently wrapped in X) 01282 // directly to the apply function. 01283 // (many adjustments throughout the source code will be required) 01284 01285 isnt_same_type<eT, typename T1::elem_type>::check(); 01286 isnt_same_type<eT, typename T2::elem_type>::check(); 01287 01288 glue_type::apply(*this, X); 01289 01290 return *this; 01291 }
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 1299 of file Mat_meat.hpp.
References glue_plus::apply_inplace().
01300 { 01301 arma_extra_debug_sigprint(); 01302 01303 isnt_same_type<eT, typename T1::elem_type>::check(); 01304 isnt_same_type<eT, typename T2::elem_type>::check(); 01305 01306 glue_plus::apply_inplace(*this, X); 01307 01308 return *this; 01309 }
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 1318 of file Mat_meat.hpp.
References glue_minus::apply_inplace().
01319 { 01320 arma_extra_debug_sigprint(); 01321 01322 isnt_same_type<eT, typename T1::elem_type>::check(); 01323 isnt_same_type<eT, typename T2::elem_type>::check(); 01324 01325 glue_minus::apply_inplace(*this, X); 01326 01327 return *this; 01328 }
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 1337 of file Mat_meat.hpp.
References glue_times::apply_inplace().
01338 { 01339 arma_extra_debug_sigprint(); 01340 01341 isnt_same_type<eT, typename T1::elem_type>::check(); 01342 isnt_same_type<eT, typename T2::elem_type>::check(); 01343 01344 glue_times::apply_inplace(*this, X); 01345 return *this; 01346 }
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 1355 of file Mat_meat.hpp.
References glue_schur::apply_inplace().
01356 { 01357 arma_extra_debug_sigprint(); 01358 01359 isnt_same_type<eT, typename T1::elem_type>::check(); 01360 isnt_same_type<eT, typename T2::elem_type>::check(); 01361 01362 glue_schur::apply_inplace(*this, X); 01363 return *this; 01364 }
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 1373 of file Mat_meat.hpp.
References glue_div::apply_inplace().
01374 { 01375 arma_extra_debug_sigprint(); 01376 01377 isnt_same_type<eT, typename T1::elem_type>::check(); 01378 isnt_same_type<eT, typename T2::elem_type>::check(); 01379 01380 glue_div::apply_inplace(*this, X); 01381 return *this; 01382 }
linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
Definition at line 1390 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_elem, and access::rw().
01391 { 01392 arma_debug_check( (i >= n_elem), "Mat::operator(): index out of bounds"); 01393 return access::rw(mem[i]); 01394 }
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 1402 of file Mat_meat.hpp.
References Mat< eT >::mem, and Mat< eT >::n_elem.
linear element accessor (treats the matrix as a vector); no bounds check.
Definition at line 1413 of file Mat_meat.hpp.
References Mat< eT >::mem, and access::rw().
01414 { 01415 return access::rw(mem[i]); 01416 }
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 1424 of file Mat_meat.hpp.
References Mat< eT >::mem.
01425 { 01426 return mem[i]; 01427 }
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 1435 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_cols, Mat< eT >::n_rows, and access::rw().
01436 { 01437 arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator(): index out of bounds"); 01438 return access::rw(mem[in_row + in_col*n_rows]); 01439 }
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 1447 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_cols, and Mat< eT >::n_rows.
arma_inline eT & Mat< eT >::at | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | [inline, inherited] |
element accessor; no bounds check
Definition at line 1459 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_ones_diag::apply(), op_min::apply(), op_median::apply(), op_mean::apply(), op_max::apply(), op_inv::apply(), op_diagmat_vec::apply(), op_diagmat::apply(), glue_times_diag::apply(), glue_times::apply(), glue_schur_diag::apply(), glue_plus_diag::apply(), glue_plus::apply(), glue_minus_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_diagvec(), glue_times::apply_inplace(), op_trans::apply_noalias(), det(), auxlib::det(), diagmat(), glue_times::direct_rowvec_diagmat_colvec(), glue_times::direct_rowvec_invdiagmat_colvec(), glue_times::direct_rowvec_mat_colvec(), 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::lu(), operator*(), operator/(), operator<<(), diagview< eT >::operator=(), arma_ostream::print(), prod(), auxlib::qr(), diskio::save_arma_ascii(), diskio::save_ppm_binary(), diskio::save_raw_ascii(), trace(), and diagview< eT >::zeros().
01460 { 01461 return access::rw( mem[in_row + in_col*n_rows] ); 01462 }
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 1470 of file Mat_meat.hpp.
References Mat< eT >::mem, and Mat< eT >::n_rows.
prefix ++
Definition at line 1481 of file Mat_meat.hpp.
References Mat_aux::prefix_pp().
01482 { 01483 Mat_aux::prefix_pp(*this); 01484 return *this; 01485 }
arma_inline void Mat< eT >::operator++ | ( | int | ) | [inline, inherited] |
postfix ++ (must not return the object by reference)
Definition at line 1493 of file Mat_meat.hpp.
References Mat_aux::postfix_pp().
01494 { 01495 Mat_aux::postfix_pp(*this); 01496 }
prefix --
Definition at line 1504 of file Mat_meat.hpp.
References Mat_aux::prefix_mm().
01505 { 01506 Mat_aux::prefix_mm(*this); 01507 return *this; 01508 }
arma_inline void Mat< eT >::operator-- | ( | int | ) | [inline, inherited] |
postfix -- (must not return the object by reference)
Definition at line 1516 of file Mat_meat.hpp.
References Mat_aux::postfix_mm().
01517 { 01518 Mat_aux::postfix_mm(*this); 01519 }
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 1527 of file Mat_meat.hpp.
References Mat< eT >::n_cols, and Mat< eT >::n_rows.
Referenced by accu(), op_shuffle::apply(), op_inv::apply_diagvec(), glue_plus::apply_inplace(), det(), op_cor::direct_cor(), glue_cor::direct_cor(), op_cov::direct_cov(), glue_cov::direct_cov(), operator<<(), trace(), and running_stat_vec_aux::update_stats().
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 1538 of file Mat_meat.hpp.
References Mat< eT >::n_cols, Mat< eT >::n_elem, and Mat< eT >::n_rows.
Referenced by accu(), op_inv::apply(), op_diagmat::apply(), glue_times_diag::apply(), glue_schur_diag::apply(), glue_plus_diag::apply(), glue_minus_diag::apply(), det(), operator<<(), and trace().
arma_inline bool Mat< eT >::is_finite | ( | ) | const [inline, inherited] |
returns true if all of the elements are finite
Definition at line 1549 of file Mat_meat.hpp.
References arma_isfinite(), Mat< eT >::mem, and Mat< eT >::n_elem.
Referenced by op_sort::apply().
01550 { 01551 for(u32 i=0; i<n_elem; ++i) 01552 { 01553 if(arma_isfinite(mem[i]) == false) 01554 { 01555 return false; 01556 } 01557 } 01558 01559 return true; 01560 }
returns a pointer to array of eTs for a specified column; no bounds check
Definition at line 1568 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_rows, and access::rw().
Referenced by op_var::apply(), op_trans::apply(), op_sum::apply(), op_stddev::apply(), op_sort::apply(), op_prod::apply(), op_min::apply(), op_median::apply(), op_mean::apply(), op_max::apply(), op_diagmat::apply(), glue_times_diag::apply(), glue_times::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(), glue_times::apply_inplace(), auxlib::chol(), auxlib::det(), glue_times::direct_rowvec_mat_colvec(), subview< eT >::div_inplace(), subview_cube< eT >::div_inplace(), subview< eT >::extract(), subview_cube< eT >::extract(), auxlib::inv_inplace(), auxlib::inv_noalias(), subview< eT >::minus_inplace(), subview_cube< eT >::minus_inplace(), glue_times_vec::mul_col_row(), glue_times_vec::mul_col_row_inplace_add(), subview< eT >::plus_inplace(), subview_cube< eT >::plus_inplace(), subview< eT >::schur_inplace(), subview_cube< eT >::schur_inplace(), auxlib::solve_od(), auxlib::solve_ud(), Mat< eT >::swap_cols(), and op_diagmat::zero_offdiag().
01569 { 01570 return & access::rw(mem[in_col*n_rows]); 01571 }
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 1579 of file Mat_meat.hpp.
References Mat< eT >::mem, and Mat< eT >::n_rows.
arma_inline eT * Mat< eT >::memptr | ( | ) | [inline, inherited] |
returns a pointer to array of eTs used by the matrix
Definition at line 1590 of file Mat_meat.hpp.
References Mat< eT >::mem.
Referenced by abs(), op_atanh::apply(), op_tanh::apply(), op_atan::apply(), op_tan::apply(), op_asinh::apply(), op_sinh::apply(), op_asin::apply(), op_sin::apply(), op_acosh::apply(), op_cosh::apply(), op_acos::apply(), op_cos::apply(), op_sort::apply(), op_scalar_div_post::apply(), op_scalar_div_pre::apply(), op_scalar_times::apply(), op_scalar_minus_post::apply(), op_scalar_minus_pre::apply(), op_scalar_plus::apply(), op_reshape::apply(), op_randn::apply(), op_rand::apply(), op_neg::apply(), op_conj::apply(), op_pow_s32::apply(), op_pow::apply(), op_square::apply(), op_sqrt::apply(), op_trunc_exp::apply(), op_exp::apply(), op_log10::apply(), op_trunc_log::apply(), op_log::apply(), glue_times_vec::apply(), glue_schur::apply(), glue_plus::apply(), glue_minus::apply(), glue_div::apply(), gemm< do_trans_A, do_trans_B, use_alpha, use_beta >::apply_blas_type(), glue_schur::apply_inplace(), glue_plus::apply_inplace(), glue_minus::apply_inplace(), glue_div::apply_inplace(), op_trans::apply_noalias(), subview_cube< eT >::check_overlap(), auxlib::chol(), auxlib::det(), glue_cor::direct_cor(), glue_cov::direct_cov(), op_eps::direct_eps(), subview< eT >::div_inplace(), auxlib::eig_gen(), auxlib::eig_sym(), subview< eT >::extract(), diagview< eT >::extract(), conv_to< Col< out_eT > >::from(), conv_to< Row< out_eT > >::from(), conv_to< Mat< out_eT > >::from(), imag(), Mat< eT >::init(), auxlib::inv_inplace(), auxlib::inv_noalias(), diskio::load_arma_binary(), auxlib::lu(), Mat< eT >::Mat(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), subview< 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(), real(), subview< eT >::schur_inplace(), auxlib::solve(), auxlib::solve_od(), auxlib::solve_ud(), auxlib::svd(), and running_stat_vec_aux::update_stats().
01591 { 01592 return const_cast<eT*>(mem); 01593 }
arma_inline const eT * Mat< eT >::memptr | ( | ) | const [inline, inherited] |
returns a pointer to array of eTs used by the matrix
Definition at line 1601 of file Mat_meat.hpp.
References Mat< eT >::mem.
01602 { 01603 return mem; 01604 }
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 1615 of file Mat_meat.hpp.
Referenced by Mat< eT >::print(), Mat< eT >::print_trans(), and Mat< eT >::raw_print().
01616 { 01617 arma_extra_debug_sigprint(); 01618 01619 if(extra_text.length() != 0) 01620 { 01621 const std::streamsize orig_width = cout.width(); 01622 01623 cout << extra_text << '\n'; 01624 01625 cout.width(orig_width); 01626 } 01627 01628 arma_ostream::print(cout, *this, true); 01629 }
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 1640 of file Mat_meat.hpp.
References Mat< eT >::print().
01641 { 01642 arma_extra_debug_sigprint(); 01643 01644 if(extra_text.length() != 0) 01645 { 01646 const std::streamsize orig_width = user_stream.width(); 01647 01648 user_stream << extra_text << '\n'; 01649 01650 user_stream.width(orig_width); 01651 } 01652 01653 arma_ostream::print(user_stream, *this, true); 01654 }
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 1665 of file Mat_meat.hpp.
References op_trans::apply_noalias(), and Mat< eT >::print().
01666 { 01667 arma_extra_debug_sigprint(); 01668 01669 Mat<eT> tmp; 01670 op_trans::apply_noalias(tmp, *this); 01671 01672 tmp.print(extra_text); 01673 }
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 1684 of file Mat_meat.hpp.
References op_trans::apply_noalias(), and Mat< eT >::print().
01685 { 01686 arma_extra_debug_sigprint(); 01687 01688 Mat<eT> tmp; 01689 op_trans::apply_noalias(tmp, *this); 01690 01691 tmp.print(user_stream, extra_text); 01692 }
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 1703 of file Mat_meat.hpp.
References Mat< eT >::print().
Referenced by Mat< eT >::raw_print_trans().
01704 { 01705 arma_extra_debug_sigprint(); 01706 01707 if(extra_text.length() != 0) 01708 { 01709 const std::streamsize orig_width = cout.width(); 01710 01711 cout << extra_text << '\n'; 01712 01713 cout.width(orig_width); 01714 } 01715 01716 arma_ostream::print(cout, *this, false); 01717 }
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 1728 of file Mat_meat.hpp.
References Mat< eT >::print().
01729 { 01730 arma_extra_debug_sigprint(); 01731 01732 if(extra_text.length() != 0) 01733 { 01734 const std::streamsize orig_width = user_stream.width(); 01735 01736 user_stream << extra_text << '\n'; 01737 01738 user_stream.width(orig_width); 01739 } 01740 01741 arma_ostream::print(user_stream, *this, false); 01742 }
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 1753 of file Mat_meat.hpp.
References op_trans::apply_noalias(), and Mat< eT >::raw_print().
01754 { 01755 arma_extra_debug_sigprint(); 01756 01757 Mat<eT> tmp; 01758 op_trans::apply_noalias(tmp, *this); 01759 01760 tmp.raw_print(extra_text); 01761 }
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 1772 of file Mat_meat.hpp.
References op_trans::apply_noalias(), and Mat< eT >::raw_print().
01773 { 01774 arma_extra_debug_sigprint(); 01775 01776 Mat<eT> tmp; 01777 op_trans::apply_noalias(tmp, *this); 01778 01779 tmp.raw_print(user_stream, extra_text); 01780 }
void Mat< eT >::set_size | ( | const u32 | in_rows, | |
const u32 | in_cols | |||
) | [inline, inherited] |
change the matrix to have user specified dimensions (data is not preserved)
Reimplemented in Col< eT >, and Row< eT >.
Definition at line 1788 of file Mat_meat.hpp.
References Mat< eT >::init().
Referenced by op_var::apply(), op_trans::apply(), op_sum::apply(), op_stddev::apply(), op_reshape::apply(), op_repmat::apply(), op_randn::apply(), op_rand::apply(), op_prod::apply(), op_min::apply(), op_median::apply(), op_mean::apply(), op_max::apply(), op_diagmat::apply(), glue_times_vec::apply(), glue_times_diag::apply(), glue_times::apply(), glue_schur::apply(), glue_plus::apply(), glue_minus::apply(), glue_div::apply(), op_trans::apply_noalias(), glue_times::apply_noalias(), op_cor::direct_cor(), glue_cor::direct_cor(), glue_cov::direct_cov(), glue_kron::direct_kron(), eig_gen(), auxlib::eig_gen(), subview< eT >::extract(), subview_cube< eT >::extract(), diagview< eT >::extract(), Mat< eT >::init(), auxlib::inv_noalias(), linspace(), diskio::load_arma_ascii(), diskio::load_arma_binary(), diskio::load_pgm_binary(), diskio::load_ppm_binary(), diskio::load_raw_ascii(), auxlib::lu(), Mat< eT >::ones(), auxlib::qr(), auxlib::solve_od(), auxlib::solve_ud(), auxlib::svd(), and Mat< eT >::zeros().
01789 { 01790 arma_extra_debug_sigprint(); 01791 01792 init(in_n_rows, in_n_cols); 01793 }
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
Definition at line 1802 of file Mat_meat.hpp.
References Mat< eT >::init(), Mat< eT >::n_cols, and Mat< eT >::n_rows.
Referenced by op_atanh::apply(), op_tanh::apply(), op_atan::apply(), op_tan::apply(), op_asinh::apply(), op_sinh::apply(), op_asin::apply(), op_sin::apply(), op_acosh::apply(), op_cosh::apply(), op_acos::apply(), op_cos::apply(), op_sort::apply(), op_shuffle::apply(), op_scalar_div_post::apply(), op_scalar_div_pre::apply(), op_scalar_times::apply(), glue_schur::apply(), glue_plus_diag::apply(), glue_plus::apply(), glue_minus_diag::apply(), glue_minus::apply(), glue_div::apply(), op_eps::direct_eps(), unwrap_write< Col< eT > >::unwrap_write(), unwrap_write< Row< eT > >::unwrap_write(), and unwrap_write< Mat< eT > >::unwrap_write().
void Mat< eT >::fill | ( | const eT | val | ) | [inline, inherited] |
fill the matrix with the specified value
Definition at line 1815 of file Mat_meat.hpp.
References Mat< eT >::mem, Mat< eT >::n_elem, and access::rw().
Referenced by Mat< eT >::ones(), operator*(), operator/(), and Mat< eT >::zeros().
01816 { 01817 arma_extra_debug_sigprint(); 01818 01819 for(u32 i=0; i<n_elem; ++i) 01820 { 01821 access::rw(mem[i]) = val; 01822 } 01823 }
void Mat< eT >::zeros | ( | ) | [inline, inherited] |
Reimplemented in Col< eT >, and Row< eT >.
Definition at line 1830 of file Mat_meat.hpp.
References Mat< eT >::fill().
Referenced by op_zeros::apply(), op_ones_diag::apply(), op_inv::apply(), op_diagmat_vec::apply(), op_diagmat::apply(), glue_times_diag::apply(), glue_schur_diag::apply(), glue_plus_diag::apply(), glue_minus_diag::apply(), op_inv::apply_diagvec(), diagmat(), op_pinv::direct_pinv(), subview< eT >::minus_inplace(), operator*(), operator/(), auxlib::solve_ud(), and running_stat_vec_aux::update_stats().
01831 { 01832 arma_extra_debug_sigprint(); 01833 01834 fill(eT(0)); 01835 }
void Mat< eT >::zeros | ( | const u32 | in_rows, | |
const u32 | in_cols | |||
) | [inline, inherited] |
Reimplemented in Col< eT >, and Row< eT >.
Definition at line 1842 of file Mat_meat.hpp.
References Mat< eT >::fill(), and Mat< eT >::set_size().
01843 { 01844 arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d") % in_rows % in_cols ); 01845 01846 set_size(in_rows, in_cols); 01847 fill(eT(0)); 01848 }
void Mat< eT >::ones | ( | ) | [inline, inherited] |
Reimplemented in Col< eT >, and Row< eT >.
Definition at line 1855 of file Mat_meat.hpp.
References Mat< eT >::fill().
Referenced by op_ones_full::apply().
01856 { 01857 arma_extra_debug_sigprint(); 01858 01859 fill(eT(1)); 01860 }
void Mat< eT >::ones | ( | const u32 | in_rows, | |
const u32 | in_cols | |||
) | [inline, inherited] |
Reimplemented in Col< eT >, and Row< eT >.
Definition at line 1867 of file Mat_meat.hpp.
References Mat< eT >::fill(), and Mat< eT >::set_size().
01868 { 01869 arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d") % in_rows % in_cols ); 01870 01871 set_size(in_rows, in_cols); 01872 fill(eT(1)); 01873 }
void Mat< eT >::reset | ( | ) | [inline, inherited] |
Definition at line 1880 of file Mat_meat.hpp.
References Mat< eT >::init().
Referenced by diskio::load_arma_ascii(), diskio::load_arma_binary(), diskio::load_auto_detect(), diskio::load_pgm_binary(), diskio::load_raw_ascii(), and running_stat_vec< eT >::reset().
01881 { 01882 arma_extra_debug_sigprint(); 01883 01884 init(0,0); 01885 }
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 1893 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().
01894 { 01895 arma_extra_debug_sigprint(); 01896 01897 switch(type) 01898 { 01899 case raw_ascii: 01900 diskio::save_raw_ascii(*this, name); 01901 break; 01902 01903 case arma_ascii: 01904 diskio::save_arma_ascii(*this, name); 01905 break; 01906 01907 case arma_binary: 01908 diskio::save_arma_binary(*this, name); 01909 break; 01910 01911 case pgm_binary: 01912 diskio::save_pgm_binary(*this, name); 01913 break; 01914 01915 default: 01916 arma_stop("Mat::save(): unsupported file type"); 01917 } 01918 01919 }
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 1927 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.
Referenced by diskio::load_pgm_binary(), and diskio::load_raw_ascii().
01928 { 01929 arma_extra_debug_sigprint(); 01930 01931 switch(type) 01932 { 01933 case auto_detect: 01934 diskio::load_auto_detect(*this, name); 01935 break; 01936 01937 case raw_ascii: 01938 diskio::load_raw_ascii(*this, name); 01939 break; 01940 01941 case arma_ascii: 01942 diskio::load_arma_ascii(*this, name); 01943 break; 01944 01945 case arma_binary: 01946 diskio::load_arma_binary(*this, name); 01947 break; 01948 01949 case pgm_binary: 01950 diskio::load_pgm_binary(*this, name); 01951 break; 01952 01953 default: 01954 arma_stop("Mat::load(): unsupported file type"); 01955 } 01956 01957 }
arma_inline void Mat_aux::prefix_pp | ( | Mat< eT > & | x | ) | [inline, static, inherited] |
prefix ++
Definition at line 1965 of file Mat_meat.hpp.
References Mat< eT >::memptr(), and Mat< eT >::n_elem.
Referenced by Mat< eT >::operator++().
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 1982 of file Mat_meat.hpp.
arma_inline void Mat_aux::postfix_pp | ( | Mat< eT > & | x | ) | [inline, static, inherited] |
postfix ++
Definition at line 1993 of file Mat_meat.hpp.
References Mat< eT >::memptr(), and Mat< eT >::n_elem.
Referenced by Mat< eT >::operator++().
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 2010 of file Mat_meat.hpp.
arma_inline void Mat_aux::prefix_mm | ( | Mat< eT > & | x | ) | [inline, static, inherited] |
prefix --
Definition at line 2021 of file Mat_meat.hpp.
References Mat< eT >::memptr(), and Mat< eT >::n_elem.
Referenced by Mat< eT >::operator--().
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 2038 of file Mat_meat.hpp.
arma_inline void Mat_aux::postfix_mm | ( | Mat< eT > & | x | ) | [inline, static, inherited] |
postfix --
Definition at line 2049 of file Mat_meat.hpp.
References Mat< eT >::memptr(), and Mat< eT >::n_elem.
Referenced by Mat< eT >::operator--().
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 2066 of file Mat_meat.hpp.