//! More...
Classes | |
class | diagview< eT > |
Class for storing data required to extract and set the diagonals of a matrix. More... | |
Functions | |
diagview::~diagview () | |
arma_inline | diagview::diagview (const Mat< eT > &in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 len) |
arma_inline | diagview::diagview (Mat< eT > &in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 len) |
template<typename T1 > | |
void | diagview::operator= (const Base< eT, T1 > &x) |
set a diagonal of our matrix using data from a foreign object | |
void | diagview::operator= (const diagview &x) |
set a diagonal of our matrix using a diagonal from a foreign matrix | |
static void | diagview::extract (Mat< eT > &out, const diagview &in) |
//! extract a diagonal and store it as a column vector | |
static void | diagview::plus_inplace (Mat< eT > &out, const diagview &in) |
X += Y.diagview(...). | |
static void | diagview::minus_inplace (Mat< eT > &out, const diagview &in) |
X -= Y.diagview(...). | |
static void | diagview::schur_inplace (Mat< eT > &out, const diagview &in) |
X = Y.submat(...). | |
static void | diagview::div_inplace (Mat< eT > &out, const diagview &in) |
X /= Y.diagview(...). | |
arma_inline eT & | diagview::operator[] (const u32 i) |
arma_inline eT | diagview::operator[] (const u32 i) const |
arma_inline eT & | diagview::at (const u32 in_n_row, const u32 in_n_col) |
arma_inline eT | diagview::at (const u32 in_n_row, const u32 in_n_col) const |
arma_inline eT & | diagview::operator() (const u32 i) |
arma_inline eT | diagview::operator() (const u32 i) const |
arma_inline eT & | diagview::operator() (const u32 in_n_row, const u32 in_n_col) |
arma_inline eT | diagview::operator() (const u32 in_n_row, const u32 in_n_col) const |
void | diagview::fill (const eT val) |
void | diagview::zeros () |
void | diagview::ones () |
//!
Definition at line 23 of file diagview_meat.hpp.
{ arma_extra_debug_sigprint(); }
arma_inline diagview< eT >::diagview | ( | const Mat< eT > & | in_m, | |
const u32 | in_row_offset, | |||
const u32 | in_col_offset, | |||
const u32 | len | |||
) | [protected, inherited] |
Definition at line 31 of file diagview_meat.hpp.
: m(in_m) , m_ptr(0) , row_offset(in_row_offset) , col_offset(in_col_offset) , n_rows(in_len) , n_cols( (in_len > 0) ? 1 : 0 ) , n_elem(in_len) { arma_extra_debug_sigprint(); }
arma_inline diagview< eT >::diagview | ( | Mat< eT > & | in_m, | |
const u32 | in_row_offset, | |||
const u32 | in_col_offset, | |||
const u32 | len | |||
) | [protected, inherited] |
Definition at line 47 of file diagview_meat.hpp.
: m(in_m) , m_ptr(&in_m) , row_offset(in_row_offset) , col_offset(in_col_offset) , n_rows(in_len) , n_cols( (in_len > 0) ? 1 : 0 ) , n_elem(in_len) { arma_extra_debug_sigprint(); }
void diagview< eT >::operator= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
set a diagonal of our matrix using data from a foreign object
Definition at line 66 of file diagview_meat.hpp.
References arma_check(), Mat< eT >::at(), diagview< eT >::col_offset, Base< elem_type, derived >::get_ref(), diagview< eT >::m_ptr, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_check( (m_ptr == 0), "diagview::operator=(): matrix is read only"); const unwrap<T1> tmp(o.get_ref()); const Mat<eT>& x = tmp.M; diagview& t = *this; arma_debug_check( !x.is_vec(), "diagview::operator=(): need a vector"); arma_debug_check( (t.n_elem != x.n_elem), "diagview::operator=(): diagonal and given vector have incompatible lengths"); Mat<eT>& t_m = *(t.m_ptr); for(u32 i=0; i<n_elem; ++i) { t_m.at(i+row_offset, i+col_offset) = x.mem[i]; } }
void diagview< eT >::operator= | ( | const diagview< eT > & | x | ) | [inline, inherited] |
set a diagonal of our matrix using a diagonal from a foreign matrix
Definition at line 94 of file diagview_meat.hpp.
References arma_check(), Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m, diagview< eT >::m_ptr, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_check( (m_ptr == 0), "diagview::operator=(): matrix is read only"); diagview<eT>& t = *this; arma_debug_check( (t.n_elem != x.n_elem), "diagview::operator=(): diagonals have incompatible lengths"); Mat<eT>& t_m = *(t.m_ptr); const Mat<eT>& x_m = x.m; for(u32 i=0; i<n_elem; ++i) { t_m.at(i+t.row_offset, i+t.col_offset) = x_m.at(i+x.row_offset, i+x.col_offset); } }
void diagview< eT >::extract | ( | Mat< eT > & | out, | |
const diagview< eT > & | in | |||
) | [inline, static, inherited] |
//! extract a diagonal and store it as a column vector
Definition at line 120 of file diagview_meat.hpp.
References Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m, Mat< eT >::memptr(), diagview< eT >::n_elem, diagview< eT >::row_offset, and Mat< eT >::set_size().
{ arma_extra_debug_sigprint(); const Mat<eT>& in_m = in.m; const bool alias = (&actual_out == &in_m); Mat<eT>* tmp = (alias) ? new Mat<eT> : 0; Mat<eT>& out = (alias) ? (*tmp) : actual_out; const u32 in_n_elem = in.n_elem; const u32 in_row_offset = in.row_offset; const u32 in_col_offset = in.col_offset; out.set_size(in_n_elem,1); eT* out_mem = out.memptr(); for(u32 i=0; i<in_n_elem; ++i) { out_mem[i] = in_m.at(i+in_row_offset, i+in_col_offset); } if(alias) { actual_out = out; delete tmp; } }
void diagview< eT >::plus_inplace | ( | Mat< eT > & | out, | |
const diagview< eT > & | in | |||
) | [inline, static, inherited] |
X += Y.diagview(...).
Definition at line 157 of file diagview_meat.hpp.
References Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m, Mat< eT >::memptr(), Mat< eT >::n_cols, diagview< eT >::n_elem, diagview< eT >::n_rows, Mat< eT >::n_rows, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_debug_assert_same_size(out.n_rows, out.n_cols, in.n_rows, 1, "matrix addition"); const Mat<eT>& in_m = in.m; const u32 in_n_elem = in.n_elem; const u32 in_row_offset = in.row_offset; const u32 in_col_offset = in.col_offset; eT* out_mem = out.memptr(); for(u32 i=0; i<in_n_elem; ++i) { out_mem[i] += in_m.at(i+in_row_offset, i+in_col_offset); } }
void diagview< eT >::minus_inplace | ( | Mat< eT > & | out, | |
const diagview< eT > & | in | |||
) | [inline, static, inherited] |
X -= Y.diagview(...).
Definition at line 183 of file diagview_meat.hpp.
References Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m, Mat< eT >::memptr(), Mat< eT >::n_cols, diagview< eT >::n_elem, diagview< eT >::n_rows, Mat< eT >::n_rows, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_debug_assert_same_size(out.n_rows, out.n_cols, in.n_rows, 1, "matrix subtraction"); const Mat<eT>& in_m = in.m; const u32 in_n_elem = in.n_elem; const u32 in_row_offset = in.row_offset; const u32 in_col_offset = in.col_offset; eT* out_mem = out.memptr(); for(u32 i=0; i<in_n_elem; ++i) { out_mem[i] -= in_m.at(i+in_row_offset, i+in_col_offset); } }
void diagview< eT >::schur_inplace | ( | Mat< eT > & | out, | |
const diagview< eT > & | in | |||
) | [inline, static, inherited] |
X = Y.submat(...).
Definition at line 209 of file diagview_meat.hpp.
References Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m, Mat< eT >::memptr(), Mat< eT >::n_cols, diagview< eT >::n_elem, diagview< eT >::n_rows, Mat< eT >::n_rows, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_debug_assert_same_size(out.n_rows, out.n_cols, in.n_rows, 1, "element-wise matrix multiplication"); const Mat<eT>& in_m = in.m; const u32 in_n_elem = in.n_elem; const u32 in_row_offset = in.row_offset; const u32 in_col_offset = in.col_offset; eT* out_mem = out.memptr(); for(u32 i=0; i<in_n_elem; ++i) { out_mem[i] *= in_m.at(i+in_row_offset, i+in_col_offset); } }
void diagview< eT >::div_inplace | ( | Mat< eT > & | out, | |
const diagview< eT > & | in | |||
) | [inline, static, inherited] |
X /= Y.diagview(...).
Definition at line 235 of file diagview_meat.hpp.
References Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m, Mat< eT >::memptr(), Mat< eT >::n_cols, diagview< eT >::n_elem, diagview< eT >::n_rows, Mat< eT >::n_rows, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_debug_assert_same_size(out.n_rows, out.n_cols, in.n_rows, 1, "element-wise matrix division"); const Mat<eT>& in_m = in.m; const u32 in_n_elem = in.n_elem; const u32 in_row_offset = in.row_offset; const u32 in_col_offset = in.col_offset; eT* out_mem = out.memptr(); for(u32 i=0; i<in_n_elem; ++i) { out_mem[i] /= in_m.at(i+in_row_offset, i+in_col_offset); } }
Definition at line 260 of file diagview_meat.hpp.
References diagview< eT >::col_offset, and diagview< eT >::row_offset.
{ return (*m_ptr).at(i+row_offset, i+col_offset); }
Definition at line 270 of file diagview_meat.hpp.
References diagview< eT >::col_offset, diagview< eT >::m, and diagview< eT >::row_offset.
{ return m.at(i+row_offset, i+col_offset); }
arma_inline eT & diagview< eT >::at | ( | const u32 | in_n_row, | |
const u32 | in_n_col | |||
) | [inherited] |
Definition at line 280 of file diagview_meat.hpp.
References diagview< eT >::col_offset, and diagview< eT >::row_offset.
{ return (*m_ptr).at(row+row_offset, row+col_offset); }
arma_inline eT diagview< eT >::at | ( | const u32 | in_n_row, | |
const u32 | in_n_col | |||
) | const [inherited] |
Definition at line 290 of file diagview_meat.hpp.
References diagview< eT >::col_offset, diagview< eT >::m, and diagview< eT >::row_offset.
{ return m.at(row+row_offset, row+col_offset); }
Definition at line 300 of file diagview_meat.hpp.
References arma_check(), diagview< eT >::col_offset, diagview< eT >::m_ptr, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_check( (m_ptr == 0), "diagview::operator(): matrix is read only"); arma_debug_check( (i >= n_elem), "diagview::operator(): out of bounds" ); return (*m_ptr).at(i+row_offset, i+col_offset); }
Definition at line 313 of file diagview_meat.hpp.
References diagview< eT >::col_offset, diagview< eT >::m, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_debug_check( (i >= n_elem), "diagview::operator(): out of bounds" ); return m.at(i+row_offset, i+col_offset); }
arma_inline eT & diagview< eT >::operator() | ( | const u32 | in_n_row, | |
const u32 | in_n_col | |||
) | [inherited] |
Definition at line 325 of file diagview_meat.hpp.
References arma_check(), diagview< eT >::col_offset, diagview< eT >::m_ptr, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_check( (m_ptr == 0), "diagview::operator(): matrix is read only"); arma_debug_check( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" ); return (*m_ptr).at(row+row_offset, row+col_offset); }
arma_inline eT diagview< eT >::operator() | ( | const u32 | in_n_row, | |
const u32 | in_n_col | |||
) | const [inherited] |
Definition at line 338 of file diagview_meat.hpp.
References diagview< eT >::col_offset, diagview< eT >::m, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_debug_check( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" ); return m.at(row+row_offset, row+col_offset); }
void diagview< eT >::fill | ( | const eT | val | ) | [inline, inherited] |
Definition at line 350 of file diagview_meat.hpp.
References arma_check(), Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m_ptr, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_check( (m_ptr == 0), "diagview::fill(): matrix is read only"); Mat<eT>& x = (*m_ptr); for(u32 i=0; i<n_elem; ++i) { x.at(i+row_offset, i+col_offset) = val; } }
void diagview< eT >::zeros | ( | ) | [inline, inherited] |
Definition at line 368 of file diagview_meat.hpp.
References arma_check(), Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m_ptr, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_check( (m_ptr == 0), "diagview::zeros(): matrix is read only"); Mat<eT>& x = (*m_ptr); for(u32 i=0; i<n_elem; ++i) { x.at(i+row_offset, i+col_offset) = eT(0); } }
void diagview< eT >::ones | ( | ) | [inline, inherited] |
Definition at line 386 of file diagview_meat.hpp.
References arma_check(), Mat< eT >::at(), diagview< eT >::col_offset, diagview< eT >::m_ptr, diagview< eT >::n_elem, and diagview< eT >::row_offset.
{ arma_extra_debug_sigprint(); arma_check( (m_ptr == 0), "diagview::ones(): matrix is read only"); Mat<eT>& x = (*m_ptr); for(u32 i=0; i<n_elem; ++i) { x.at(i+row_offset, i+col_offset) = eT(1); } }