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::set_size (const u32 in_rows, const u32 in_cols) |
change the matrix to have user specified dimensions (data is not preserved) | |
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 (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 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< typename Mat< eT >::pod_type, T1 > &A, const Base< typename Mat< eT >::pod_type, T2 > &B) | |
for constructing a complex matrix out of two non-complex matrices | |
Mat::Mat (const subview< eT > &X) | |
construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation) | |
const 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 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, optionally preceding with a user specified line of text | |
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::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_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 }
construct the matrix to have user specified dimensions
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] |
change the matrix to have user specified dimensions (data is not preserved)
Reimplemented in Col< eT >, and Row< eT >.
Definition at line 75 of file Mat_meat.hpp.
References Mat< eT >::init().
Referenced by op_var::apply(), 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_trans::apply(), op_sum::apply(), op_stddev::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_randn::apply(), op_rand::apply(), op_ones_full::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(), 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_diag::apply(), glue_plus::apply(), glue_minus_diag::apply(), glue_minus::apply(), glue_div::apply(), glue_plus::apply_mixed(), op_trans::apply_noalias(), glue_times::apply_noalias(), eig_gen(), auxlib::eig_gen(), subview< eT >::extract(), diagview< eT >::extract(), Mat< eT >::init(), auxlib::inv_noalias(), linspace(), diskio::load_arma_ascii(), diskio::load_arma_binary(), diskio::load_field_ppm_binary(), diskio::load_pgm_binary(), diskio::load_raw_ascii(), auxlib::lu(), auxlib::qr(), reshape(), auxlib::solve_od(), auxlib::solve_ud(), auxlib::svd(), and Mat< eT >::zeros().
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] |
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 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().
Referenced by Mat< eT >::init(), Mat< eT >::Mat(), Mat< eT >::operator=(), Mat< eT >::reset(), and Mat< eT >::set_size().
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 }
create the matrix from a textual description
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] |
create the matrix from a textual description
Reimplemented in Col< eT >, and Row< eT >.
Definition at line 156 of file Mat_meat.hpp.
References Mat< eT >::init().
Referenced by Mat< eT >::Mat().
00157 { 00158 arma_extra_debug_sigprint(); 00159 00160 init( std::string(text) ); 00161 return *this; 00162 }
create the matrix from a textual description
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] |
create the matrix from a textual description
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] |
internal function to create the matrix from a textual description
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] |
Set the matrix to be equal to the specified scalar. NOTE: the size of the matrix will be 1x1.
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] |
In-place addition of a scalar to all elements of the matrix.
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] |
In-place subtraction of a scalar from all elements of the matrix.
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] |
In-place multiplication of all elements of the matrix with a scalar.
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] |
In-place division of all elements of the matrix with a scalar.
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 }
construct a matrix from a given matrix
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] |
construct a matrix from a given matrix
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 }
construct a matrix from a given matrix
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] |
construct a matrix from a given auxillary array of eTs
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] |
in-place matrix addition
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] |
in-place matrix subtraction
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] |
in-place matrix multiplication
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] |
in-place element-wise matrix multiplication
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] |
in-place element-wise matrix division
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 Base< typename Mat< eT >::pod_type, T1 > & | A, | |
const Base< typename Mat< eT >::pod_type, T2 > & | B | |||
) | [inline, inherited] |
for constructing a complex matrix out of two non-complex matrices
< compile-time abort if eT isn't std::complex
< compile-time abort if T is std::complex
< compile-time abort if types are not compatible
Definition at line 524 of file Mat_meat.hpp.
References arma_assert_same_size(), Mat< eT >::mem, Mat< eT >::n_cols, and access::rw().
00528 : n_rows(0) 00529 , n_cols(0) 00530 , n_elem(0) 00531 //, mem(0) 00532 , mem(mem) 00533 { 00534 arma_extra_debug_sigprint_this(this); 00535 00536 arma_type_check< is_complex<eT>::value == false >::apply(); //!< compile-time abort if eT isn't std::complex 00537 00538 typedef typename T1::elem_type T; 00539 arma_type_check< is_complex<T>::value == true >::apply(); //!< compile-time abort if T is std::complex 00540 00541 isnt_same_type<std::complex<T>, eT>::check(); //!< compile-time abort if types are not compatible 00542 00543 const unwrap<T1> tmp_A(A.get_ref()); 00544 const unwrap<T2> tmp_B(B.get_ref()); 00545 00546 const Mat<T>& X = tmp_A.M; 00547 const Mat<T>& Y = tmp_B.M; 00548 00549 arma_assert_same_size(X, Y, "Mat()"); 00550 00551 init(X.n_rows, Y.n_cols); 00552 00553 const T* X_mem = X.mem; 00554 const T* Y_mem = Y.mem; 00555 00556 for(u32 i=0; i<n_elem; ++i) 00557 { 00558 access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]); 00559 } 00560 }
construct a matrix from subview (e.g. construct a matrix from a delayed submatrix operation)
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] |
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 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] |
in-place matrix addition (using a submatrix on the right-hand-side)
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] |
in-place matrix subtraction (using a submatrix on the right-hand-side)
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] |
in-place matrix mutiplication (using a submatrix on the right-hand-side)
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] |
in-place element-wise matrix mutiplication (using a submatrix on the right-hand-side)
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] |
in-place element-wise matrix division (using a submatrix on the right-hand-side)
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 }
construct a matrix from diagview (e.g. construct a matrix from a delayed diag operation)
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] |
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 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] |
creation of subview (row vector)
Definition at line 698 of file Mat_meat.hpp.
References Mat< eT >::n_rows.
Referenced by Mat< eT >::init(), diskio::load_arma_ascii(), diskio::load_field_ppm_binary(), diskio::load_field_std_string(), diskio::load_pgm_binary(), diskio::load_raw_ascii(), diskio::save_arma_ascii(), diskio::save_field_ppm_binary(), diskio::save_field_std_string(), diskio::save_pgm_binary(), diskio::save_raw_ascii(), and Mat< eT >::swap_cols().
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] |
creation of subview (row vector)
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] |
creation of subview (column vector)
Definition at line 728 of file Mat_meat.hpp.
References Mat< eT >::n_cols.
Referenced by Mat< eT >::init(), diskio::load_arma_ascii(), diskio::load_field_ppm_binary(), diskio::load_field_std_string(), diskio::load_pgm_binary(), diskio::load_raw_ascii(), diskio::save_arma_ascii(), diskio::save_field_ppm_binary(), diskio::save_field_std_string(), diskio::save_pgm_binary(), diskio::save_raw_ascii(), and Mat< eT >::swap_rows().
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] |
creation of subview (column vector)
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] |
creation of subview (submatrix comprised of specified row vectors)
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] |
creation of subview (submatrix comprised of specified row vectors)
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] |
creation of subview (submatrix comprised of specified column vectors)
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] |
creation of subview (submatrix comprised of specified column vectors)
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] |
creation of subview (submatrix)
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] |
creation of subview (generic submatrix)
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] |
creation of diagview (diagonal)
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] |
creation of diagview (diagonal)
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().
Referenced by auxlib::lu().
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] |
create a matrix from Op, i.e. run the previously delayed unary operations
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] |
create a matrix from Op, i.e. run the previously delayed unary operations
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] |
in-place matrix addition, with the right-hand-side operand having delayed operations
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] |
in-place matrix subtraction, with the right-hand-side operand having delayed operations
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] |
in-place matrix multiplication, with the right-hand-side operand having delayed operations
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] |
in-place matrix element-wise multiplication, with the right-hand-side operand having delayed operations
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] |
in-place matrix element-wise division, with the right-hand-side operand having delayed operations
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] |
create a matrix from Glue, i.e. run the previously delayed binary operations
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] |
create a matrix from Glue, i.e. run the previously delayed binary operations
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] |
in-place matrix addition, with the right-hand-side operands having delayed operations
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] |
in-place matrix subtraction, with the right-hand-side operands having delayed operations
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] |
in-place matrix multiplications, with the right-hand-side operands having delayed operations
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] |
in-place matrix element-wise multiplication, with the right-hand-side operands having delayed operations
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] |
in-place matrix element-wise division, with the right-hand-side operands having delayed operations
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 }
linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
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] |
linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
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 }
linear element accessor (treats the matrix as a vector); no bounds check.
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] |
linear element accessor (treats the matrix as a vector); no bounds check
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] |
element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
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] |
element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
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] |
element accessor; no bounds check
Definition at line 1303 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_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(), diagview< eT >::extract(), diagview< eT >::fill(), Mat< eT >::init(), auxlib::inv_inplace(), auxlib::inv_noalias(), diskio::load_arma_ascii(), diskio::load_field_ppm_binary(), diskio::load_pgm_binary(), diskio::load_raw_ascii(), auxlib::lu(), operator*(), operator/(), operator<<(), diagview< eT >::operator=(), auxlib::qr(), diskio::save_arma_ascii(), diskio::save_field_ppm_binary(), diskio::save_raw_ascii(), trace(), and diagview< eT >::zeros().
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] |
element accessor; no bounds check
Definition at line 1314 of file Mat_meat.hpp.
References Mat< eT >::mem, and Mat< eT >::n_rows.
prefix ++
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] |
postfix ++ (must not return the object by reference)
Definition at line 1337 of file Mat_meat.hpp.
References Mat_aux::postfix_pp().
01338 { 01339 Mat_aux::postfix_pp(*this); 01340 }
prefix --
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] |
postfix -- (must not return the object by reference)
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] |
returns true if the object can be interpreted as a column or row vector
Definition at line 1371 of file Mat_meat.hpp.
References Mat< eT >::n_cols, and Mat< eT >::n_rows.
Referenced by accu(), op_inv::apply_diagvec(), det(), operator<<(), and trace().
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 1382 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 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 }
returns a pointer to array of eTs for a specified column; no bounds check
Definition at line 1412 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_stddev::apply(), op_sort::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< eT >::extract(), auxlib::inv_inplace(), auxlib::inv_noalias(), subview< eT >::minus_inplace(), glue_times_vec::mul_col_row(), subview< eT >::plus_inplace(), subview< eT >::schur_inplace(), auxlib::solve_od(), auxlib::solve_ud(), Mat< eT >::swap_cols(), and op_diagmat::zero_offdiag().
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] |
returns a pointer to array of eTs for a specified column; no bounds check
Definition at line 1423 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 1434 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_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(), gemm< do_trans_A, do_trans_B, use_alpha, use_beta >::apply_blas_type(), glue_plus::apply_inplace(), glue_minus::apply_inplace(), glue_plus::apply_mixed(), op_trans::apply_noalias(), auxlib::chol(), auxlib::det(), subview< eT >::div_inplace(), auxlib::eig_gen(), auxlib::eig_sym(), 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(), auxlib::qr(), real(), reshape(), subview< eT >::schur_inplace(), auxlib::solve(), auxlib::solve_od(), auxlib::solve_ud(), and auxlib::svd().
01435 { 01436 return const_cast<eT*>(mem); 01437 }
arma_inline const eT * Mat< eT >::memptr | ( | ) | const [inline, inherited] |
returns a pointer to array of eTs used by the matrix
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] |
print contents of the matrix, optionally preceding with a user specified line of text
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] |
fill the matrix with the specified value
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(), operator*(), operator/(), and Mat< eT >::zeros().
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().
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(), subview< eT >::minus_inplace(), operator*(), and operator/().
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().
Referenced by diskio::load_arma_ascii(), diskio::load_arma_binary(), diskio::load_auto_detect(), diskio::load_pgm_binary(), and diskio::load_raw_ascii().
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] |
save the matrix to a file
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] |
load a matrix from a file
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.
Referenced by diskio::load_pgm_binary().
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 }
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 }
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.
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 }
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.
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 }
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.
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 }
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.