| Col_meat.hpp | | Col_meat.hpp | |
| | | | |
| skipping to change at line 420 | | skipping to change at line 420 | |
| //! construct a column vector from Op, i.e. run the previously delayed oper
ations; the result of the operations must have exactly one column | | //! construct a column vector from Op, i.e. run the previously delayed oper
ations; the result of the operations must have exactly one column | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1, typename op_type> | | template<typename T1, typename op_type> | |
| inline | | inline | |
| const Col<eT>& | | const Col<eT>& | |
| Col<eT>::operator=(const Op<T1, op_type>& X) | | Col<eT>::operator=(const Op<T1, op_type>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator=(X); | | Mat<eT>::operator=(X); | |
|
| arma_debug_check( (Mat<eT>::n_cols > 1), "Col::operator=(): given matrix
can't be interpreted as a column vector" ); | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions"
); | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1, typename op_type> | | template<typename T1, typename op_type> | |
| inline | | inline | |
| const Col<eT>& | | const Col<eT>& | |
| Col<eT>::operator*=(const Op<T1, op_type>& X) | | Col<eT>::operator*=(const Op<T1, op_type>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator*=(X); | | Mat<eT>::operator*=(X); | |
| | | | |
|
| arma_debug_check( (Mat<eT>::n_cols > 1), "Col::operator=(): incompatible
dimensions" ); | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions"
); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1, typename eop_type> | | template<typename T1, typename eop_type> | |
| inline | | inline | |
| Col<eT>::Col(const eOp<T1, eop_type>& X) | | Col<eT>::Col(const eOp<T1, eop_type>& X) | |
| : Mat<eT>(X) | | : Mat<eT>(X) | |
| { | | { | |
| | | | |
| skipping to change at line 459 | | skipping to change at line 459 | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1, typename eop_type> | | template<typename T1, typename eop_type> | |
| inline | | inline | |
| const Col<eT>& | | const Col<eT>& | |
| Col<eT>::operator=(const eOp<T1, eop_type>& X) | | Col<eT>::operator=(const eOp<T1, eop_type>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator=(X); | | Mat<eT>::operator=(X); | |
|
| arma_debug_check( (Mat<eT>::n_cols > 1), "Col::operator=(): given matrix
can't be interpreted as a column vector" ); | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions"
); | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1, typename eop_type> | | template<typename T1, typename eop_type> | |
| inline | | inline | |
| const Col<eT>& | | const Col<eT>& | |
| Col<eT>::operator*=(const eOp<T1, eop_type>& X) | | Col<eT>::operator*=(const eOp<T1, eop_type>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator*=(X); | | Mat<eT>::operator*=(X); | |
| | | | |
|
| arma_debug_check( (Mat<eT>::n_cols > 1), "Col::operator=(): incompatible | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" | |
| dimensions" ); | | ); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | Col<eT>::Col(const mtOp<eT, T1, op_type>& X) | |
| | | : Mat<eT>(X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" | |
| | | ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | const Col<eT>& | |
| | | Col<eT>::operator=(const mtOp<eT, T1, op_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::operator=(X); | |
| | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" | |
| | | ); | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | const Col<eT>& | |
| | | Col<eT>::operator*=(const mtOp<eT, T1, op_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::operator*=(X); | |
| | | | |
| | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" | |
| | | ); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| //! construct a column vector from Glue, i.e. run the previously delayed op
erations; the result of the operations must have exactly one column | | //! construct a column vector from Glue, i.e. run the previously delayed op
erations; the result of the operations must have exactly one column | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1, typename T2, typename glue_type> | | template<typename T1, typename T2, typename glue_type> | |
| inline | | inline | |
| Col<eT>::Col(const Glue<T1, T2, glue_type>& X) | | Col<eT>::Col(const Glue<T1, T2, glue_type>& X) | |
| : Mat<eT>(X) | | : Mat<eT>(X) | |
| | | | |
| skipping to change at line 562 | | skipping to change at line 601 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator*=(X); | | Mat<eT>::operator*=(X); | |
| | | | |
| arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions"
); | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions"
); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | Col<eT>::Col(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | : Mat<eT>(X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" | |
| | | ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | const Col<eT>& | |
| | | Col<eT>::operator=(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::operator=(X); | |
| | | | |
| | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" | |
| | | ); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | const Col<eT>& | |
| | | Col<eT>::operator*=(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::operator*=(X); | |
| | | | |
| | | arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" | |
| | | ); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| //! change the number of rows | | //! change the number of rows | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| Col<eT>::set_size(const u32 in_n_elem) | | Col<eT>::set_size(const u32 in_n_elem) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::set_size(in_n_elem,1); | | Mat<eT>::set_size(in_n_elem,1); | |
| } | | } | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 91 lines changed or added | |
|
| Col_proto.hpp | | Col_proto.hpp | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_ro
w2) const; | | arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_ro
w2) const; | |
| | | | |
| template<typename T1, typename op_type> inline Col(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline Col(cons
t Op<T1, op_type>& X); | |
| template<typename T1, typename op_type> inline const Col& operator=(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline const Col& operator=(cons
t Op<T1, op_type>& X); | |
| template<typename T1, typename op_type> inline const Col& operator*=(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline const Col& operator*=(cons
t Op<T1, op_type>& X); | |
| | | | |
| template<typename T1, typename eop_type> inline Col(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline Col(con
st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Col& operator=(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Col& operator=(con
st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Col& operator*=(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Col& operator*=(con
st eOp<T1, eop_type>& X); | |
| | | | |
|
| | | template<typename T1, typename op_type> inline Col(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | template<typename T1, typename op_type> inline const Col& operator=(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | template<typename T1, typename op_type> inline const Col& operator*=(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | | |
| template<typename T1, typename T2, typename glue_type> inline
Col(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline
Col(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Col&
operator=(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Col&
operator=(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Col&
operator*=(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Col&
operator*=(const Glue<T1, T2, glue_type>& X); | |
| | | | |
| template<typename T1, typename T2, typename eglue_type> inline
Col(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline
Col(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Col&
operator=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Col&
operator=(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Col&
operator*=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Col&
operator*=(const eGlue<T1, T2, eglue_type>& X); | |
| | | | |
|
| | | template<typename T1, typename T2, typename glue_type> inline | |
| | | Col(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Col& | |
| | | operator=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Col& | |
| | | operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | | |
| inline void set_size(const u32 n_elem); | | inline void set_size(const u32 n_elem); | |
| inline void set_size(const u32 n_rows, const u32 n_cols); | | inline void set_size(const u32 n_rows, const u32 n_cols); | |
| | | | |
| template<typename eT2> | | template<typename eT2> | |
| inline void copy_size(const Mat<eT2>& m); | | inline void copy_size(const Mat<eT2>& m); | |
| | | | |
| inline void zeros(); | | inline void zeros(); | |
| inline void zeros(const u32 n_elem); | | inline void zeros(const u32 n_elem); | |
| inline void zeros(const u32 n_rows, const u32 n_cols); | | inline void zeros(const u32 n_rows, const u32 n_cols); | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 14 lines changed or added | |
|
| Mat_meat.hpp | | Mat_meat.hpp | |
| | | | |
| skipping to change at line 1419 | | skipping to change at line 1419 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| isnt_same_type<eT, typename T1::elem_type>::check(); | | isnt_same_type<eT, typename T1::elem_type>::check(); | |
| | | | |
| eop_type::apply_inplace_div(*this, X); | | eop_type::apply_inplace_div(*this, X); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | //! EXPERIMENTAL | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | Mat<eT>::Mat(const mtOp<eT, T1, op_type>& X) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem(0) | |
| | | , use_aux_mem(false) | |
| | | //, mem(0) | |
| | | , mem(mem) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | op_type::apply(*this, X); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator=(const mtOp<eT, T1, op_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | op_type::apply(*this, X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator+=(const mtOp<eT, T1, op_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator+=(m); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator-=(const mtOp<eT, T1, op_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator-=(m); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator*=(const mtOp<eT, T1, op_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator*=(m); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator%=(const mtOp<eT, T1, op_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator%=(m); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL | |
| | | template<typename eT> | |
| | | template<typename T1, typename op_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator/=(const mtOp<eT, T1, op_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator/=(m); | |
| | | } | |
| | | | |
| //! create a matrix from Glue, i.e. run the previously delayed binary opera
tions | | //! create a matrix from Glue, i.e. run the previously delayed binary opera
tions | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1, typename T2, typename glue_type> | | template<typename T1, typename T2, typename glue_type> | |
| inline | | inline | |
| Mat<eT>::Mat(const Glue<T1, T2, glue_type>& X) | | Mat<eT>::Mat(const Glue<T1, T2, glue_type>& X) | |
| : n_rows(0) | | : n_rows(0) | |
| , n_cols(0) | | , n_cols(0) | |
| , n_elem(0) | | , n_elem(0) | |
| , use_aux_mem(false) | | , use_aux_mem(false) | |
| //, mem(0) | | //, mem(0) | |
| | | | |
| skipping to change at line 1683 | | skipping to change at line 1784 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| isnt_same_type<eT, typename T1::elem_type>::check(); | | isnt_same_type<eT, typename T1::elem_type>::check(); | |
| isnt_same_type<eT, typename T2::elem_type>::check(); | | isnt_same_type<eT, typename T2::elem_type>::check(); | |
| | | | |
| eglue_type::apply_inplace_div(*this, X); | | eglue_type::apply_inplace_div(*this, X); | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | //! EXPERIMENTAL: create a matrix from mtGlue, i.e. run the previously dela | |
| | | yed binary operations | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | Mat<eT>::Mat(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem(0) | |
| | | , use_aux_mem(false) | |
| | | //, mem(0) | |
| | | , mem(mem) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | glue_type::apply(*this, X); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL: create a matrix from Glue, i.e. run the previously delaye | |
| | | d binary operations | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator=(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | glue_type::apply(*this, X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL: in-place matrix addition, with the right-hand-side operan | |
| | | ds having delayed operations | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator+=(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator+=(m); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL: in-place matrix subtraction, with the right-hand-side ope | |
| | | rands having delayed operations | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator-=(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator-=(m); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL: in-place matrix multiplications, with the right-hand-side | |
| | | operands having delayed operations | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator*=(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | glue_times::apply_inplace(*this, m); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL: in-place matrix element-wise multiplication, with the rig | |
| | | ht-hand-side operands having delayed operations | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator%=(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator%=(m); | |
| | | } | |
| | | | |
| | | //! EXPERIMENTAL: in-place matrix element-wise division, with the right-han | |
| | | d-side operands having delayed operations | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename glue_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator/=(const mtGlue<eT, T1, T2, glue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const Mat<eT> m(X); | |
| | | | |
| | | return (*this).operator/=(m); | |
| | | } | |
| | | | |
| //! linear element accessor (treats the matrix as a vector); bounds checkin
g not done when ARMA_NO_DEBUG is defined | | //! linear element accessor (treats the matrix as a vector); bounds checkin
g not done when ARMA_NO_DEBUG is defined | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| eT& | | eT& | |
| Mat<eT>::operator() (const u32 i) | | Mat<eT>::operator() (const u32 i) | |
| { | | { | |
| arma_debug_check( (i >= n_elem), "Mat::operator(): out of bounds"); | | arma_debug_check( (i >= n_elem), "Mat::operator(): out of bounds"); | |
| return access::rw(mem[i]); | | return access::rw(mem[i]); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 211 lines changed or added | |
|
| Mat_proto.hpp | | Mat_proto.hpp | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 134 | |
| template<typename T1, typename op_type> inline const Mat& operator/=(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline const Mat& operator/=(cons
t Op<T1, op_type>& X); | |
| | | | |
| template<typename T1, typename eop_type> inline Mat(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline Mat(con
st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Mat& operator=(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Mat& operator=(con
st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Mat& operator+=(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Mat& operator+=(con
st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Mat& operator-=(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Mat& operator-=(con
st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Mat& operator*=(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Mat& operator*=(con
st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Mat& operator%=(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Mat& operator%=(con
st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Mat& operator/=(con
st eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Mat& operator/=(con
st eOp<T1, eop_type>& X); | |
| | | | |
|
| | | template<typename T1, typename op_type> inline Mat(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | template<typename T1, typename op_type> inline const Mat& operator=(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | template<typename T1, typename op_type> inline const Mat& operator+=(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | template<typename T1, typename op_type> inline const Mat& operator-=(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | template<typename T1, typename op_type> inline const Mat& operator*=(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | template<typename T1, typename op_type> inline const Mat& operator%=(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | template<typename T1, typename op_type> inline const Mat& operator/=(cons | |
| | | t mtOp<eT, T1, op_type>& X); | |
| | | | |
| 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(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator=(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator=(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator+=(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator+=(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator-=(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator-=(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator*=(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator*=(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator%=(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator%=(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator/=(const Glue<T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator/=(const Glue<T1, T2, glue_type>& X); | |
| | | | |
| template<typename T1, typename T2> inline const Mat&
operator+=(const Glue<T1, T2, glue_times>& X); | | template<typename T1, typename T2> inline const Mat&
operator+=(const Glue<T1, T2, glue_times>& X); | |
| template<typename T1, typename T2> inline const Mat&
operator-=(const Glue<T1, T2, glue_times>& X); | | template<typename T1, typename T2> inline const 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); | | 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 const Mat&
operator=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator=(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator+=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator+=(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator-=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator-=(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator*=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator*=(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator%=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator%=(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator/=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const 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); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Mat& | |
| | | operator=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Mat& | |
| | | operator+=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Mat& | |
| | | operator-=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Mat& | |
| | | operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Mat& | |
| | | operator%=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Mat& | |
| | | operator/=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | | |
| arma_inline eT& operator[] (const u32 i); | | arma_inline eT& operator[] (const u32 i); | |
| arma_inline eT operator[] (const u32 i) const; | | arma_inline eT operator[] (const u32 i) const; | |
| arma_inline eT& operator() (const u32 i); | | arma_inline eT& operator() (const u32 i); | |
| arma_inline eT operator() (const u32 i) const; | | arma_inline eT operator() (const u32 i) const; | |
| | | | |
| arma_inline eT& at (const u32 in_row, const u32 in_col); | | arma_inline eT& at (const u32 in_row, const u32 in_col); | |
| arma_inline eT at (const u32 in_row, const u32 in_col) const; | | arma_inline eT at (const u32 in_row, const u32 in_col) const; | |
| arma_inline eT& operator() (const u32 in_row, const u32 in_col); | | arma_inline eT& operator() (const u32 in_row, const u32 in_col); | |
| arma_inline eT operator() (const u32 in_row, const u32 in_col) const; | | arma_inline eT operator() (const u32 in_row, const u32 in_col) const; | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 30 lines changed or added | |
|
| Row_proto.hpp | | Row_proto.hpp | |
| | | | |
| skipping to change at line 74 | | skipping to change at line 74 | |
| inline explicit Row(const diagview<eT>& X); | | inline explicit Row(const diagview<eT>& X); | |
| inline const Row& operator=(const diagview<eT>& X); | | inline const Row& operator=(const diagview<eT>& X); | |
| inline const Row& operator*=(const diagview<eT>& X); | | inline const Row& operator*=(const diagview<eT>& X); | |
| | | | |
| arma_inline eT& col(const u32 col_num); | | arma_inline eT& col(const u32 col_num); | |
| arma_inline eT col(const u32 col_num) const; | | arma_inline eT col(const u32 col_num) const; | |
| | | | |
| arma_inline subview_row<eT> cols(const u32 in_col1, const u32 in_co
l2); | | arma_inline subview_row<eT> cols(const u32 in_col1, const u32 in_co
l2); | |
| arma_inline const subview_row<eT> cols(const u32 in_col1, const u32 in_co
l2) const; | | arma_inline const subview_row<eT> cols(const u32 in_col1, const u32 in_co
l2) const; | |
| | | | |
|
| template<typename T1, typename op_type> inline Row(cons | | template<typename T1, typename op_type> inline Row(cons | |
| t Op<T1, op_type> &X); | | t Op<T1, op_type>& X); | |
| template<typename T1, typename op_type> inline const Row& operator=(cons | | template<typename T1, typename op_type> inline const Row& operator=(cons | |
| t Op<T1, op_type> &X); | | t Op<T1, op_type>& X); | |
| template<typename T1, typename op_type> inline const Row& operator*=(cons | | template<typename T1, typename op_type> inline const Row& operator*=(cons | |
| t Op<T1, op_type> &X); | | t Op<T1, op_type>& X); | |
| | | | |
| template<typename T1, typename eop_type> inline Row(con | | template<typename T1, typename eop_type> inline Row(con | |
| st eOp<T1, eop_type> &X); | | st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Row& operator=(con | | template<typename T1, typename eop_type> inline const Row& operator=(con | |
| st eOp<T1, eop_type> &X); | | st eOp<T1, eop_type>& X); | |
| template<typename T1, typename eop_type> inline const Row& operator*=(con | | template<typename T1, typename eop_type> inline const Row& operator*=(con | |
| st eOp<T1, eop_type> &X); | | st eOp<T1, eop_type>& X); | |
| | | | |
| template<typename T1, typename T2, typename glue_type> inline | | template<typename T1, typename op_type> inline Row(cons | |
| Row(const Glue<T1, T2, glue_type> &X); | | t mtOp<eT, T1, op_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Row& | | template<typename T1, typename op_type> inline const Row& operator=(cons | |
| operator=(const Glue<T1, T2, glue_type> &X); | | t mtOp<eT, T1, op_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Row& | | template<typename T1, typename op_type> inline const Row& operator*=(cons | |
| operator*=(const Glue<T1, T2, glue_type> &X); | | t mtOp<eT, T1, op_type>& X); | |
| | | | |
| template<typename T1, typename T2, typename eglue_type> inline | | template<typename T1, typename T2, typename glue_type> inline | |
| Row(const eGlue<T1, T2, eglue_type> &X); | | Row(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Row& | | template<typename T1, typename T2, typename glue_type> inline const Row& | |
| operator=(const eGlue<T1, T2, eglue_type> &X); | | operator=(const Glue<T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Row& | | template<typename T1, typename T2, typename glue_type> inline const Row& | |
| operator*=(const eGlue<T1, T2, eglue_type> &X); | | operator*=(const Glue<T1, T2, glue_type>& X); | |
| | | | |
| | | template<typename T1, typename T2, typename eglue_type> inline | |
| | | Row(const eGlue<T1, T2, eglue_type>& X); | |
| | | template<typename T1, typename T2, typename eglue_type> inline const Row& | |
| | | operator=(const eGlue<T1, T2, eglue_type>& X); | |
| | | template<typename T1, typename T2, typename eglue_type> inline const Row& | |
| | | operator*=(const eGlue<T1, T2, eglue_type>& X); | |
| | | | |
| | | template<typename T1, typename T2, typename glue_type> inline | |
| | | Row(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Row& | |
| | | operator=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | template<typename T1, typename T2, typename glue_type> inline const Row& | |
| | | operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | | |
| inline void set_size(const u32 N); | | inline void set_size(const u32 N); | |
| inline void set_size(const u32 n_rows, const u32 n_cols); | | inline void set_size(const u32 n_rows, const u32 n_cols); | |
| | | | |
| template<typename eT2> | | template<typename eT2> | |
| inline void copy_size(const Mat<eT2>& m); | | inline void copy_size(const Mat<eT2>& m); | |
| | | | |
| inline void zeros(); | | inline void zeros(); | |
| inline void zeros(const u32 N); | | inline void zeros(const u32 N); | |
| inline void zeros(const u32 n_rows, const u32 n_cols); | | inline void zeros(const u32 n_rows, const u32 n_cols); | |
| | | | |
End of changes. 1 change blocks. |
| 27 lines changed or deleted | | 41 lines changed or added | |
|
| armadillo | | armadillo | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 84 | |
| | | | |
| #include "armadillo_bits/itpp_wrap.hpp" | | #include "armadillo_bits/itpp_wrap.hpp" | |
| | | | |
| //! \namespace arma namespace for Armadillo classes and functions | | //! \namespace arma namespace for Armadillo classes and functions | |
| namespace arma | | namespace arma | |
| { | | { | |
| | | | |
| // preliminaries | | // preliminaries | |
| | | | |
| #include "armadillo_bits/forward_proto.hpp" | | #include "armadillo_bits/forward_proto.hpp" | |
|
| #include "armadillo_bits/static_assert.hpp" | | #include "armadillo_bits/arma_static_assert.hpp" | |
| #include "armadillo_bits/typedef.hpp" | | #include "armadillo_bits/typedef.hpp" | |
| #include "armadillo_bits/format_wrap.hpp" | | #include "armadillo_bits/format_wrap.hpp" | |
| #include "armadillo_bits/cmath_wrap.hpp" | | #include "armadillo_bits/cmath_wrap.hpp" | |
| #include "armadillo_bits/constants.hpp" | | #include "armadillo_bits/constants.hpp" | |
|
| #include "armadillo_bits/version.hpp" | | #include "armadillo_bits/arma_version.hpp" | |
| | | #include "armadillo_bits/arma_config.hpp" | |
| #include "armadillo_bits/traits.hpp" | | #include "armadillo_bits/traits.hpp" | |
| #include "armadillo_bits/promote_type.hpp" | | #include "armadillo_bits/promote_type.hpp" | |
| #include "armadillo_bits/upgrade_val.hpp" | | #include "armadillo_bits/upgrade_val.hpp" | |
| #include "armadillo_bits/restrictors.hpp" | | #include "armadillo_bits/restrictors.hpp" | |
| #include "armadillo_bits/access.hpp" | | #include "armadillo_bits/access.hpp" | |
| | | | |
| // | | // | |
| // class prototypes | | // class prototypes | |
| | | | |
| #include "armadillo_bits/syslib_proto.hpp" | | #include "armadillo_bits/syslib_proto.hpp" | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 133 | |
| #include "armadillo_bits/wall_clock_proto.hpp" | | #include "armadillo_bits/wall_clock_proto.hpp" | |
| #include "armadillo_bits/running_stat_proto.hpp" | | #include "armadillo_bits/running_stat_proto.hpp" | |
| #include "armadillo_bits/running_stat_vec_proto.hpp" | | #include "armadillo_bits/running_stat_vec_proto.hpp" | |
| | | | |
| #include "armadillo_bits/Op_proto.hpp" | | #include "armadillo_bits/Op_proto.hpp" | |
| #include "armadillo_bits/OpCube_proto.hpp" | | #include "armadillo_bits/OpCube_proto.hpp" | |
| | | | |
| #include "armadillo_bits/eOp_proto.hpp" | | #include "armadillo_bits/eOp_proto.hpp" | |
| #include "armadillo_bits/eOpCube_proto.hpp" | | #include "armadillo_bits/eOpCube_proto.hpp" | |
| | | | |
|
| | | #include "armadillo_bits/mtOp_proto.hpp" | |
| | | | |
| #include "armadillo_bits/Glue_proto.hpp" | | #include "armadillo_bits/Glue_proto.hpp" | |
| #include "armadillo_bits/eGlue_proto.hpp" | | #include "armadillo_bits/eGlue_proto.hpp" | |
|
| | | #include "armadillo_bits/mtGlue_proto.hpp" | |
| | | | |
| #include "armadillo_bits/GlueCube_proto.hpp" | | #include "armadillo_bits/GlueCube_proto.hpp" | |
| #include "armadillo_bits/eGlueCube_proto.hpp" | | #include "armadillo_bits/eGlueCube_proto.hpp" | |
| | | | |
| #include "armadillo_bits/eop_core_proto.hpp" | | #include "armadillo_bits/eop_core_proto.hpp" | |
| #include "armadillo_bits/eop_cube_core_proto.hpp" | | #include "armadillo_bits/eop_cube_core_proto.hpp" | |
| | | | |
| #include "armadillo_bits/eglue_core_proto.hpp" | | #include "armadillo_bits/eglue_core_proto.hpp" | |
| #include "armadillo_bits/eglue_cube_core_proto.hpp" | | #include "armadillo_bits/eglue_cube_core_proto.hpp" | |
| | | | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 173 | |
| #include "armadillo_bits/op_reshape_proto.hpp" | | #include "armadillo_bits/op_reshape_proto.hpp" | |
| #include "armadillo_bits/op_cov_proto.hpp" | | #include "armadillo_bits/op_cov_proto.hpp" | |
| #include "armadillo_bits/op_cor_proto.hpp" | | #include "armadillo_bits/op_cor_proto.hpp" | |
| #include "armadillo_bits/op_shuffle_proto.hpp" | | #include "armadillo_bits/op_shuffle_proto.hpp" | |
| #include "armadillo_bits/op_prod_proto.hpp" | | #include "armadillo_bits/op_prod_proto.hpp" | |
| #include "armadillo_bits/op_pinv_proto.hpp" | | #include "armadillo_bits/op_pinv_proto.hpp" | |
| #include "armadillo_bits/op_dotext_proto.hpp" | | #include "armadillo_bits/op_dotext_proto.hpp" | |
| #include "armadillo_bits/op_flip_proto.hpp" | | #include "armadillo_bits/op_flip_proto.hpp" | |
| #include "armadillo_bits/op_princomp_proto.hpp" | | #include "armadillo_bits/op_princomp_proto.hpp" | |
| #include "armadillo_bits/op_princomp_cov_proto.hpp" | | #include "armadillo_bits/op_princomp_cov_proto.hpp" | |
|
| | | #include "armadillo_bits/op_misc_proto.hpp" | |
| | | #include "armadillo_bits/op_relational_proto.hpp" | |
| | | #include "armadillo_bits/op_find_proto.hpp" | |
| | | #include "armadillo_bits/op_chol_proto.hpp" | |
| | | #include "armadillo_bits/op_cx_scalar_proto.hpp" | |
| | | | |
| #include "armadillo_bits/glue_times_proto.hpp" | | #include "armadillo_bits/glue_times_proto.hpp" | |
|
| | | #include "armadillo_bits/glue_mixed_proto.hpp" | |
| #include "armadillo_bits/glue_cov_proto.hpp" | | #include "armadillo_bits/glue_cov_proto.hpp" | |
| #include "armadillo_bits/glue_cor_proto.hpp" | | #include "armadillo_bits/glue_cor_proto.hpp" | |
| #include "armadillo_bits/glue_kron_proto.hpp" | | #include "armadillo_bits/glue_kron_proto.hpp" | |
| #include "armadillo_bits/glue_cross_proto.hpp" | | #include "armadillo_bits/glue_cross_proto.hpp" | |
| #include "armadillo_bits/glue_join_proto.hpp" | | #include "armadillo_bits/glue_join_proto.hpp" | |
|
| | | #include "armadillo_bits/glue_relational_proto.hpp" | |
| | | #include "armadillo_bits/glue_solve_proto.hpp" | |
| | | | |
| | | // for tests & experiments | |
| | | | |
| // | | // | |
| // debugging functions | | // debugging functions | |
| | | | |
| #include "armadillo_bits/debug.hpp" | | #include "armadillo_bits/debug.hpp" | |
| | | | |
| // | | // | |
| // classes that underlay metaprogramming | | // classes that underlay metaprogramming | |
| | | | |
| #include "armadillo_bits/Proxy.hpp" | | #include "armadillo_bits/Proxy.hpp" | |
| | | | |
| skipping to change at line 198 | | skipping to change at line 212 | |
| #include "armadillo_bits/diagmat_proxy.hpp" | | #include "armadillo_bits/diagmat_proxy.hpp" | |
| | | | |
| #include "armadillo_bits/unwrap.hpp" | | #include "armadillo_bits/unwrap.hpp" | |
| #include "armadillo_bits/unwrap_cube.hpp" | | #include "armadillo_bits/unwrap_cube.hpp" | |
| | | | |
| #include "armadillo_bits/strip.hpp" | | #include "armadillo_bits/strip.hpp" | |
| | | | |
| #include "armadillo_bits/Op_meat.hpp" | | #include "armadillo_bits/Op_meat.hpp" | |
| #include "armadillo_bits/OpCube_meat.hpp" | | #include "armadillo_bits/OpCube_meat.hpp" | |
| | | | |
|
| | | #include "armadillo_bits/mtOp_meat.hpp" | |
| | | | |
| #include "armadillo_bits/Glue_meat.hpp" | | #include "armadillo_bits/Glue_meat.hpp" | |
| #include "armadillo_bits/GlueCube_meat.hpp" | | #include "armadillo_bits/GlueCube_meat.hpp" | |
| | | | |
| #include "armadillo_bits/eop_aux.hpp" | | #include "armadillo_bits/eop_aux.hpp" | |
| | | | |
| #include "armadillo_bits/eOp_meat.hpp" | | #include "armadillo_bits/eOp_meat.hpp" | |
| #include "armadillo_bits/eOpCube_meat.hpp" | | #include "armadillo_bits/eOpCube_meat.hpp" | |
| | | | |
| #include "armadillo_bits/eGlue_meat.hpp" | | #include "armadillo_bits/eGlue_meat.hpp" | |
| #include "armadillo_bits/eGlueCube_meat.hpp" | | #include "armadillo_bits/eGlueCube_meat.hpp" | |
| | | | |
|
| | | #include "armadillo_bits/mtGlue_meat.hpp" | |
| | | | |
| #include "armadillo_bits/eglue_misc.hpp" | | #include "armadillo_bits/eglue_misc.hpp" | |
| #include "armadillo_bits/eglue_cube_misc.hpp" | | #include "armadillo_bits/eglue_cube_misc.hpp" | |
| | | | |
| // | | // | |
| // ostream | | // ostream | |
| | | | |
| #include "armadillo_bits/arma_ostream_proto.hpp" | | #include "armadillo_bits/arma_ostream_proto.hpp" | |
| #include "armadillo_bits/arma_ostream_meat.hpp" | | #include "armadillo_bits/arma_ostream_meat.hpp" | |
| | | | |
| // | | // | |
| | | | |
| skipping to change at line 292 | | skipping to change at line 310 | |
| #include "armadillo_bits/fn_eps.hpp" | | #include "armadillo_bits/fn_eps.hpp" | |
| #include "armadillo_bits/fn_pinv.hpp" | | #include "armadillo_bits/fn_pinv.hpp" | |
| #include "armadillo_bits/fn_rank.hpp" | | #include "armadillo_bits/fn_rank.hpp" | |
| #include "armadillo_bits/fn_kron.hpp" | | #include "armadillo_bits/fn_kron.hpp" | |
| #include "armadillo_bits/fn_flip.hpp" | | #include "armadillo_bits/fn_flip.hpp" | |
| #include "armadillo_bits/fn_as_scalar.hpp" | | #include "armadillo_bits/fn_as_scalar.hpp" | |
| #include "armadillo_bits/fn_princomp.hpp" | | #include "armadillo_bits/fn_princomp.hpp" | |
| #include "armadillo_bits/fn_princomp_cov.hpp" | | #include "armadillo_bits/fn_princomp_cov.hpp" | |
| #include "armadillo_bits/fn_cross.hpp" | | #include "armadillo_bits/fn_cross.hpp" | |
| #include "armadillo_bits/fn_join.hpp" | | #include "armadillo_bits/fn_join.hpp" | |
|
| #include "armadillo_bits/fn_find.hpp" | | | |
| | | | |
| // | | // | |
| // class meat | | // class meat | |
| | | | |
| #include "armadillo_bits/gemm.hpp" | | #include "armadillo_bits/gemm.hpp" | |
| #include "armadillo_bits/gemv.hpp" | | #include "armadillo_bits/gemv.hpp" | |
| #include "armadillo_bits/gemm_mixed.hpp" | | #include "armadillo_bits/gemm_mixed.hpp" | |
| | | | |
| #include "armadillo_bits/eop_core_meat.hpp" | | #include "armadillo_bits/eop_core_meat.hpp" | |
| #include "armadillo_bits/eop_cube_core_meat.hpp" | | #include "armadillo_bits/eop_cube_core_meat.hpp" | |
| | | | |
| skipping to change at line 350 | | skipping to change at line 367 | |
| #include "armadillo_bits/op_reshape_meat.hpp" | | #include "armadillo_bits/op_reshape_meat.hpp" | |
| #include "armadillo_bits/op_cov_meat.hpp" | | #include "armadillo_bits/op_cov_meat.hpp" | |
| #include "armadillo_bits/op_cor_meat.hpp" | | #include "armadillo_bits/op_cor_meat.hpp" | |
| #include "armadillo_bits/op_shuffle_meat.hpp" | | #include "armadillo_bits/op_shuffle_meat.hpp" | |
| #include "armadillo_bits/op_prod_meat.hpp" | | #include "armadillo_bits/op_prod_meat.hpp" | |
| #include "armadillo_bits/op_pinv_meat.hpp" | | #include "armadillo_bits/op_pinv_meat.hpp" | |
| #include "armadillo_bits/op_dotext_meat.hpp" | | #include "armadillo_bits/op_dotext_meat.hpp" | |
| #include "armadillo_bits/op_flip_meat.hpp" | | #include "armadillo_bits/op_flip_meat.hpp" | |
| #include "armadillo_bits/op_princomp_meat.hpp" | | #include "armadillo_bits/op_princomp_meat.hpp" | |
| #include "armadillo_bits/op_princomp_cov_meat.hpp" | | #include "armadillo_bits/op_princomp_cov_meat.hpp" | |
|
| | | #include "armadillo_bits/op_misc_meat.hpp" | |
| | | #include "armadillo_bits/op_relational_meat.hpp" | |
| | | #include "armadillo_bits/op_find_meat.hpp" | |
| | | #include "armadillo_bits/op_chol_meat.hpp" | |
| | | #include "armadillo_bits/op_cx_scalar_meat.hpp" | |
| | | | |
| #include "armadillo_bits/glue_times_meat.hpp" | | #include "armadillo_bits/glue_times_meat.hpp" | |
|
| | | #include "armadillo_bits/glue_mixed_meat.hpp" | |
| #include "armadillo_bits/glue_cov_meat.hpp" | | #include "armadillo_bits/glue_cov_meat.hpp" | |
| #include "armadillo_bits/glue_cor_meat.hpp" | | #include "armadillo_bits/glue_cor_meat.hpp" | |
| #include "armadillo_bits/glue_kron_meat.hpp" | | #include "armadillo_bits/glue_kron_meat.hpp" | |
| #include "armadillo_bits/glue_cross_meat.hpp" | | #include "armadillo_bits/glue_cross_meat.hpp" | |
| #include "armadillo_bits/glue_join_meat.hpp" | | #include "armadillo_bits/glue_join_meat.hpp" | |
|
| | | #include "armadillo_bits/glue_relational_meat.hpp" | |
| | | #include "armadillo_bits/glue_solve_meat.hpp" | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 13 change blocks. |
| 3 lines changed or deleted | | 28 lines changed or added | |
|
| eop_aux.hpp | | eop_aux.hpp | |
| | | | |
| skipping to change at line 107 | | skipping to change at line 107 | |
| struct eop_aux_randn< std::complex<T> > | | struct eop_aux_randn< std::complex<T> > | |
| { | | { | |
| arma_inline | | arma_inline | |
| operator std::complex<T> () const | | operator std::complex<T> () const | |
| { | | { | |
| return std::complex<T>( T(eop_aux_randn<T>()), T(eop_aux_randn<T>()) ); | | return std::complex<T>( T(eop_aux_randn<T>()), T(eop_aux_randn<T>()) ); | |
| } | | } | |
| | | | |
| }; | | }; | |
| | | | |
|
| | | //! use of the SFINAE approach to work around compiler limitations | |
| | | //! http://en.wikipedia.org/wiki/SFINAE | |
| | | | |
| class eop_aux | | class eop_aux | |
| { | | { | |
| public: | | public: | |
| | | | |
| #if defined(ARMA_USE_BOOST) | | #if defined(ARMA_USE_BOOST) | |
| #define arma_boost_wrap(trig_fn, val) ( (boost::math::trig_fn)(val) ) | | #define arma_boost_wrap(trig_fn, val) ( (boost::math::trig_fn)(val) ) | |
| #else | | #else | |
| #define arma_boost_wrap(trig_fn, val) ( arma_stop( #trig_fn "(): need B
oost libraries" ), val ) | | #define arma_boost_wrap(trig_fn, val) ( arma_stop( #trig_fn "(): need B
oost libraries" ), val ) | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 146 | | skipping to change at line 149 | |
| | | | |
| template<typename T> arma_inline static std::complex<T> acosh (const std
::complex<T>& x) { return arma_boost_wrap(acosh, x); } | | template<typename T> arma_inline static std::complex<T> acosh (const std
::complex<T>& x) { return arma_boost_wrap(acosh, x); } | |
| template<typename T> arma_inline static std::complex<T> asinh (const std
::complex<T>& x) { return arma_boost_wrap(asinh, x); } | | template<typename T> arma_inline static std::complex<T> asinh (const std
::complex<T>& x) { return arma_boost_wrap(asinh, x); } | |
| template<typename T> arma_inline static std::complex<T> atanh (const std
::complex<T>& x) { return arma_boost_wrap(atanh, x); } | | template<typename T> arma_inline static std::complex<T> atanh (const std
::complex<T>& x) { return arma_boost_wrap(atanh, x); } | |
| | | | |
| #undef arma_boost_wrap | | #undef arma_boost_wrap | |
| | | | |
| template<typename eT> arma_inline static eT conj(const eT&
x) { return x; } | | template<typename eT> arma_inline static eT conj(const eT&
x) { return x; } | |
| template<typename T> arma_inline static std::complex<T> conj(const std::
complex<T>& x) { return std::conj(x); } | | template<typename T> arma_inline static std::complex<T> conj(const std::
complex<T>& x) { return std::conj(x); } | |
| | | | |
|
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result sqrt (const eT& x) { return std::sqrt (double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result log10 (const eT& x) { return std::log10(double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result log (const eT& x) { return std::log (double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result exp (const eT& x) { return std::exp (double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result cos (const eT& x) { return std::cos (double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result sin (const eT& x) { return std::sin (double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result tan (const eT& x) { return std::tan (double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result cosh (const eT& x) { return std::cosh (double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result sinh (const eT& x) { return std::sinh (double(x)); } | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result tanh (const eT& x) { return std::tanh (double(x)); } | |
| | | | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result sqrt (const eT& x) { return std::sqrt (x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result log10 (const eT& x) { return std::log10(x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result log (const eT& x) { return std::log (x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result exp (const eT& x) { return std::exp (x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result cos (const eT& x) { return std::cos (x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result sin (const eT& x) { return std::sin (x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result tan (const eT& x) { return std::tan (x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result cosh (const eT& x) { return std::cosh (x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result sinh (const eT& x) { return std::sinh (x); } | |
| | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| | | T>::result tanh (const eT& x) { return std::tanh (x); } | |
| | | | |
| template<typename T1, typename T2> arma_inline static | | template<typename T1, typename T2> arma_inline static | |
| T1 pow(const T1 base, const T2 exponent) { return std::pow(base, ex
ponent); } | | T1 pow(const T1 base, const T2 exponent) { return std::pow(base, ex
ponent); } | |
| | | | |
| template<typename T2> arma_inline static | | template<typename T2> arma_inline static | |
| char pow(const char base, const T2 exponent) { typedef char out_t; ret
urn out_t( std::pow(double(base), double(exponent) ) ); } | | char pow(const char base, const T2 exponent) { typedef char out_t; ret
urn out_t( std::pow(double(base), double(exponent) ) ); } | |
| | | | |
| template<typename T2> arma_inline static | | template<typename T2> arma_inline static | |
| short pow(const short base, const T2 exponent) { typedef short out_t; ret
urn out_t( std::pow(double(base), double(exponent) ) ); } | | short pow(const short base, const T2 exponent) { typedef short out_t; ret
urn out_t( std::pow(double(base), double(exponent) ) ); } | |
| | | | |
| template<typename T2> arma_inline static | | template<typename T2> arma_inline static | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 45 lines changed or added | |
|
| eop_core_meat.hpp | | eop_core_meat.hpp | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 66 | |
| // the optimiser will keep only one return statement | | // the optimiser will keep only one return statement | |
| | | | |
| if(is_same_type<eop_type, eop_neg >::value == true) { r
eturn -val; } | | if(is_same_type<eop_type, eop_neg >::value == true) { r
eturn -val; } | |
| else if(is_same_type<eop_type, eop_scalar_plus >::value == true) { r
eturn val + x.aux; } | | else if(is_same_type<eop_type, eop_scalar_plus >::value == true) { r
eturn val + x.aux; } | |
| else if(is_same_type<eop_type, eop_scalar_minus_pre >::value == true) { r
eturn x.aux - val; } | | else if(is_same_type<eop_type, eop_scalar_minus_pre >::value == true) { r
eturn x.aux - val; } | |
| else if(is_same_type<eop_type, eop_scalar_minus_post>::value == true) { r
eturn val - x.aux; } | | else if(is_same_type<eop_type, eop_scalar_minus_post>::value == true) { r
eturn val - x.aux; } | |
| else if(is_same_type<eop_type, eop_scalar_times >::value == true) { r
eturn val * x.aux; } | | else if(is_same_type<eop_type, eop_scalar_times >::value == true) { r
eturn val * x.aux; } | |
| else if(is_same_type<eop_type, eop_scalar_div_pre >::value == true) { r
eturn x.aux / val; } | | else if(is_same_type<eop_type, eop_scalar_div_pre >::value == true) { r
eturn x.aux / val; } | |
| else if(is_same_type<eop_type, eop_scalar_div_post >::value == true) { r
eturn val / x.aux; } | | else if(is_same_type<eop_type, eop_scalar_div_post >::value == true) { r
eturn val / x.aux; } | |
| else if(is_same_type<eop_type, eop_square >::value == true) { r
eturn val*val; } | | else if(is_same_type<eop_type, eop_square >::value == true) { r
eturn val*val; } | |
|
| else if(is_same_type<eop_type, eop_sqrt >::value == true) { r | | else if(is_same_type<eop_type, eop_sqrt >::value == true) { r | |
| eturn std::sqrt(val); } | | eturn eop_aux::sqrt(val); } | |
| else if(is_same_type<eop_type, eop_log10 >::value == true) { r | | else if(is_same_type<eop_type, eop_log10 >::value == true) { r | |
| eturn std::log10(val); } | | eturn eop_aux::log10(val); } | |
| else if(is_same_type<eop_type, eop_log >::value == true) { r | | else if(is_same_type<eop_type, eop_log >::value == true) { r | |
| eturn std::log(val); } | | eturn eop_aux::log(val); } | |
| else if(is_same_type<eop_type, eop_trunc_log >::value == true) { r
eturn eop_aux::trunc_log(val); } | | else if(is_same_type<eop_type, eop_trunc_log >::value == true) { r
eturn eop_aux::trunc_log(val); } | |
|
| else if(is_same_type<eop_type, eop_exp >::value == true) { r
eturn std::exp(val); } | | else if(is_same_type<eop_type, eop_exp >::value == true) { r
eturn eop_aux::exp(val); } | |
| else if(is_same_type<eop_type, eop_trunc_exp >::value == true) { r
eturn eop_aux::trunc_exp(val); } | | else if(is_same_type<eop_type, eop_trunc_exp >::value == true) { r
eturn eop_aux::trunc_exp(val); } | |
|
| else if(is_same_type<eop_type, eop_cos >::value == true) { r | | else if(is_same_type<eop_type, eop_cos >::value == true) { r | |
| eturn std::cos(val); } | | eturn eop_aux::cos(val); } | |
| else if(is_same_type<eop_type, eop_sin >::value == true) { r | | else if(is_same_type<eop_type, eop_sin >::value == true) { r | |
| eturn std::sin(val); } | | eturn eop_aux::sin(val); } | |
| else if(is_same_type<eop_type, eop_tan >::value == true) { r | | else if(is_same_type<eop_type, eop_tan >::value == true) { r | |
| eturn std::tan(val); } | | eturn eop_aux::tan(val); } | |
| else if(is_same_type<eop_type, eop_acos >::value == true) { r
eturn eop_aux::acos(val); } | | else if(is_same_type<eop_type, eop_acos >::value == true) { r
eturn eop_aux::acos(val); } | |
| else if(is_same_type<eop_type, eop_asin >::value == true) { r
eturn eop_aux::asin(val); } | | else if(is_same_type<eop_type, eop_asin >::value == true) { r
eturn eop_aux::asin(val); } | |
| else if(is_same_type<eop_type, eop_atan >::value == true) { r
eturn eop_aux::atan(val); } | | else if(is_same_type<eop_type, eop_atan >::value == true) { r
eturn eop_aux::atan(val); } | |
|
| else if(is_same_type<eop_type, eop_cosh >::value == true) { r | | else if(is_same_type<eop_type, eop_cosh >::value == true) { r | |
| eturn std::cosh(val); } | | eturn eop_aux::cosh(val); } | |
| else if(is_same_type<eop_type, eop_sinh >::value == true) { r | | else if(is_same_type<eop_type, eop_sinh >::value == true) { r | |
| eturn std::sinh(val); } | | eturn eop_aux::sinh(val); } | |
| else if(is_same_type<eop_type, eop_tanh >::value == true) { r | | else if(is_same_type<eop_type, eop_tanh >::value == true) { r | |
| eturn std::tanh(val); } | | eturn eop_aux::tanh(val); } | |
| else if(is_same_type<eop_type, eop_acosh >::value == true) { r
eturn eop_aux::acosh(val); } | | else if(is_same_type<eop_type, eop_acosh >::value == true) { r
eturn eop_aux::acosh(val); } | |
| else if(is_same_type<eop_type, eop_asinh >::value == true) { r
eturn eop_aux::asinh(val); } | | else if(is_same_type<eop_type, eop_asinh >::value == true) { r
eturn eop_aux::asinh(val); } | |
| else if(is_same_type<eop_type, eop_atanh >::value == true) { r
eturn eop_aux::atanh(val); } | | else if(is_same_type<eop_type, eop_atanh >::value == true) { r
eturn eop_aux::atanh(val); } | |
| else if(is_same_type<eop_type, eop_eps >::value == true) { r
eturn eop_aux::direct_eps(val); } | | else if(is_same_type<eop_type, eop_eps >::value == true) { r
eturn eop_aux::direct_eps(val); } | |
| else if(is_same_type<eop_type, eop_abs >::value == true) { r
eturn eop_aux::arma_abs(val); } | | else if(is_same_type<eop_type, eop_abs >::value == true) { r
eturn eop_aux::arma_abs(val); } | |
| else if(is_same_type<eop_type, eop_conj >::value == true) { r
eturn eop_aux::conj(val); } | | else if(is_same_type<eop_type, eop_conj >::value == true) { r
eturn eop_aux::conj(val); } | |
| else if(is_same_type<eop_type, eop_pow >::value == true) { r
eturn eop_aux::pow(val, x.aux); } | | else if(is_same_type<eop_type, eop_pow >::value == true) { r
eturn eop_aux::pow(val, x.aux); } | |
| else if(is_same_type<eop_type, eop_pow_int >::value == true) | | else if(is_same_type<eop_type, eop_pow_int >::value == true) | |
| { | | { | |
| const int exponent = (x.aux_u32_b == 0) ? int(x.aux_u32_a) : -int(x.aux
_u32_a); | | const int exponent = (x.aux_u32_b == 0) ? int(x.aux_u32_a) : -int(x.aux
_u32_a); | |
| | | | |
| skipping to change at line 185 | | skipping to change at line 185 | |
| inline | | inline | |
| void | | void | |
| eop_core<eop_type>::apply_unwrap(Mat<typename T1::elem_type>& out, const eO
p<T1, eop_type>& x) | | eop_core<eop_type>::apply_unwrap(Mat<typename T1::elem_type>& out, const eO
p<T1, eop_type>& x) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const Proxy<T1>& P = x.P; | | const Proxy<T1>& P = x.P; | |
| | | | |
|
| | | // cout << "*** P.n_rows = " << P.n_rows << endl; | |
| | | // cout << "*** P.n_cols = " << P.n_cols << endl; | |
| | | | |
| out.set_size(P.n_rows, P.n_cols); | | out.set_size(P.n_rows, P.n_cols); | |
| | | | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| const u32 n_elem = P.n_elem; | | const u32 n_elem = P.n_elem; | |
| | | | |
| const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q); | | const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q); | |
| const Mat<eT>& A = tmp.M; | | const Mat<eT>& A = tmp.M; | |
| | | | |
| if(is_generator<eop_type>::value == true) | | if(is_generator<eop_type>::value == true) | |
| { | | { | |
| | | | |
End of changes. 5 change blocks. |
| 19 lines changed or deleted | | 22 lines changed or added | |
|
| fn_kron.hpp | | fn_kron.hpp | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return Glue<T1, T2, glue_kron>(A.get_ref(), B.get_ref()); | | return Glue<T1, T2, glue_kron>(A.get_ref(), B.get_ref()); | |
| } | | } | |
| | | | |
| //! \brief | | //! \brief | |
| //! kronecker product of two matrices, | | //! kronecker product of two matrices, | |
| //! with the matrices having different element types | | //! with the matrices having different element types | |
| template<typename T, typename T1, typename T2> | | template<typename T, typename T1, typename T2> | |
| inline | | inline | |
|
| Mat<typename promote_type<typename T1::elem_type,typename T2::elem_type>::r
esult> | | Mat<typename eT_promoter<T1,T2>::eT> | |
| kron(const Base<std::complex<T>,T1>& X, const Base<T,T2>& Y) | | kron(const Base<std::complex<T>,T1>& X, const Base<T,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename std::complex<T> eT1; | | typedef typename std::complex<T> eT1; | |
| | | | |
| promote_type<eT1,T>::check(); | | promote_type<eT1,T>::check(); | |
| | | | |
| const unwrap<T1> tmp1(X.get_ref()); | | const unwrap<T1> tmp1(X.get_ref()); | |
| const unwrap<T2> tmp2(Y.get_ref()); | | const unwrap<T2> tmp2(Y.get_ref()); | |
| | | | |
|
| const Mat< eT1 >& A = tmp1.M; | | const Mat<eT1>& A = tmp1.M; | |
| const Mat<T>& B = tmp2.M; | | const Mat<T >& B = tmp2.M; | |
| | | | |
| Mat<eT1> out; | | Mat<eT1> out; | |
| | | | |
| glue_kron::direct_kron(out, A, B); | | glue_kron::direct_kron(out, A, B); | |
| | | | |
| return out; | | return out; | |
| } | | } | |
| | | | |
| //! \brief | | //! \brief | |
| //! kronecker product of two matrices, | | //! kronecker product of two matrices, | |
| //! with the matrices having different element types | | //! with the matrices having different element types | |
| template<typename T, typename T1, typename T2> | | template<typename T, typename T1, typename T2> | |
| inline | | inline | |
|
| Mat<typename promote_type<typename T1::elem_type,typename T2::elem_type>::r
esult> | | Mat<typename eT_promoter<T1,T2>::eT> | |
| kron(const Base<T,T1>& X, const Base<std::complex<T>,T2>& Y) | | kron(const Base<T,T1>& X, const Base<std::complex<T>,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename std::complex<T> eT2; | | typedef typename std::complex<T> eT2; | |
| | | | |
| promote_type<T,eT2>::check(); | | promote_type<T,eT2>::check(); | |
| | | | |
| const unwrap<T1> tmp1(X.get_ref()); | | const unwrap<T1> tmp1(X.get_ref()); | |
| const unwrap<T2> tmp2(Y.get_ref()); | | const unwrap<T2> tmp2(Y.get_ref()); | |
| | | | |
|
| const Mat<T>& A = tmp1.M; | | const Mat<T >& A = tmp1.M; | |
| const Mat< eT2 >& B = tmp2.M; | | const Mat<eT2>& B = tmp2.M; | |
| | | | |
| Mat<eT2> out; | | Mat<eT2> out; | |
| | | | |
| glue_kron::direct_kron(out, A, B); | | glue_kron::direct_kron(out, A, B); | |
| | | | |
| return out; | | return out; | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 4 change blocks. |
| 6 lines changed or deleted | | 6 lines changed or added | |
|
| fn_misc.hpp | | fn_misc.hpp | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 76 | |
| } | | } | |
| | | | |
| inline | | inline | |
| mat | | mat | |
| linspace(const double start, const double end, const u32 num, const u32 dim
= 0) | | linspace(const double start, const double end, const u32 num, const u32 dim
= 0) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| return linspace<mat>(start, end, num, dim); | | return linspace<mat>(start, end, num, dim); | |
| } | | } | |
| | | | |
|
| | | template<typename eT, typename T1> | |
| | | inline | |
| | | const mtOp<u32, T1, op_find> | |
| | | find(const Base<eT,T1>& X, const u32 k = 0, const char* direction = "first" | |
| | | ) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const char sig = direction[0]; | |
| | | | |
| | | arma_debug_check( (sig != 'f' && sig != 'F' && sig != 'l' && sig != 'L'), | |
| | | "find(): 3rd input argument must be \"first\" or \"last\"" ); | |
| | | | |
| | | const u32 type = (sig == 'f' || sig == 'F') ? 0 : 1; | |
| | | | |
| | | return mtOp<u32, T1, op_find>(X.get_ref(), k, type); | |
| | | } | |
| | | | |
| // | | // | |
| // real | | // real | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const T1& | | const T1& | |
| real(const Base<typename T1::pod_type, T1>& X) | | real(const Base<typename T1::pod_type, T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 117 | |
| const T1& | | const T1& | |
| real(const BaseCube<typename T1::pod_type, T1>& X) | | real(const BaseCube<typename T1::pod_type, T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return X.get_ref(); | | return X.get_ref(); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| Mat<typename T1::pod_type> | | const mtOp<typename T1::pod_type, T1, op_real> | |
| real(const Base<std::complex<typename T1::pod_type>, T1>& X) | | real(const Base<std::complex<typename T1::pod_type>, T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::pod_type T; | | return mtOp<typename T1::pod_type, T1, op_real>( X.get_ref() ); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<T> out(A.n_rows, A.n_cols); | | | |
| | | | |
| T* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<out.n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = std::real(A[i]); | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| Cube<typename T1::pod_type> | | Cube<typename T1::pod_type> | |
| real(const BaseCube<std::complex<typename T1::pod_type>, T1>& X) | | real(const BaseCube<std::complex<typename T1::pod_type>, T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::pod_type T; | | typedef typename T1::pod_type T; | |
| | | | |
| skipping to change at line 174 | | skipping to change at line 177 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const ProxyCube<T1> A(X.get_ref()); | | const ProxyCube<T1> A(X.get_ref()); | |
| | | | |
| return eOpCube<Cube<typename T1::pod_type>, eop_cube_zeros>(A.n_rows, A.n
_cols, A.n_slices); | | return eOpCube<Cube<typename T1::pod_type>, eop_cube_zeros>(A.n_rows, A.n
_cols, A.n_slices); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| Mat<typename T1::pod_type> | | const mtOp<typename T1::pod_type, T1, op_imag> | |
| imag(const Base<std::complex<typename T1::pod_type>,T1>& X) | | imag(const Base<std::complex<typename T1::pod_type>, T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::pod_type T; | | return mtOp<typename T1::pod_type, T1, op_imag>( X.get_ref() ); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<T> out(A.n_rows, A.n_cols); | | | |
| | | | |
| T* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<out.n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = std::imag(A[i]); | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| Cube<typename T1::pod_type> | | Cube<typename T1::pod_type> | |
| imag(const BaseCube<std::complex<typename T1::pod_type>,T1>& X) | | imag(const BaseCube<std::complex<typename T1::pod_type>,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::pod_type T; | | typedef typename T1::pod_type T; | |
| | | | |
| skipping to change at line 387 | | skipping to change at line 377 | |
| const eOpCube<T1, eop_cube_abs> | | const eOpCube<T1, eop_cube_abs> | |
| abs(const BaseCube<typename T1::elem_type,T1>& X) | | abs(const BaseCube<typename T1::elem_type,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eOpCube<T1, eop_cube_abs>(X.get_ref()); | | return eOpCube<T1, eop_cube_abs>(X.get_ref()); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| Mat<typename T1::pod_type> | | const mtOp<typename T1::pod_type, T1, op_abs> | |
| abs(const Base< std::complex<typename T1::pod_type>,T1>& X) | | abs(const Base<std::complex<typename T1::pod_type>, T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const Proxy<T1> A(X.get_ref()); | | return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | |
| | | | |
| // if T1 is a complex matrix, | | | |
| // pod_type is the underlying type used by std::complex; | | | |
| // otherwise pod_type is the same as elem_type | | | |
| | | | |
| typedef typename T1::elem_type in_eT; | | | |
| typedef typename T1::pod_type out_eT; | | | |
| | | | |
| Mat<out_eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| out_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<out.n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = std::abs(A[i]); | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| Mat<typename T1::pod_type> | | Mat<typename T1::pod_type> | |
| abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X) | | abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const ProxyCube<T1> A(X.get_ref()); | | const ProxyCube<T1> A(X.get_ref()); | |
| | | | |
| skipping to change at line 465 | | skipping to change at line 437 | |
| arma_inline | | arma_inline | |
| const eOpCube<T1, eop_cube_abs> | | const eOpCube<T1, eop_cube_abs> | |
| fabs(const BaseCube<typename T1::pod_type,T1>& X) | | fabs(const BaseCube<typename T1::pod_type,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eOpCube<T1, eop_cube_abs>(X.get_ref()); | | return eOpCube<T1, eop_cube_abs>(X.get_ref()); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
|
| arma_inline | | inline | |
| Mat<typename T1::pod_type> | | const mtOp<typename T1::pod_type, T1, op_abs> | |
| fabs(const Base< std::complex<typename T1::pod_type>,T1>& X) | | fabs(const Base<std::complex<typename T1::pod_type>, T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return abs(X); | | return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| Mat<typename T1::pod_type> | | Mat<typename T1::pod_type> | |
| fabs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X) | | fabs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return abs(X); | | return abs(X); | |
| | | | |
End of changes. 9 change blocks. |
| 56 lines changed or deleted | | 30 lines changed or added | |
|
| operator_div.hpp | | operator_div.hpp | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| ( | | ( | |
| const typename T1::elem_type k, | | const typename T1::elem_type k, | |
| const Base<typename T1::elem_type,T1>& X | | const Base<typename T1::elem_type,T1>& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eOp<T1, eop_scalar_div_pre>(X.get_ref(), k); | | return eOp<T1, eop_scalar_div_pre>(X.get_ref(), k); | |
| } | | } | |
| | | | |
|
| //! non-complex Base / complex scalar (experimental) | | //! complex scalar / non-complex Base (experimental) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename std::complex<typename T1::pod_type> > | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_d
iv_pre> | |
| operator/ | | operator/ | |
| ( | | ( | |
|
| const Base<typename T1::pod_type, T1>& X, | | const std::complex<typename T1::pod_type>& k, | |
| const std::complex<typename T1::pod_type>& k | | const Base<typename T1::pod_type, T1>& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename std::complex<typename T1::pod_type> eT; | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala | |
| typedef typename T1::pod_type T; | | r_div_pre>('j', X.get_ref(), k); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| const u32 n_elem = A.n_elem; | | | |
| eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = A[i] / k; | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
|
| //! complex scalar / non-complex Base (experimental) | | //! non-complex Base / complex scalar (experimental) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename std::complex<typename T1::pod_type> > | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_d
iv_post> | |
| operator/ | | operator/ | |
| ( | | ( | |
|
| const std::complex<typename T1::pod_type>& k, | | const Base<typename T1::pod_type, T1>& X, | |
| const Base<typename T1::pod_type, T1>& X | | const std::complex<typename T1::pod_type>& k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename std::complex<typename T1::pod_type> eT; | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala | |
| typedef typename T1::pod_type T; | | r_div_post>('j', X.get_ref(), k); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| const u32 n_elem = A.n_elem; | | | |
| eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = k / A[i]; | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! element-wise division of Base objects with same element type | | //! element-wise division of Base objects with same element type | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
| const eGlue<T1, T2, eglue_div> | | const eGlue<T1, T2, eglue_div> | |
| operator/ | | operator/ | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const Base<typename T1::elem_type,T2>& Y | | const Base<typename T1::elem_type,T2>& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eGlue<T1, T2, eglue_div>(X.get_ref(), Y.get_ref()); | | return eGlue<T1, T2, eglue_div>(X.get_ref(), Y.get_ref()); | |
| } | | } | |
| | | | |
| //! element-wise division of Base objects with different element types | | //! element-wise division of Base objects with different element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
|
| arma_inline | | inline | |
| Mat<typename promote_type<typename T1::elem_type, typename T2::elem_type>:: | | const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele | |
| result> | | m_type>::result, T1, T2, glue_mixed_div> | |
| operator/ | | operator/ | |
| ( | | ( | |
| const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T1_result, T1>& X, | | const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T1_result, T1>& X, | |
| const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y | | const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT1; | | typedef typename T1::elem_type eT1; | |
| typedef typename T2::elem_type eT2; | | typedef typename T2::elem_type eT2; | |
| | | | |
| typedef typename promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| const Proxy<T1> A(X.get_ref()); | | return mtGlue<out_eT, T1, T2, glue_mixed_div>( X.get_ref(), Y.get_ref() ) | |
| const Proxy<T2> B(Y.get_ref()); | | ; | |
| | | | |
| arma_debug_assert_same_size(A, B, "element-wise matrix division"); | | | |
| | | | |
| Mat<out_eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| out_eT* out_mem = out.memptr(); | | | |
| const u32 n_elem = out.n_elem; | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) / upgrade_val<eT1,eT2>:: | | | |
| apply(B[i]); | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 10 change blocks. |
| 60 lines changed or deleted | | 17 lines changed or added | |
|
| operator_minus.hpp | | operator_minus.hpp | |
| | | | |
| skipping to change at line 73 | | skipping to change at line 73 | |
| ( | | ( | |
| const typename T1::elem_type k, | | const typename T1::elem_type k, | |
| const Base<typename T1::elem_type,T1>& X | | const Base<typename T1::elem_type,T1>& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eOp<T1, eop_scalar_minus_pre>(X.get_ref(), k); | | return eOp<T1, eop_scalar_minus_pre>(X.get_ref(), k); | |
| } | | } | |
| | | | |
|
| //! non-complex Base - complex scalar (experimental) | | //! complex scalar - non-complex Base (experimental) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename std::complex<typename T1::pod_type> > | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_m
inus_pre> | |
| operator- | | operator- | |
| ( | | ( | |
|
| const Base<typename T1::pod_type, T1>& X, | | const std::complex<typename T1::pod_type>& k, | |
| const std::complex<typename T1::pod_type>& k | | const Base<typename T1::pod_type, T1>& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename std::complex<typename T1::pod_type> eT; | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala | |
| typedef typename T1::pod_type T; | | r_minus_pre>('j', X.get_ref(), k); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| const u32 n_elem = A.n_elem; | | | |
| eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = A[i] - k; | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
|
| //! complex scalar - non-complex Base (experimental) | | //! non-complex Base - complex scalar (experimental) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename std::complex<typename T1::pod_type> > | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_m
inus_post> | |
| operator- | | operator- | |
| ( | | ( | |
|
| const std::complex<typename T1::pod_type>& k, | | const Base<typename T1::pod_type, T1>& X, | |
| const Base<typename T1::pod_type, T1>& X | | const std::complex<typename T1::pod_type>& k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename std::complex<typename T1::pod_type> eT; | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala | |
| typedef typename T1::pod_type T; | | r_minus_post>('j', X.get_ref(), k); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| const u32 n_elem = A.n_elem; | | | |
| eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = k - A[i]; | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! subtraction of Base objects with same element type | | //! subtraction of Base objects with same element type | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
| const eGlue<T1, T2, eglue_minus> | | const eGlue<T1, T2, eglue_minus> | |
| operator- | | operator- | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const Base<typename T1::elem_type,T2>& Y | | const Base<typename T1::elem_type,T2>& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eGlue<T1, T2, eglue_minus>(X.get_ref(), Y.get_ref()); | | return eGlue<T1, T2, eglue_minus>(X.get_ref(), Y.get_ref()); | |
| } | | } | |
| | | | |
| //! subtraction of Base objects with different element types | | //! subtraction of Base objects with different element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
|
| arma_inline | | inline | |
| Mat<typename promote_type<typename T1::elem_type, typename T2::elem_type>:: | | const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele | |
| result> | | m_type>::result, T1, T2, glue_mixed_minus> | |
| operator- | | operator- | |
| ( | | ( | |
| const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T1_result, T1>& X, | | const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T1_result, T1>& X, | |
| const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y | | const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT1; | | typedef typename T1::elem_type eT1; | |
| typedef typename T2::elem_type eT2; | | typedef typename T2::elem_type eT2; | |
| | | | |
| typedef typename promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| const Proxy<T1> A(X.get_ref()); | | return mtGlue<out_eT, T1, T2, glue_mixed_minus>( X.get_ref(), Y.get_ref() | |
| const Proxy<T2> B(Y.get_ref()); | | ); | |
| | | | |
| arma_debug_assert_same_size(A, B, "matrix subtraction"); | | | |
| | | | |
| Mat<out_eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| out_eT* out_mem = out.memptr(); | | | |
| const u32 n_elem = out.n_elem; | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) - upgrade_val<eT1,eT2>:: | | | |
| apply(B[i]); | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 10 change blocks. |
| 60 lines changed or deleted | | 17 lines changed or added | |
|
| operator_plus.hpp | | operator_plus.hpp | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| (const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X) | | (const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eOp<T1, eop_scalar_plus>(X.get_ref(), k); // NOTE: order is swapp
ed | | return eOp<T1, eop_scalar_plus>(X.get_ref(), k); // NOTE: order is swapp
ed | |
| } | | } | |
| | | | |
| //! non-complex Base + complex scalar (experimental) | | //! non-complex Base + complex scalar (experimental) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename std::complex<typename T1::pod_type> > | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_p
lus> | |
| operator+ | | operator+ | |
| ( | | ( | |
| const Base<typename T1::pod_type, T1>& X, | | const Base<typename T1::pod_type, T1>& X, | |
| const std::complex<typename T1::pod_type>& k | | const std::complex<typename T1::pod_type>& k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename std::complex<typename T1::pod_type> eT; | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala | |
| typedef typename T1::pod_type T; | | r_plus>('j', X.get_ref(), k); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| const u32 n_elem = A.n_elem; | | | |
| eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = A[i] + k; | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! complex scalar + non-complex Base (experimental) | | //! complex scalar + non-complex Base (experimental) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename std::complex<typename T1::pod_type> > | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_p
lus> | |
| operator+ | | operator+ | |
| ( | | ( | |
| const std::complex<typename T1::pod_type>& k, | | const std::complex<typename T1::pod_type>& k, | |
| const Base<typename T1::pod_type, T1>& X | | const Base<typename T1::pod_type, T1>& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename std::complex<typename T1::pod_type> eT; | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala | |
| typedef typename T1::pod_type T; | | r_plus>('j', X.get_ref(), k); // NOTE: order is swapped | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| const u32 n_elem = A.n_elem; | | | |
| eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = k + A[i]; | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! addition of Base objects with same element type | | //! addition of Base objects with same element type | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
| const eGlue<T1, T2, eglue_plus> | | const eGlue<T1, T2, eglue_plus> | |
| operator+ | | operator+ | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const Base<typename T1::elem_type,T2>& Y | | const Base<typename T1::elem_type,T2>& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eGlue<T1, T2, eglue_plus>(X.get_ref(), Y.get_ref()); | | return eGlue<T1, T2, eglue_plus>(X.get_ref(), Y.get_ref()); | |
| } | | } | |
| | | | |
| //! addition of Base objects with different element types | | //! addition of Base objects with different element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
|
| arma_inline | | inline | |
| Mat<typename promote_type<typename T1::elem_type, typename T2::elem_type>:: | | const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele | |
| result> | | m_type>::result, T1, T2, glue_mixed_plus> | |
| operator+ | | operator+ | |
| ( | | ( | |
| const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T1_result, T1>& X, | | const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T1_result, T1>& X, | |
| const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y | | const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT1; | | typedef typename T1::elem_type eT1; | |
| typedef typename T2::elem_type eT2; | | typedef typename T2::elem_type eT2; | |
| | | | |
| typedef typename promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| const Proxy<T1> A(X.get_ref()); | | return mtGlue<out_eT, T1, T2, glue_mixed_plus>( X.get_ref(), Y.get_ref() | |
| const Proxy<T2> B(Y.get_ref()); | | ); | |
| | | | |
| arma_debug_assert_same_size(A, B, "matrix addition"); | | | |
| | | | |
| Mat<out_eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| out_eT* out_mem = out.memptr(); | | | |
| const u32 n_elem = out.n_elem; | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) + upgrade_val<eT1,eT2>:: | | | |
| apply(B[i]); | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 6 change blocks. |
| 54 lines changed or deleted | | 11 lines changed or added | |
|
| operator_relational.hpp | | operator_relational.hpp | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| // for any purpose. You can redistribute this file | | // for any purpose. You can redistribute this file | |
| // and/or modify it under the terms of the GNU | | // and/or modify it under the terms of the GNU | |
| // Lesser General Public License (LGPL) as published | | // Lesser General Public License (LGPL) as published | |
| // by the Free Software Foundation, either version 3 | | // by the Free Software Foundation, either version 3 | |
| // of the License or (at your option) any later version. | | // of the License or (at your option) any later version. | |
| // (see http://www.opensource.org/licenses for more info) | | // (see http://www.opensource.org/licenses for more info) | |
| | | | |
| //! \addtogroup operator_relational | | //! \addtogroup operator_relational | |
| //! @{ | | //! @{ | |
| | | | |
|
| | | // < : lt | |
| | | // > : gt | |
| | | // <= : lteq | |
| | | // >= : gteq | |
| | | // == : eq | |
| | | // != : noteq | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| umat | | const mtGlue<u32, T1, T2, glue_rel_lt> | |
| operator== | | operator< | |
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ | | (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co | |
| e,T2>& Y) | | nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtGlue<u32, T1, T2, glue_rel_lt>( X.get_ref(), Y.get_ref() ); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| const Proxy<T2> B(Y.get_ref()); | | | |
| | | | |
| arma_debug_assert_same_size(A, B, "operator=="); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] == B[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| umat | | const mtGlue<u32, T1, T2, glue_rel_gt> | |
| operator!= | | operator> | |
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ | | (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co | |
| e,T2>& Y) | | nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtGlue<u32, T1, T2, glue_rel_gt>( X.get_ref(), Y.get_ref() ); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| const Proxy<T2> B(Y.get_ref()); | | | |
| | | | |
| arma_debug_assert_same_size(A, B, "operator!="); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] != B[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| umat | | const mtGlue<u32, T1, T2, glue_rel_lteq> | |
| operator>= | | operator<= | |
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ | | (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co | |
| e,T2>& Y) | | nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtGlue<u32, T1, T2, glue_rel_lteq>( X.get_ref(), Y.get_ref() ); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| const Proxy<T2> B(Y.get_ref()); | | | |
| | | | |
| arma_debug_assert_same_size(A, B, "operator>="); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] >= B[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| umat | | const mtGlue<u32, T1, T2, glue_rel_gteq> | |
| operator<= | | operator>= | |
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ | | (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co | |
| e,T2>& Y) | | nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtGlue<u32, T1, T2, glue_rel_gteq>( X.get_ref(), Y.get_ref() ); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| const Proxy<T2> B(Y.get_ref()); | | | |
| | | | |
| arma_debug_assert_same_size(A, B, "operator<="); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] <= B[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| umat | | const mtGlue<u32, T1, T2, glue_rel_eq> | |
| operator> | | operator== | |
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | | (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtGlue<u32, T1, T2, glue_rel_eq>( X.get_ref(), Y.get_ref() ); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| const Proxy<T2> B(Y.get_ref()); | | | |
| | | | |
| arma_debug_assert_same_size(A, B, "operator>"); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] > B[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| umat | | const mtGlue<u32, T1, T2, glue_rel_noteq> | |
| operator< | | operator!= | |
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | | (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtGlue<u32, T1, T2, glue_rel_noteq>( X.get_ref(), Y.get_ref() ); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| const Proxy<T2> B(Y.get_ref()); | | | |
| | | | |
| arma_debug_assert_same_size(A, B, "operator<"); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] < B[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
|
| | | // | |
| | | // | |
| | | // | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_lt_pre> | |
| operator== | | operator< | |
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val | | (const typename arma_not_cx<typename T1::elem_type>::result val, const Base | |
| ) | | <typename arma_not_cx<typename T1::elem_type>::result,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_lt_pre>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] == val) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_lt_post> | |
| operator!= | | operator< | |
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val | | (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co | |
| ) | | nst typename arma_not_cx<typename T1::elem_type>::result val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_lt_post>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] != val) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_gt_pre> | |
| operator>= | | operator> | |
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val | | (const typename arma_not_cx<typename T1::elem_type>::result val, const Base | |
| ) | | <typename arma_not_cx<typename T1::elem_type>::result,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_gt_pre>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] >= val) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_gt_post> | |
| operator<= | | operator> | |
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val | | (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co | |
| ) | | nst typename arma_not_cx<typename T1::elem_type>::result val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_gt_post>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] <= val) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_lteq_pre> | |
| operator> | | operator<= | |
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val | | (const typename arma_not_cx<typename T1::elem_type>::result val, const Base | |
| ) | | <typename arma_not_cx<typename T1::elem_type>::result,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_lteq_pre>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] > val) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_lteq_post> | |
| operator< | | operator<= | |
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val | | (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co | |
| ) | | nst typename arma_not_cx<typename T1::elem_type>::result val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_lteq_post>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(A[i] < val) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_gteq_pre> | |
| operator== | | operator>= | |
| (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X | | (const typename arma_not_cx<typename T1::elem_type>::result val, const Base | |
| ) | | <typename arma_not_cx<typename T1::elem_type>::result,T1>& X) | |
| { | | { | |
|
| return operator==(X,val); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return mtOp<u32, T1, op_rel_gteq_pre>(X.get_ref(), val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_gteq_post> | |
| operator!= | | operator>= | |
| (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X | | (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co | |
| ) | | nst typename arma_not_cx<typename T1::elem_type>::result val) | |
| { | | { | |
|
| return operator!=(X,val); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return mtOp<u32, T1, op_rel_gteq_post>(X.get_ref(), val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_eq> | |
| operator>= | | operator== | |
| (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X
) | | (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X
) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_eq>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(val >= A[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_eq> | |
| operator<= | | operator== | |
| (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X | | (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_eq>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(val <= A[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_noteq> | |
| operator> | | operator!= | |
| (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X
) | | (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X
) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_noteq>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(val > A[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<u32, T1, op_rel_noteq> | |
| operator< | | operator!= | |
| (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X | | (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename umat::elem_type umat_eT; | | return mtOp<u32, T1, op_rel_noteq>(X.get_ref(), val); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| umat out(A.n_rows, A.n_cols); | | | |
| | | | |
| umat_eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<A.n_elem; ++i) | | | |
| { | | | |
| if(val < A[i]) | | | |
| { | | | |
| out_mem[i] = umat_eT(1); | | | |
| } | | | |
| else | | | |
| { | | | |
| out_mem[i] = umat_eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 38 change blocks. |
| 420 lines changed or deleted | | 97 lines changed or added | |
|
| operator_times.hpp | | operator_times.hpp | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| (const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X) | | (const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eOp<T1, eop_scalar_times>(X.get_ref(),k); // NOTE: order is swapp
ed | | return eOp<T1, eop_scalar_times>(X.get_ref(),k); // NOTE: order is swapp
ed | |
| } | | } | |
| | | | |
| //! non-complex Base * complex scalar (experimental) | | //! non-complex Base * complex scalar (experimental) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename std::complex<typename T1::pod_type> > | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_t
imes> | |
| operator* | | operator* | |
| ( | | ( | |
| const Base<typename T1::pod_type, T1>& X, | | const Base<typename T1::pod_type, T1>& X, | |
| const std::complex<typename T1::pod_type>& k | | const std::complex<typename T1::pod_type>& k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename std::complex<typename T1::pod_type> eT; | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala | |
| typedef typename T1::pod_type T; | | r_times>('j', X.get_ref(), k); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| const u32 n_elem = A.n_elem; | | | |
| eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = A[i] * k; | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! complex scalar * non-complex Base (experimental) | | //! complex scalar * non-complex Base (experimental) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename std::complex<typename T1::pod_type> > | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_t
imes> | |
| operator* | | operator* | |
| ( | | ( | |
| const std::complex<typename T1::pod_type>& k, | | const std::complex<typename T1::pod_type>& k, | |
| const Base<typename T1::pod_type, T1>& X | | const Base<typename T1::pod_type, T1>& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename std::complex<typename T1::pod_type> eT; | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala | |
| typedef typename T1::pod_type T; | | r_times>('j', X.get_ref(), k); | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| Mat<eT> out(A.n_rows, A.n_cols); | | | |
| | | | |
| const u32 n_elem = A.n_elem; | | | |
| eT* out_mem = out.memptr(); | | | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = k * A[i]; | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! scalar * trans(T1) | | //! scalar * trans(T1) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const Op<T1, op_trans2> | | const Op<T1, op_trans2> | |
| operator* | | operator* | |
| (const typename T1::elem_type k, const Op<T1, op_trans>& X) | | (const typename T1::elem_type k, const Op<T1, op_trans>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 200 | | skipping to change at line 170 | |
| operator* | | operator* | |
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | | (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return Glue<T1, T2, glue_times>(X.get_ref(), Y.get_ref()); | | return Glue<T1, T2, glue_times>(X.get_ref(), Y.get_ref()); | |
| } | | } | |
| | | | |
| //! multiplication of Base objects with different element types | | //! multiplication of Base objects with different element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
|
| arma_inline | | inline | |
| Mat<typename promote_type<typename T1::elem_type, typename T2::elem_type>:: | | const mtGlue< typename promote_type<typename T1::elem_type, typename T2::el | |
| result> | | em_type>::result, T1, T2, glue_mixed_times > | |
| operator* | | operator* | |
| ( | | ( | |
| const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T1_result, T1>& X, | | const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T1_result, T1>& X, | |
| const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y | | const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT1; | | typedef typename T1::elem_type eT1; | |
| typedef typename T2::elem_type eT2; | | typedef typename T2::elem_type eT2; | |
| | | | |
| typedef typename promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| const unwrap<T1> tmp1(X.get_ref()); | | return mtGlue<out_eT, T1, T2, glue_mixed_times>( X.get_ref(), Y.get_ref() | |
| const unwrap<T2> tmp2(Y.get_ref()); | | ); | |
| | | | |
| const Mat<eT1>& A = tmp1.M; | | | |
| const Mat<eT2>& B = tmp2.M; | | | |
| | | | |
| Mat<out_eT> out; | | | |
| | | | |
| glue_times::apply_mixed(out, A, B); | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 6 change blocks. |
| 48 lines changed or deleted | | 11 lines changed or added | |
|
| restrictors.hpp | | restrictors.hpp | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| // for any purpose. You can redistribute this file | | // for any purpose. You can redistribute this file | |
| // and/or modify it under the terms of the GNU | | // and/or modify it under the terms of the GNU | |
| // Lesser General Public License (LGPL) as published | | // Lesser General Public License (LGPL) as published | |
| // by the Free Software Foundation, either version 3 | | // by the Free Software Foundation, either version 3 | |
| // of the License or (at your option) any later version. | | // of the License or (at your option) any later version. | |
| // (see http://www.opensource.org/licenses for more info) | | // (see http://www.opensource.org/licenses for more info) | |
| | | | |
| //! \addtogroup restrictors | | //! \addtogroup restrictors | |
| //! @{ | | //! @{ | |
| | | | |
|
| | | // structures for template based restrictions of input/output arguments | |
| | | // (part of the SFINAE approach) | |
| | | // http://en.wikipedia.org/wiki/SFINAE | |
| | | | |
| template<typename T> struct arma_scalar_only { }; | | template<typename T> struct arma_scalar_only { }; | |
| | | | |
| template<> struct arma_scalar_only<char> { typedef char result; }; | | template<> struct arma_scalar_only<char> { typedef char result; }; | |
| template<> struct arma_scalar_only<short> { typedef short result; }; | | template<> struct arma_scalar_only<short> { typedef short result; }; | |
| template<> struct arma_scalar_only<int> { typedef int result; }; | | template<> struct arma_scalar_only<int> { typedef int result; }; | |
| template<> struct arma_scalar_only<long> { typedef long result; }; | | template<> struct arma_scalar_only<long> { typedef long result; }; | |
| template<> struct arma_scalar_only<float> { typedef float result; }; | | template<> struct arma_scalar_only<float> { typedef float result; }; | |
| template<> struct arma_scalar_only<double> { typedef double result; }; | | template<> struct arma_scalar_only<double> { typedef double result; }; | |
| | | | |
| template<> struct arma_scalar_only<unsigned char> { typedef unsigned char
result; }; | | template<> struct arma_scalar_only<unsigned char> { typedef unsigned char
result; }; | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 70 | |
| template<> struct arma_signed_integral_only<char> { typedef char result
; }; | | template<> struct arma_signed_integral_only<char> { typedef char result
; }; | |
| template<> struct arma_signed_integral_only<short> { typedef short result
; }; | | template<> struct arma_signed_integral_only<short> { typedef short result
; }; | |
| template<> struct arma_signed_integral_only<int> { typedef int result
; }; | | template<> struct arma_signed_integral_only<int> { typedef int result
; }; | |
| template<> struct arma_signed_integral_only<long> { typedef long result
; }; | | template<> struct arma_signed_integral_only<long> { typedef long result
; }; | |
| | | | |
| template<typename T> struct arma_float_only { }; | | template<typename T> struct arma_float_only { }; | |
| | | | |
| template<> struct arma_float_only<float> { typedef float result; }; | | template<> struct arma_float_only<float> { typedef float result; }; | |
| template<> struct arma_float_only<double> { typedef double result; }; | | template<> struct arma_float_only<double> { typedef double result; }; | |
| | | | |
|
| | | template<typename T> struct arma_float_or_cx_only { }; | |
| | | | |
| | | template<> struct arma_float_or_cx_only< float > { typedef f | |
| | | loat result; }; | |
| | | template<> struct arma_float_or_cx_only< double > { typedef d | |
| | | ouble result; }; | |
| | | template<> struct arma_float_or_cx_only< std::complex<float> > { typedef s | |
| | | td::complex<float> result; }; | |
| | | template<> struct arma_float_or_cx_only< std::complex<double> > { typedef s | |
| | | td::complex<double> result; }; | |
| | | | |
| | | template<typename T> struct arma_cx_only { }; | |
| | | template<typename T> struct arma_cx_only< std::complex<T> > { typedef std:: | |
| | | complex<T> result; }; | |
| | | | |
| | | template<typename T> struct arma_not_cx { typedef T resu | |
| | | lt; }; | |
| | | template<typename T> struct arma_not_cx< std::complex<T> > { }; | |
| | | | |
| | | template<typename T> struct arma_op_rel_only { }; | |
| | | | |
| | | template<> struct arma_op_rel_only< op_rel_lt_pre > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_lt_post > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_gt_pre > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_gt_post > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_lteq_pre > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_lteq_post > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_gteq_pre > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_gteq_post > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_eq > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_op_rel_only< op_rel_noteq > { typedef int result | |
| | | ; }; | |
| | | | |
| | | template<typename T> struct arma_not_op_rel { typedef int result; }; | |
| | | | |
| | | template<> struct arma_not_op_rel< op_rel_lt_pre > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_lt_post > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_gt_pre > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_gt_post > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_lteq_pre > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_lteq_post > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_gteq_pre > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_gteq_post > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_eq > { }; | |
| | | template<> struct arma_not_op_rel< op_rel_noteq > { }; | |
| | | | |
| | | template<typename T> struct arma_glue_rel_only { }; | |
| | | | |
| | | template<> struct arma_glue_rel_only< glue_rel_lt > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_glue_rel_only< glue_rel_gt > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_glue_rel_only< glue_rel_lteq > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_glue_rel_only< glue_rel_gteq > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_glue_rel_only< glue_rel_eq > { typedef int result | |
| | | ; }; | |
| | | template<> struct arma_glue_rel_only< glue_rel_noteq > { typedef int result | |
| | | ; }; | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 74 lines changed or added | |
|