22 class Mat :
public Base< eT, Mat<eT> >
53 inline Mat(
const char* text);
56 inline Mat(
const std::string& text);
59 #if defined(ARMA_USE_CXX11) 60 inline Mat(
const std::initializer_list<eT>& list);
61 inline const Mat&
operator=(
const std::initializer_list<eT>& list);
64 inline Mat( eT* aux_mem,
const uword aux_n_rows,
const uword aux_n_cols,
const bool copy_aux_mem =
true,
const bool strict =
true);
65 inline Mat(
const eT* aux_mem,
const uword aux_n_rows,
const uword aux_n_cols);
89 template<
typename T1,
typename T2>
292 inline void impl_print(
const std::string& extra_text)
const;
293 inline void impl_print(std::ostream& user_stream,
const std::string& extra_text)
const;
296 inline void impl_print_trans(std::ostream& user_stream,
const std::string& extra_text)
const;
299 inline void impl_raw_print(std::ostream& user_stream,
const std::string& extra_text)
const;
302 inline void impl_raw_print_trans(std::ostream& user_stream,
const std::string& extra_text)
const;
305 template<
typename eT2>
347 inline eT
min(
uword& index_of_min_val)
const;
348 inline eT
max(
uword& index_of_max_val)
const;
350 inline eT
min(
uword& row_of_min_val,
uword& col_of_min_val)
const;
351 inline eT
max(
uword& row_of_max_val,
uword& col_of_max_val)
const;
424 inline iterator
begin();
425 inline const_iterator
begin()
const;
427 inline iterator
end();
428 inline const_iterator
end()
const;
434 inline const_col_iterator
end_col (
const uword col_num)
const;
443 inline bool empty()
const;
446 template<uword fixed_n_rows, uword fixed_n_cols>
451 static const uword fixed_n_elem = fixed_n_rows * fixed_n_cols;
461 static const uword n_rows = fixed_n_rows;
462 static const uword n_cols = fixed_n_cols;
463 static const uword n_elem = fixed_n_elem;
472 inline fixed( eT* aux_mem,
const bool copy_aux_mem =
true);
473 inline fixed(
const eT* aux_mem);
475 inline fixed(
const char* text);
476 inline fixed(
const std::string& text);
521 inline void init(
const std::string& text);
523 #if defined(ARMA_USE_CXX11) 524 inline void init(
const std::initializer_list<eT>& list);
527 template<
typename T1,
typename T2>
532 inline Mat(
const char junk,
const eT* aux_mem,
const uword aux_n_rows,
const uword aux_n_cols);
543 #ifdef ARMA_EXTRA_MAT_PROTO 544 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_MAT_PROTO) 555 template<
typename T>
arma_inline static void prefix_pp(
Mat< std::complex<T> >& x);
558 template<
typename T>
arma_inline static void postfix_pp(
Mat< std::complex<T> >& x);
561 template<
typename T>
arma_inline static void prefix_mm(
Mat< std::complex<T> >& x);
564 template<
typename T>
arma_inline static void postfix_mm(
Mat< std::complex<T> >& x);
567 template<
typename T,
typename T1>
inline static void set_real(
Mat< std::complex<T> >& out,
const Base< T,T1>& X);
570 template<
typename T,
typename T1>
inline static void set_imag(
Mat< std::complex<T> >& out,
const Base< T,T1>& X);
bool quiet_save(const std::string name, const file_type type=arma_binary) const
save the matrix to a file, without printing any error messages
get_pod_type< eT >::result pod_type
if eT is non-complex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std:...
arma_inline arma_warn_unused bool is_vec() const
returns true if the object can be interpreted as a column or row vector
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
row_iterator(Mat< eT > &in_M, const uword in_row)
row_iterator & operator--()
void set_size(const uword in_elem)
change the matrix to have user specified dimensions (data is not preserved)
arma_warn_unused bool is_finite() const
returns true if all of the elements are finite
static const uword mat_prealloc
void shed_rows(const uword in_row1, const uword in_row2)
remove specified rows
arma_inline subview< eT > submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2)
creation of subview (submatrix)
arma_inline const Mat & operator--()
prefix –
void impl_raw_print_trans(const std::string &extra_text) const
DEPRECATED FUNCTION.
uword size() const
returns the number of elements in this matrix
arma_inline arma_warn_unused bool is_colvec() const
returns true if the object can be interpreted as a column vector
'matrix transpose' operation
void init_warm(uword in_rows, uword in_cols)
internal matrix construction; if the requested size is small enough, memory from the stack is used...
const uword n_cols
number of columns in the matrix (read-only)
support class for generator functions (eg. zeros, randu, randn, ...)
arma_inline subview_col< eT > col(const uword col_num)
creation of subview (column vector)
void set_real(const Base< pod_type, T1 > &X)
arma_aligned const Mat< eT > & M
arma_inline subview_row< eT > row(const uword row_num)
creation of subview (row vector)
arma_inline const Mat & operator+=(const eT val)
In-place addition of a scalar to all elements of the matrix.
const uword n_elem
number of elements in the matrix (read-only)
arma_aligned Mat< eT > & M
const uword n_rows
number of rows in the matrix (read-only)
arma_inline subview< eT > rows(const uword in_row1, const uword in_row2)
creation of subview (submatrix comprised of specified row vectors)
bool empty() const
returns true if the matrix has no elements
void reshape(const uword in_rows, const uword in_cols, const uword dim=0)
change the matrix to have user specified dimensions (data is preserved)
void insert_cols(const uword col_num, const uword N, const bool set_to_zero=true)
arma_inline arma_warn_unused eT * colptr(const uword in_col)
returns a pointer to array of eTs for a specified column; no bounds check
void insert_rows(const uword row_num, const uword N, const bool set_to_zero=true)
row_iterator & operator++()
Class for column vectors (matrices with only one column)
arma_warn_unused eT min() const
void init(const std::string &text)
internal function to create the matrix from a textual description
eT elem_type
the type of elements stored in the matrix
void resize(const uword in_elem)
change the matrix to have user specified dimensions (data is preserved)
void set_imag(const Base< pod_type, T1 > &X)
arma_inline arma_warn_unused bool is_rowvec() const
returns true if the object can be interpreted as a row vector
bool operator!=(const row_iterator &X) const
void impl_print(const std::string &extra_text) const
col_iterator begin_col(const uword col_num)
mat_injector< Mat > operator<<(const eT val)
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the matrix as a vector); no bounds check.
arma_inline arma_warn_unused bool is_square() const
returns true if the object has the same number of non-zero rows and columnns
subview_row< eT > operator()(const uword row_num, const span &col_span)
col_iterator end_col(const uword col_num)
arma_inline const Mat & operator/=(const eT val)
In-place division of all elements of the matrix with a scalar.
arma_inline arma_warn_unused eT & operator[](const uword i)
linear element accessor (treats the matrix as a vector); no bounds check.
const Mat & operator=(const char *text)
create the matrix from a textual description
Armadillo binary format, with information about matrix type and size.
arma_inline arma_warn_unused bool in_range(const uword i) const
returns true if the given index is currently in range
arma_inline diagview< eT > diag(const sword in_id=0)
creation of diagview (diagonal)
void copy_size(const Mat< eT2 > &m)
change the matrix (without preserving data) to have the same dimensions as the given matrix ...
void swap_cols(const uword in_col1, const uword in_col2)
bool operator==(const row_iterator &X) const
'hermitian transpose' operation
void shed_col(const uword col_num)
remove specified column
const eT * const_iterator
bool load(const std::string name, const file_type type=auto_detect, const bool print_status=true)
load a matrix from a file
row_iterator end_row(const uword row_num)
Analog of the Base class, intended for cubes.
arma_inline const Mat & operator++()
prefix ++
bool quiet_load(const std::string name, const file_type type=auto_detect)
load a matrix from a file, without printing any error messages
Col< eT > unsafe_col(const uword col_num)
row_iterator begin_row(const uword row_num)
void shed_row(const uword row_num)
remove specified row
arma_inline subview_elem1< eT, T1 > elem(const Base< uword, T1 > &a)
arma_inline const Mat & operator*=(const eT val)
In-place multiplication of all elements of the matrix with a scalar.
void shed_cols(const uword in_col1, const uword in_col2)
remove specified columns
arma_aligned eT mem_local[arma_config::mat_prealloc]
arma_inline subview< eT > cols(const uword in_col1, const uword in_col2)
creation of subview (submatrix comprised of specified column vectors)
const eT * const_col_iterator
arma_aligned const eT *const mem
pointer to the memory used by the matrix (memory is read-only)
const Mat & operator%=(const Mat &m)
in-place element-wise matrix multiplication
Class for storing data required to extract and set the diagonals of a matrix.
const uhword vec_state
0: matrix layout; 1: column vector layout; 2: row vector layout
bool save(const std::string name, const file_type type=arma_binary, const bool print_status=true) const
save the matrix to a file
void clear()
resets this matrix to an empty matrix
void impl_raw_print(const std::string &extra_text) const
void impl_print_trans(const std::string &extra_text) const
DEPRECATED FUNCTION.
arma_hot const Mat & fill(const eT val)
fill the matrix with the specified value
arma_inline const Mat & operator-=(const eT val)
In-place subtraction of a scalar from all elements of the matrix.
void swap_rows(const uword in_row1, const uword in_row2)
Automatically detect the file type (file must be one of the following types)
arma_inline arma_warn_unused bool is_empty() const
returns true if the matrix has no elements
arma_warn_unused eT max() const