allow avoiding unnecessary alias checks in Row and Col constructors

This commit is contained in:
conrad
2025-10-14 13:54:28 +10:00
parent ba2af98edf
commit db7395173f
4 changed files with 508 additions and 66 deletions
+10 -23
View File
@@ -483,7 +483,7 @@ Col<eT>::operator=(Col<eT>&& X)
// if(X.n_cols != 1) { const Mat<eT>& XX = X; Mat<eT>::operator=(XX); return *this; }
//
// (*this).steal_mem(X, true);
//
//
// return *this;
// }
@@ -521,11 +521,9 @@ template<typename eT>
template<typename T1>
inline
Col<eT>::Col(const Base<eT,T1>& X)
: Mat<eT>(arma_vec_indicator(), 1)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 1)
{
arma_debug_sigprint();
Mat<eT>::operator=(X.get_ref());
arma_debug_sigprint_this(this);
}
@@ -549,11 +547,9 @@ template<typename eT>
template<typename T1>
inline
Col<eT>::Col(const SpBase<eT,T1>& X)
: Mat<eT>(arma_vec_indicator(), 1)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 1)
{
arma_debug_sigprint_this(this);
Mat<eT>::operator=(X.get_ref());
}
@@ -607,12 +603,9 @@ Col<eT>::Col
const Base<typename Col<eT>::pod_type, T1>& A,
const Base<typename Col<eT>::pod_type, T2>& B
)
: Mat<eT>(A.get_ref(), B.get_ref(), arma_vec_indicator(), 1)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::init(A,B);
arma_debug_sigprint_this(this);
}
@@ -621,12 +614,9 @@ template<typename eT>
template<typename T1>
inline
Col<eT>::Col(const BaseCube<eT,T1>& X)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 1)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::operator=(X);
arma_debug_sigprint_this(this);
}
@@ -649,12 +639,9 @@ Col<eT>::operator=(const BaseCube<eT,T1>& X)
template<typename eT>
inline
Col<eT>::Col(const subview_cube<eT>& X)
: Mat<eT>(X, arma_vec_indicator(), 1)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::operator=(X);
arma_debug_sigprint_this(this);
}
+23 -2
View File
@@ -99,6 +99,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator*=(const eT val);
inline Mat& operator/=(const eT val);
inline Mat(const Mat& m, const arma_vec_indicator&, const uhword in_vec_state);
inline Mat(const Mat& m);
inline Mat& operator= (const Mat& m);
inline Mat& operator+=(const Mat& m);
@@ -107,6 +108,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator%=(const Mat& m);
inline Mat& operator/=(const Mat& m);
template<typename T1> inline Mat(const BaseCube<eT,T1>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1> inline Mat(const BaseCube<eT,T1>& X);
template<typename T1> inline Mat& operator= (const BaseCube<eT,T1>& X);
template<typename T1> inline Mat& operator+=(const BaseCube<eT,T1>& X);
@@ -115,11 +117,12 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline Mat& operator%=(const BaseCube<eT,T1>& X);
template<typename T1> inline Mat& operator/=(const BaseCube<eT,T1>& X);
template<typename T1, typename T2>
inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
template<typename T1, typename T2> inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2> inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
inline explicit Mat(const subview<eT>& X, const bool use_colmem); // only to be used by the quasi_unwrap class
inline Mat(const subview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
inline Mat(const subview<eT>& X);
inline Mat& operator= (const subview<eT>& X);
inline Mat& operator+=(const subview<eT>& X);
@@ -135,6 +138,7 @@ class Mat : public Base< eT, Mat<eT> >
template<bool do_conj>
inline Mat(const xtrans_mat<eT,do_conj>& X); // xtrans_mat can only be generated by the Proxy class
inline Mat(const subview_cube<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
inline Mat(const subview_cube<eT>& X);
inline Mat& operator= (const subview_cube<eT>& X);
inline Mat& operator+=(const subview_cube<eT>& X);
@@ -143,6 +147,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator%=(const subview_cube<eT>& X);
inline Mat& operator/=(const subview_cube<eT>& X);
inline Mat(const diagview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
inline Mat(const diagview<eT>& X);
inline Mat& operator= (const diagview<eT>& X);
inline Mat& operator+=(const diagview<eT>& X);
@@ -151,6 +156,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator%=(const diagview<eT>& X);
inline Mat& operator/=(const diagview<eT>& X);
template<typename T1> inline Mat(const subview_elem1<eT,T1>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1> inline Mat(const subview_elem1<eT,T1>& X);
template<typename T1> inline Mat& operator= (const subview_elem1<eT,T1>& X);
template<typename T1> inline Mat& operator+=(const subview_elem1<eT,T1>& X);
@@ -159,6 +165,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline Mat& operator%=(const subview_elem1<eT,T1>& X);
template<typename T1> inline Mat& operator/=(const subview_elem1<eT,T1>& X);
template<typename T1, typename T2> inline Mat(const subview_elem2<eT,T1,T2>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2> inline Mat(const subview_elem2<eT,T1,T2>& X);
template<typename T1, typename T2> inline Mat& operator= (const subview_elem2<eT,T1,T2>& X);
template<typename T1, typename T2> inline Mat& operator+=(const subview_elem2<eT,T1,T2>& X);
@@ -168,6 +175,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename T2> inline Mat& operator/=(const subview_elem2<eT,T1,T2>& X);
// Operators on sparse matrices (and subviews)
template<typename T1> inline explicit Mat(const SpBase<eT, T1>& m, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1> inline explicit Mat(const SpBase<eT, T1>& m);
template<typename T1> inline Mat& operator= (const SpBase<eT, T1>& m);
template<typename T1> inline Mat& operator+=(const SpBase<eT, T1>& m);
@@ -176,11 +184,13 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline Mat& operator%=(const SpBase<eT, T1>& m);
template<typename T1> inline Mat& operator/=(const SpBase<eT, T1>& m);
inline explicit Mat(const SpSubview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
inline explicit Mat(const SpSubview<eT>& X);
inline Mat& operator= (const SpSubview<eT>& X);
inline Mat& operator+=(const SpSubview<eT>& X);
inline Mat& operator-=(const SpSubview<eT>& X);
inline explicit Mat(const spdiagview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
inline explicit Mat(const spdiagview<eT>& X);
inline Mat& operator= (const spdiagview<eT>& X);
inline Mat& operator+=(const spdiagview<eT>& X);
@@ -320,6 +330,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X);
template<typename T1, typename gen_type> inline Mat(const Gen<T1, gen_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename gen_type> inline Mat(const Gen<T1, gen_type>& X);
template<typename T1, typename gen_type> inline Mat& operator= (const Gen<T1, gen_type>& X);
template<typename T1, typename gen_type> inline Mat& operator+=(const Gen<T1, gen_type>& X);
@@ -328,6 +339,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename gen_type> inline Mat& operator%=(const Gen<T1, gen_type>& X);
template<typename T1, typename gen_type> inline Mat& operator/=(const Gen<T1, gen_type>& X);
template<typename T1, typename op_type> inline Mat(const Op<T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename op_type> inline Mat(const Op<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator= (const Op<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator+=(const Op<T1, op_type>& X);
@@ -336,6 +348,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename op_type> inline Mat& operator%=(const Op<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator/=(const Op<T1, op_type>& X);
template<typename T1, typename eop_type> inline Mat(const eOp<T1, eop_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename eop_type> inline Mat(const eOp<T1, eop_type>& X);
template<typename T1, typename eop_type> inline Mat& operator= (const eOp<T1, eop_type>& X);
template<typename T1, typename eop_type> inline Mat& operator+=(const eOp<T1, eop_type>& X);
@@ -344,6 +357,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename eop_type> inline Mat& operator%=(const eOp<T1, eop_type>& X);
template<typename T1, typename eop_type> inline Mat& operator/=(const eOp<T1, eop_type>& X);
template<typename T1, typename op_type> inline Mat(const mtOp<eT, T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename op_type> inline Mat(const mtOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator= (const mtOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator+=(const mtOp<eT, T1, op_type>& X);
@@ -352,6 +366,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename op_type> inline Mat& operator%=(const mtOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator/=(const mtOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat(const CubeToMatOp<T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename op_type> inline Mat(const CubeToMatOp<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator= (const CubeToMatOp<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator+=(const CubeToMatOp<T1, op_type>& X);
@@ -360,6 +375,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename op_type> inline Mat& operator%=(const CubeToMatOp<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator/=(const CubeToMatOp<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat(const SpToDOp<T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename op_type> inline Mat(const SpToDOp<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator= (const SpToDOp<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator+=(const SpToDOp<T1, op_type>& X);
@@ -368,6 +384,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename op_type> inline Mat& operator%=(const SpToDOp<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator/=(const SpToDOp<T1, op_type>& X);
template<typename T1, typename op_type> inline explicit Mat(const mtSpReduceOp<eT, T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename op_type> inline explicit Mat(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator= (const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator+=(const mtSpReduceOp<eT, T1, op_type>& X);
@@ -376,6 +393,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename op_type> inline Mat& operator%=(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator/=(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat(const Glue<T1, T2, glue_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2, typename glue_type> inline Mat(const Glue<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator= (const Glue<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator+=(const Glue<T1, T2, glue_type>& X);
@@ -387,6 +405,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename T2> inline Mat& operator+=(const Glue<T1, T2, glue_times>& X);
template<typename T1, typename T2> inline Mat& operator-=(const Glue<T1, T2, glue_times>& X);
template<typename T1, typename T2, typename eglue_type> inline Mat(const eGlue<T1, T2, eglue_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2, typename eglue_type> inline Mat(const eGlue<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Mat& operator= (const eGlue<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Mat& operator+=(const eGlue<T1, T2, eglue_type>& X);
@@ -395,6 +414,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename T2, typename eglue_type> inline Mat& operator%=(const eGlue<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Mat& operator/=(const eGlue<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat(const mtGlue<eT, T1, T2, glue_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2, typename glue_type> inline Mat(const mtGlue<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator= (const mtGlue<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator+=(const mtGlue<eT, T1, T2, glue_type>& X);
@@ -403,6 +423,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename T2, typename glue_type> inline Mat& operator%=(const mtGlue<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator/=(const mtGlue<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat(const SpToDGlue<T1, T2, glue_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2, typename glue_type> inline Mat(const SpToDGlue<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator= (const SpToDGlue<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator+=(const SpToDGlue<T1, T2, glue_type>& X);
+465 -18
View File
@@ -880,7 +880,26 @@ Mat<eT>::operator/=(const eT val)
//! construct a matrix from a given matrix
template<typename eT>
inline
Mat<eT>::Mat(const Mat<eT>& in_mat, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint(arma_str::format("this: %x; in_mat: %x") % this % &in_mat);
init_cold();
arrayops::copy( memptr(), in_mat.mem, in_mat.n_elem );
}
template<typename eT>
inline
Mat<eT>::Mat(const Mat<eT>& in_mat)
@@ -901,7 +920,6 @@ Mat<eT>::Mat(const Mat<eT>& in_mat)
//! construct a matrix from a given matrix
template<typename eT>
inline
Mat<eT>&
@@ -1496,6 +1514,25 @@ Mat<eT>::operator/=(const Mat<eT>& m)
template<typename eT>
template<typename T1>
inline
Mat<eT>::Mat(const BaseCube<eT,T1>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
(*this).operator=(X);
}
template<typename eT>
template<typename T1>
inline
@@ -1943,15 +1980,30 @@ Mat<eT>::operator/=(const BaseCube<eT,T1>& X)
template<typename eT>
template<typename T1, typename T2>
inline
Mat<eT>::Mat(const Base<typename Mat<eT>::pod_type,T1>& A, const Base<typename Mat<eT>::pod_type,T2>& B, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
init(A,B);
}
//! for constructing a complex matrix out of two non-complex matrices
template<typename eT>
template<typename T1, typename T2>
inline
Mat<eT>::Mat
(
const Base<typename Mat<eT>::pod_type,T1>& A,
const Base<typename Mat<eT>::pod_type,T2>& B
)
Mat<eT>::Mat(const Base<typename Mat<eT>::pod_type,T1>& A, const Base<typename Mat<eT>::pod_type,T2>& B)
: n_rows(0)
, n_cols(0)
, n_elem(0)
@@ -1994,6 +2046,26 @@ Mat<eT>::Mat(const subview<eT>& X, const bool use_colmem)
template<typename eT>
inline
Mat<eT>::Mat(const subview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
init_warm(X.n_rows, X.n_cols);
subview<eT>::extract(*this, X);
}
//! construct a matrix from subview (eg. construct a matrix from a delayed submatrix operation)
template<typename eT>
inline
@@ -2197,6 +2269,24 @@ Mat<eT>::Mat(const xtrans_mat<eT,do_conj>& X)
template<typename eT>
inline
Mat<eT>::Mat(const subview_cube<eT>& x, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
(*this).operator=(x);
}
//! construct a matrix from a subview_cube instance
template<typename eT>
inline
@@ -2211,7 +2301,7 @@ Mat<eT>::Mat(const subview_cube<eT>& x)
{
arma_debug_sigprint_this(this);
this->operator=(x);
(*this).operator=(x);
}
@@ -2308,6 +2398,26 @@ Mat<eT>::operator/=(const subview_cube<eT>& X)
template<typename eT>
inline
Mat<eT>::Mat(const diagview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
init_warm(X.n_rows, X.n_cols);
diagview<eT>::extract(*this, X);
}
//! construct a matrix from diagview (eg. construct a matrix from a delayed diag operation)
template<typename eT>
inline
@@ -2432,6 +2542,25 @@ Mat<eT>::operator/=(const diagview<eT>& X)
template<typename eT>
template<typename T1>
inline
Mat<eT>::Mat(const subview_elem1<eT,T1>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
(*this).operator=(X);
}
template<typename eT>
template<typename T1>
inline
@@ -2446,7 +2575,7 @@ Mat<eT>::Mat(const subview_elem1<eT,T1>& X)
{
arma_debug_sigprint_this(this);
this->operator=(X);
(*this).operator=(X);
}
@@ -2541,6 +2670,25 @@ Mat<eT>::operator/=(const subview_elem1<eT,T1>& X)
template<typename eT>
template<typename T1, typename T2>
inline
Mat<eT>::Mat(const subview_elem2<eT,T1,T2>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
(*this).operator=(X);
}
template<typename eT>
template<typename T1, typename T2>
inline
@@ -2555,7 +2703,7 @@ Mat<eT>::Mat(const subview_elem2<eT,T1,T2>& X)
{
arma_debug_sigprint_this(this);
this->operator=(X);
(*this).operator=(X);
}
@@ -2650,6 +2798,25 @@ Mat<eT>::operator/=(const subview_elem2<eT,T1,T2>& X)
template<typename eT>
template<typename T1>
inline
Mat<eT>::Mat(const SpBase<eT, T1>& m, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
(*this).operator=(m);
}
template<typename eT>
template<typename T1>
inline
@@ -2835,6 +3002,24 @@ Mat<eT>::operator/=(const SpBase<eT, T1>& m)
template<typename eT>
inline
Mat<eT>::Mat(const SpSubview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
(*this).operator=(X);
}
template<typename eT>
inline
Mat<eT>::Mat(const SpSubview<eT>& X)
@@ -3018,6 +3203,26 @@ Mat<eT>::operator-=(const SpSubview<eT>& X)
template<typename eT>
inline
Mat<eT>::Mat(const spdiagview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
init_warm(X.n_rows, X.n_cols);
spdiagview<eT>::extract(*this, X);
}
template<typename eT>
inline
Mat<eT>::Mat(const spdiagview<eT>& X)
@@ -4925,6 +5130,29 @@ Mat<eT>::insert_cols(const uword col_num, const Base<eT,T1>& X)
template<typename eT>
template<typename T1, typename gen_type>
inline
Mat<eT>::Mat(const Gen<T1, gen_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
init_warm(X.n_rows, X.n_cols);
X.apply(*this);
}
template<typename eT>
template<typename T1, typename gen_type>
inline
@@ -5052,6 +5280,27 @@ Mat<eT>::operator/=(const Gen<T1, gen_type>& X)
template<typename eT>
template<typename T1, typename op_type>
inline
Mat<eT>::Mat(const Op<T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
op_type::apply(static_cast< Mat_noalias<eT>& >(*this), X);
}
//! create a matrix from Op, ie. run the previously delayed unary operations
template<typename eT>
template<typename T1, typename op_type>
@@ -5182,6 +5431,37 @@ Mat<eT>::operator/=(const Op<T1, op_type>& X)
template<typename eT>
template<typename T1, typename eop_type>
inline
Mat<eT>::Mat(const eOp<T1, eop_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
init_warm(X.get_n_rows(), X.get_n_cols());
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
{
constexpr bool eT_ok = is_real_or_cx<eT>::value;
if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOp<T1, eop_square>& >(X)); return; }
if(eT_ok && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOp<T1, eop_sqrt >& >(X)); return; }
}
eop_type::apply(*this, X);
}
//! create a matrix from eOp, ie. run the previously delayed unary operations
template<typename eT>
template<typename T1, typename eop_type>
@@ -5379,6 +5659,25 @@ Mat<eT>::operator/=(const eOp<T1, eop_type>& X)
template<typename eT>
template<typename T1, typename op_type>
inline
Mat<eT>::Mat(const mtOp<eT, T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
op_type::apply(*this, X);
}
template<typename eT>
template<typename T1, typename op_type>
inline
@@ -5488,6 +5787,27 @@ Mat<eT>::operator/=(const mtOp<eT, T1, op_type>& X)
template<typename eT>
template<typename T1, typename op_type>
inline
Mat<eT>::Mat(const CubeToMatOp<T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
op_type::apply(*this, X);
}
template<typename eT>
template<typename T1, typename op_type>
inline
@@ -5501,9 +5821,9 @@ Mat<eT>::Mat(const CubeToMatOp<T1, op_type>& X)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
op_type::apply(*this, X);
}
@@ -5516,7 +5836,7 @@ Mat<eT>&
Mat<eT>::operator=(const CubeToMatOp<T1, op_type>& X)
{
arma_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
op_type::apply(*this, X);
@@ -5611,6 +5931,27 @@ Mat<eT>::operator/=(const CubeToMatOp<T1, op_type>& X)
template<typename eT>
template<typename T1, typename op_type>
inline
Mat<eT>::Mat(const SpToDOp<T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
op_type::apply(*this, X);
}
template<typename eT>
template<typename T1, typename op_type>
inline
@@ -5624,9 +5965,9 @@ Mat<eT>::Mat(const SpToDOp<T1, op_type>& X)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
op_type::apply(*this, X);
}
@@ -5640,7 +5981,7 @@ Mat<eT>&
Mat<eT>::operator=(const SpToDOp<T1, op_type>& X)
{
arma_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
op_type::apply(*this, X);
@@ -5740,6 +6081,25 @@ Mat<eT>::operator/=(const SpToDOp<T1, op_type>& X)
template<typename eT>
template<typename T1, typename op_type>
inline
Mat<eT>::Mat(const mtSpReduceOp<eT, T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
op_type::apply(*this, X);
}
template<typename eT>
template<typename T1, typename op_type>
inline
@@ -5753,7 +6113,7 @@ Mat<eT>::Mat(const mtSpReduceOp<eT, T1, op_type>& X)
, mem()
{
arma_debug_sigprint_this(this);
op_type::apply(*this, X);
}
@@ -5766,7 +6126,7 @@ Mat<eT>&
Mat<eT>::operator=(const mtSpReduceOp<eT, T1, op_type>& X)
{
arma_debug_sigprint();
op_type::apply(*this, X);
return *this;
@@ -5849,6 +6209,28 @@ Mat<eT>::operator/=(const mtSpReduceOp<eT, T1, op_type>& X)
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
Mat<eT>::Mat(const Glue<T1, T2, glue_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
glue_type::apply(static_cast< Mat_noalias<eT>& >(*this), X);
}
//! create a matrix from Glue, ie. run the previously delayed binary operations
template<typename eT>
template<typename T1, typename T2, typename glue_type>
@@ -6016,6 +6398,30 @@ Mat<eT>::operator-=(const Glue<T1, T2, glue_times>& X)
template<typename eT>
template<typename T1, typename T2, typename eglue_type>
inline
Mat<eT>::Mat(const eGlue<T1, T2, eglue_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
init_warm(X.get_n_rows(), X.get_n_cols());
eglue_type::apply(*this, X);
}
//! create a matrix from eGlue, ie. run the previously delayed binary operations
template<typename eT>
template<typename T1, typename T2, typename eglue_type>
@@ -6199,6 +6605,25 @@ Mat<eT>::operator/=(const eGlue<T1, T2, eglue_type>& X)
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
Mat<eT>::Mat(const mtGlue<eT, T1, T2, glue_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
glue_type::apply(*this, X);
}
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
@@ -6310,6 +6735,28 @@ Mat<eT>::operator/=(const mtGlue<eT, T1, T2, glue_type>& X)
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
Mat<eT>::Mat(const SpToDGlue<T1, T2, glue_type>& X, const arma_vec_indicator&, const uhword in_vec_state)
: n_rows( (in_vec_state == 2) ? 1 : 0 )
, n_cols( (in_vec_state == 1) ? 1 : 0 )
, n_elem(0)
, n_alloc(0)
, vec_state(in_vec_state)
, mem_state(0)
, mem()
{
arma_debug_sigprint_this(this);
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
glue_type::apply(*this, X);
}
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
+10 -23
View File
@@ -521,11 +521,9 @@ template<typename eT>
template<typename T1>
inline
Row<eT>::Row(const Base<eT,T1>& X)
: Mat<eT>(arma_vec_indicator(), 2)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 2)
{
arma_debug_sigprint();
Mat<eT>::operator=(X.get_ref());
arma_debug_sigprint_this(this);
}
@@ -549,11 +547,9 @@ template<typename eT>
template<typename T1>
inline
Row<eT>::Row(const SpBase<eT,T1>& X)
: Mat<eT>(arma_vec_indicator(), 2)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 2)
{
arma_debug_sigprint();
Mat<eT>::operator=(X.get_ref());
arma_debug_sigprint_this(this);
}
@@ -607,12 +603,9 @@ Row<eT>::Row
const Base<typename Row<eT>::pod_type, T1>& A,
const Base<typename Row<eT>::pod_type, T2>& B
)
: Mat<eT>(A.get_ref(), B.get_ref(), arma_vec_indicator(), 2)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::init(A,B);
arma_debug_sigprint_this(this);
}
@@ -631,12 +624,9 @@ template<typename eT>
template<typename T1>
inline
Row<eT>::Row(const BaseCube<eT,T1>& X)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 2)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::operator=(X);
arma_debug_sigprint_this(this);
}
@@ -659,12 +649,9 @@ Row<eT>::operator=(const BaseCube<eT,T1>& X)
template<typename eT>
inline
Row<eT>::Row(const subview_cube<eT>& X)
: Mat<eT>(X, arma_vec_indicator(), 2)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::operator=(X);
arma_debug_sigprint_this(this);
}