31 , row_offset(in_row_offset)
32 , col_offset(in_col_offset)
81 for(i=0, j=1; j < t_n_elem; i+=2, j+=2)
83 const eT tmp_i = x_m.
at(i + x_row_offset, i + x_col_offset);
84 const eT tmp_j = x_m.
at(j + x_row_offset, j + x_col_offset);
86 t_m.
at(i + t_row_offset, i + t_col_offset) = tmp_i;
87 t_m.
at(j + t_row_offset, j + t_col_offset) = tmp_j;
92 t_m.
at(i + t_row_offset, i + t_col_offset) = x_m.
at(i + x_row_offset, i + x_col_offset);
99 (*this).operator=(tmp);
105 template<
typename eT>
118 for(
uword i=0; i<t_n_elem; ++i)
120 t_m.
at( i + t_row_offset, i + t_col_offset) += val;
126 template<
typename eT>
139 for(
uword i=0; i<t_n_elem; ++i)
141 t_m.
at( i + t_row_offset, i + t_col_offset) -= val;
147 template<
typename eT>
160 for(
uword i=0; i<t_n_elem; ++i)
162 t_m.
at( i + t_row_offset, i + t_col_offset) *= val;
168 template<
typename eT>
181 for(
uword i=0; i<t_n_elem; ++i)
183 t_m.
at( i + t_row_offset, i + t_col_offset) /= val;
190 template<
typename eT>
191 template<
typename T1>
205 ( (t.
n_elem != x.n_elem) || (x.is_vec() ==
false) ),
206 "diagview: given object has incompatible size" 215 const eT* x_mem = x.memptr();
218 for(i=0, j=1; j < t_n_elem; i+=2, j+=2)
220 const eT tmp_i = x_mem[i];
221 const eT tmp_j = x_mem[j];
223 t_m.at( i + t_row_offset, i + t_col_offset) = tmp_i;
224 t_m.at( j + t_row_offset, j + t_col_offset) = tmp_j;
229 t_m.at( i + t_row_offset, i + t_col_offset) = x_mem[i];
235 template<
typename eT>
236 template<
typename T1>
250 ( (t.
n_elem != x.n_elem) || (x.is_vec() ==
false) ),
251 "diagview: given object has incompatible size" 260 const eT* x_mem = x.memptr();
263 for(i=0, j=1; j < t_n_elem; i+=2, j+=2)
265 const eT tmp_i = x_mem[i];
266 const eT tmp_j = x_mem[j];
268 t_m.at( i + t_row_offset, i + t_col_offset) += tmp_i;
269 t_m.at( j + t_row_offset, j + t_col_offset) += tmp_j;
274 t_m.at( i + t_row_offset, i + t_col_offset) += x_mem[i];
280 template<
typename eT>
281 template<
typename T1>
295 ( (t.
n_elem != x.n_elem) || (x.is_vec() ==
false) ),
296 "diagview: given object has incompatible size" 305 const eT* x_mem = x.memptr();
308 for(i=0, j=1; j < t_n_elem; i+=2, j+=2)
310 const eT tmp_i = x_mem[i];
311 const eT tmp_j = x_mem[j];
313 t_m.at( i + t_row_offset, i + t_col_offset) -= tmp_i;
314 t_m.at( j + t_row_offset, j + t_col_offset) -= tmp_j;
319 t_m.at( i + t_row_offset, i + t_col_offset) -= x_mem[i];
325 template<
typename eT>
326 template<
typename T1>
340 ( (t.
n_elem != x.n_elem) || (x.is_vec() ==
false) ),
341 "diagview: given object has incompatible size" 350 const eT* x_mem = x.memptr();
353 for(i=0, j=1; j < t_n_elem; i+=2, j+=2)
355 const eT tmp_i = x_mem[i];
356 const eT tmp_j = x_mem[j];
358 t_m.at( i + t_row_offset, i + t_col_offset) *= tmp_i;
359 t_m.at( j + t_row_offset, j + t_col_offset) *= tmp_j;
364 t_m.at( i + t_row_offset, i + t_col_offset) *= x_mem[i];
370 template<
typename eT>
371 template<
typename T1>
385 ( (t.
n_elem != x.n_elem) || (x.is_vec() ==
false) ),
386 "diagview: given object has incompatible size" 395 const eT* x_mem = x.memptr();
398 for(i=0, j=1; j < t_n_elem; i+=2, j+=2)
400 const eT tmp_i = x_mem[i];
401 const eT tmp_j = x_mem[j];
403 t_m.at( i + t_row_offset, i + t_col_offset) /= tmp_i;
404 t_m.at( j + t_row_offset, j + t_col_offset) /= tmp_j;
409 t_m.at( i + t_row_offset, i + t_col_offset) /= x_mem[i];
416 template<
typename eT>
432 eT* out_mem = out.
memptr();
435 for(i=0, j=1; j < in_n_elem; i+=2, j+=2)
437 const eT tmp_i = in_m.
at( i + in_row_offset, i + in_col_offset );
438 const eT tmp_j = in_m.
at( j + in_row_offset, j + in_col_offset );
446 out_mem[i] = in_m.
at( i + in_row_offset, i + in_col_offset );
453 template<
typename eT>
468 eT* out_mem = out.
memptr();
471 for(i=0, j=1; j < in_n_elem; i+=2, j+=2)
473 const eT tmp_i = in_m.
at( i + in_row_offset, i + in_col_offset );
474 const eT tmp_j = in_m.
at( j + in_row_offset, j + in_col_offset );
482 out_mem[i] += in_m.
at( i + in_row_offset, i + in_col_offset );
489 template<
typename eT>
504 eT* out_mem = out.
memptr();
507 for(i=0, j=1; j < in_n_elem; i+=2, j+=2)
509 const eT tmp_i = in_m.
at( i + in_row_offset, i + in_col_offset );
510 const eT tmp_j = in_m.
at( j + in_row_offset, j + in_col_offset );
518 out_mem[i] -= in_m.
at( i + in_row_offset, i + in_col_offset );
525 template<
typename eT>
540 eT* out_mem = out.
memptr();
543 for(i=0, j=1; j < in_n_elem; i+=2, j+=2)
545 const eT tmp_i = in_m.
at( i + in_row_offset, i + in_col_offset );
546 const eT tmp_j = in_m.
at( j + in_row_offset, j + in_col_offset );
554 out_mem[i] *= in_m.
at( i + in_row_offset, i + in_col_offset );
561 template<
typename eT>
576 eT* out_mem = out.
memptr();
579 for(i=0, j=1; j < in_n_elem; i+=2, j+=2)
581 const eT tmp_i = in_m.
at( i + in_row_offset, i + in_col_offset );
582 const eT tmp_j = in_m.
at( j + in_row_offset, j + in_col_offset );
590 out_mem[i] /= in_m.
at( i + in_row_offset, i + in_col_offset );
596 template<
typename eT>
606 template<
typename eT>
616 template<
typename eT>
626 template<
typename eT>
636 template<
typename eT>
648 template<
typename eT>
660 template<
typename eT>
670 template<
typename eT>
680 template<
typename eT>
692 template<
typename eT>
704 template<
typename eT>
721 template<
typename eT>
733 template<
typename eT>
void operator+=(const eT val)
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
arma_aligned const Mat< eT > & m
static void plus_inplace(Mat< eT > &out, const diagview &in)
X += Y.diag()
static void minus_inplace(Mat< eT > &out, const diagview &in)
X -= Y.diag()
arma_inline const derived & get_ref() const
arma_aligned Mat< eT > * m_ptr
static const uword n_cols
const uword n_cols
number of columns in the matrix (read-only)
void operator-=(const eT val)
#define arma_debug_assert_same_size
void operator%=(const Base< eT, T1 > &x)
const uword n_rows
number of rows in the matrix (read-only)
arma_inline eT & at(const uword i)
void 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_aligned const Mat< eT > & m
subview_row< eT > row(const uword row_num)
creation of subview (row vector)
arma_aligned Mat< eT > * m_ptr
#define arma_extra_debug_sigprint
void operator=(const diagview &x)
set a diagonal of our matrix using a diagonal from a foreign matrix
static void schur_inplace(Mat< eT > &out, const diagview &in)
X %= Y.diag()
static void div_inplace(Mat< eT > &out, const diagview &in)
X /= Y.diag()
void operator/=(const eT val)
arma_inline eT & operator()(const uword i)
static void extract(Mat< eT > &out, const diagview &in)
extract a diagonal and store it as a column vector
Class for storing data required to extract and set the diagonals of a matrix.
arma_inline const Op< diagview< eT >, op_htrans > t() const
arma_inline eT & operator[](const uword i)
subview_col< eT > col(const uword col_num)
creation of subview (column vector)