18 template<
typename eT,
typename T1>
26 template<
typename eT,
typename T1>
38 template<
typename eT,
typename T1>
50 template<
typename eT,
typename T1>
51 template<
typename op_type>
58 eT* m_mem = m_local.
memptr();
62 const umat& aa = tmp.M;
66 ( aa.is_vec() == false ),
67 "Mat::elem(): given object is not a vector" 70 const uword* aa_mem = aa.memptr();
71 const uword aa_n_elem = aa.n_elem;
74 for(i=0, j=1; j<aa_n_elem; i+=2, j+=2)
76 const uword ii = aa_mem[i];
77 const uword jj = aa_mem[j];
79 arma_debug_check( ( (ii >= m_n_elem) || (jj >= m_n_elem) ),
"Mat::elem(): index out of bounds" );
90 const uword ii = aa_mem[i];
104 template<
typename eT,
typename T1>
105 template<
typename op_type,
typename T2>
132 const umat& t_aa = t_tmp.M;
133 const umat& x_aa = x_tmp.M;
137 ( (t_aa.is_vec() ==
false) || (x_aa.
is_vec() ==
false) ),
138 "Mat::elem(): given object is not a vector" 141 const uword* t_aa_mem = t_aa.memptr();
144 const uword t_aa_n_elem = t_aa.n_elem;
149 eT* t_m_mem = t_m_local.
memptr();
152 const eT* x_m_mem = x_m_local.
memptr();
156 for(i=0, j=1; j<t_aa_n_elem; i+=2, j+=2)
158 const uword t_ii = t_aa_mem[i];
159 const uword t_jj = t_aa_mem[j];
161 const uword x_ii = x_aa_mem[i];
162 const uword x_jj = x_aa_mem[j];
166 (t_ii >= t_m_n_elem) || (t_jj >= t_m_n_elem) || (x_ii >= x_m_n_elem) || (x_jj >= x_m_n_elem),
167 "Mat::elem(): index out of bounds" 179 const uword t_ii = t_aa_mem[i];
180 const uword x_ii = x_aa_mem[i];
184 ( (t_ii >= t_m_n_elem) || (x_ii >= x_m_n_elem) ),
185 "Mat::elem(): index out of bounds" 199 template<
typename eT,
typename T1>
200 template<
typename op_type,
typename T2>
209 eT* m_mem = m_local.
memptr();
213 const umat& aa = tmp.M;
217 ( aa.is_vec() == false ),
218 "Mat::elem(): given object is not a vector" 221 const uword* aa_mem = aa.memptr();
222 const uword aa_n_elem = aa.n_elem;
226 arma_debug_check( (aa_n_elem != P.get_n_elem()),
"Mat::elem(): size mismatch" );
228 if(P.is_alias(
m) ==
false)
233 for(i=0, j=1; j<aa_n_elem; i+=2, j+=2)
235 const uword ii = aa_mem[i];
236 const uword jj = aa_mem[j];
238 arma_debug_check( ( (ii >= m_n_elem) || (jj >= m_n_elem) ),
"Mat::elem(): index out of bounds" );
249 const uword ii = aa_mem[i];
270 for(i=0, j=1; j<aa_n_elem; i+=2, j+=2)
272 const uword ii = aa_mem[i];
273 const uword jj = aa_mem[j];
275 arma_debug_check( ( (ii >= m_n_elem) || (jj >= m_n_elem) ),
"Mat::elem(): index out of bounds" );
286 const uword ii = aa_mem[i];
306 template<
typename eT,
typename T1>
313 inplace_op<op_subview_elem_equ>(val);
318 template<
typename eT,
typename T1>
325 inplace_op<op_subview_elem_equ>(eT(0));
330 template<
typename eT,
typename T1>
337 inplace_op<op_subview_elem_equ>(eT(1));
342 template<
typename eT,
typename T1>
349 inplace_op<op_subview_elem_inplace_plus>(val);
354 template<
typename eT,
typename T1>
361 inplace_op<op_subview_elem_inplace_minus>(val);
366 template<
typename eT,
typename T1>
373 inplace_op<op_subview_elem_inplace_schur>(val);
378 template<
typename eT,
typename T1>
385 inplace_op<op_subview_elem_inplace_div>(val);
395 template<
typename eT,
typename T1>
396 template<
typename T2>
403 inplace_op<op_subview_elem_equ>(x);
409 template<
typename eT,
typename T1>
410 template<
typename T2>
417 (*this).operator_equ(x);
423 template<
typename eT,
typename T1>
430 (*this).operator_equ(x);
435 template<
typename eT,
typename T1>
436 template<
typename T2>
443 inplace_op<op_subview_elem_inplace_plus>(x);
448 template<
typename eT,
typename T1>
449 template<
typename T2>
456 inplace_op<op_subview_elem_inplace_minus>(x);
461 template<
typename eT,
typename T1>
462 template<
typename T2>
469 inplace_op<op_subview_elem_inplace_schur>(x);
474 template<
typename eT,
typename T1>
475 template<
typename T2>
482 inplace_op<op_subview_elem_inplace_div>(x);
487 template<
typename eT,
typename T1>
488 template<
typename T2>
495 inplace_op<op_subview_elem_equ>(x);
500 template<
typename eT,
typename T1>
501 template<
typename T2>
508 inplace_op<op_subview_elem_inplace_plus>(x);
513 template<
typename eT,
typename T1>
514 template<
typename T2>
521 inplace_op<op_subview_elem_inplace_minus>(x);
526 template<
typename eT,
typename T1>
527 template<
typename T2>
534 inplace_op<op_subview_elem_inplace_schur>(x);
539 template<
typename eT,
typename T1>
540 template<
typename T2>
547 inplace_op<op_subview_elem_inplace_div>(x);
557 template<
typename eT,
typename T1>
565 const umat& aa = tmp1.M;
569 ( aa.is_vec() == false ),
570 "Mat::elem(): given object is not a vector" 573 const uword* aa_mem = aa.memptr();
574 const uword aa_n_elem = aa.n_elem;
578 const eT* m_mem = m_local.
memptr();
581 const bool alias = (&actual_out == &m_local);
586 Mat<eT>& out = alias ? *tmp_out : actual_out;
590 eT* out_mem = out.memptr();
593 for(i=0, j=1; j<aa_n_elem; i+=2, j+=2)
595 const uword ii = aa_mem[i];
596 const uword jj = aa_mem[j];
598 arma_debug_check( ( (ii >= m_n_elem) || (jj >= m_n_elem) ),
"Mat::elem(): index out of bounds" );
600 out_mem[i] = m_mem[ii];
601 out_mem[j] = m_mem[jj];
606 const uword ii = aa_mem[i];
610 out_mem[i] = m_mem[ii];
622 template<
typename eT,
typename T1>
623 template<
typename op_type>
631 const umat& aa = tmp1.M;
635 ( aa.is_vec() == false ),
636 "Mat::elem(): given object is not a vector" 639 const uword* aa_mem = aa.memptr();
640 const uword aa_n_elem = aa.n_elem;
645 const eT* m_mem = m_local.
memptr();
650 eT* out_mem = out.
memptr();
653 for(i=0, j=1; j<aa_n_elem; i+=2, j+=2)
655 const uword ii = aa_mem[i];
656 const uword jj = aa_mem[j];
658 arma_debug_check( ( (ii >= m_n_elem) || (jj >= m_n_elem) ),
"Mat::elem(): index out of bounds" );
668 const uword ii = aa_mem[i];
681 template<
typename eT,
typename T1>
688 mat_inplace_op<op_subview_elem_inplace_plus>(out, in);
693 template<
typename eT,
typename T1>
700 mat_inplace_op<op_subview_elem_inplace_minus>(out, in);
705 template<
typename eT,
typename T1>
712 mat_inplace_op<op_subview_elem_inplace_schur>(out, in);
717 template<
typename eT,
typename T1>
724 mat_inplace_op<op_subview_elem_inplace_div>(out, in);
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
void operator_equ(const subview_elem1< eT, T2 > &x)
void set_size(const uword in_elem)
change the matrix to have user specified dimensions (data is not preserved)
arma_aligned const Base< uword, T1 > & a
void operator*=(const eT val)
arma_inline const derived & get_ref() const
arma_aligned const Mat< eT > & m
const uword n_elem
number of elements in the matrix (read-only)
void operator-=(const eT val)
#define arma_extra_debug_print
static void minus_inplace(Mat< eT > &out, const subview_elem1 &in)
void operator+=(const eT val)
void inplace_op(const eT val)
#define arma_extra_debug_warn
static void schur_inplace(Mat< eT > &out, const subview_elem1 &in)
static void mat_inplace_op(Mat< eT > &out, const subview_elem1 &in)
static void div_inplace(Mat< eT > &out, const subview_elem1 &in)
static void extract(Mat< eT > &out, const subview_elem1 &in)
#define arma_extra_debug_sigprint
static void plus_inplace(Mat< eT > &out, const subview_elem1 &in)
void operator%=(const subview_elem1< eT, T2 > &x)
arma_aligned Mat< eT > * m_ptr
arma_inline const Op< subview_elem1< eT, T1 >, op_htrans > t() const
void operator=(const subview_elem1< eT, T2 > &x)
void operator/=(const eT val)