| Col_meat.hpp | | Col_meat.hpp | |
| | | | |
| skipping to change at line 643 | | skipping to change at line 643 | |
| | | | |
| arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of
bounds"); | | arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of
bounds"); | |
| | | | |
| return Mat<eT>::memptr() + row_num + 1; | | return Mat<eT>::memptr() + row_num + 1; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
| void | | void | |
|
| Col<eT>::fixed<fixed_n_elem>::mem_setup() | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| access::rw(Mat<eT>::n_rows) = fixed_n_elem; | | | |
| access::rw(Mat<eT>::n_cols) = 1; | | | |
| access::rw(Mat<eT>::n_elem) = fixed_n_elem; | | | |
| access::rw(Mat<eT>::vec_state) = 1; | | | |
| access::rw(Mat<eT>::mem_state) = 3; | | | |
| access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>: | | | |
| :mem_local; | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| template<uword fixed_n_elem> | | | |
| arma_inline | | | |
| void | | | |
| Col<eT>::fixed<fixed_n_elem>::change_to_row() | | Col<eT>::fixed<fixed_n_elem>::change_to_row() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| access::rw(Mat<eT>::n_cols) = fixed_n_elem; | | access::rw(Mat<eT>::n_cols) = fixed_n_elem; | |
| access::rw(Mat<eT>::n_rows) = 1; | | access::rw(Mat<eT>::n_rows) = 1; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed() | | Col<eT>::fixed<fixed_n_elem>::fixed() | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
|
| | | | |
| mem_setup(); | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed(const fixed<fixed_n_elem>& X) | | Col<eT>::fixed<fixed_n_elem>::fixed(const fixed<fixed_n_elem>& X) | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | | eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | |
| | | | |
| arrayops::copy( dest, X.mem, fixed_n_elem ); | | arrayops::copy( dest, X.mem, fixed_n_elem ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X) | | Col<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X) | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Col<eT>::operator=(X); | | Col<eT>::operator=(X); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A) | | Col<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A) | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Col<eT>::operator=(A.get_ref()); | | Col<eT>::operator=(A.get_ref()); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed(const Base<pod_type,T1>& A, const Base<
pod_type,T2>& B) | | Col<eT>::fixed<fixed_n_elem>::fixed(const Base<pod_type,T1>& A, const Base<
pod_type,T2>& B) | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Col<eT>::init(A,B); | | Col<eT>::init(A,B); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed(const eT* aux_mem) | | Col<eT>::fixed<fixed_n_elem>::fixed(const eT* aux_mem) | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | |
| | | | |
|
| arrayops::copy( const_cast<eT*>(Mat<eT>::mem), aux_mem, fixed_n_elem ); | | arrayops::copy( dest, aux_mem, fixed_n_elem ); | |
| } | | } | |
| | | | |
| //! NOTE: this function relies on | | //! NOTE: this function relies on | |
| //! Col::operator=(text), to change vec_state as well as swapping n_rows an
d n_cols, | | //! Col::operator=(text), to change vec_state as well as swapping n_rows an
d n_cols, | |
| //! and Mat::init(), to check that the given vector will not have a differe
nt size than fixed_n_elem. | | //! and Mat::init(), to check that the given vector will not have a differe
nt size than fixed_n_elem. | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed(const char* text) | | Col<eT>::fixed<fixed_n_elem>::fixed(const char* text) | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| change_to_row(); | | change_to_row(); | |
| | | | |
| Col<eT>::operator=(text); | | Col<eT>::operator=(text); | |
| } | | } | |
| | | | |
| //! NOTE: this function relies on | | //! NOTE: this function relies on | |
| //! Col::operator=(text), to change vec_state as well as swapping n_rows an
d n_cols, | | //! Col::operator=(text), to change vec_state as well as swapping n_rows an
d n_cols, | |
| //! and Mat::init(), to check that the given vector will not have a differe
nt size than fixed_n_elem. | | //! and Mat::init(), to check that the given vector will not have a differe
nt size than fixed_n_elem. | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed(const std::string& text) | | Col<eT>::fixed<fixed_n_elem>::fixed(const std::string& text) | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| change_to_row(); | | change_to_row(); | |
| | | | |
| Col<eT>::operator=(text); | | Col<eT>::operator=(text); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| template<typename T1> | | template<typename T1> | |
| const Col<eT>& | | const Col<eT>& | |
| Col<eT>::fixed<fixed_n_elem>::operator=(const Base<eT,T1>& A) | | Col<eT>::fixed<fixed_n_elem>::operator=(const Base<eT,T1>& A) | |
| | | | |
| skipping to change at line 846 | | skipping to change at line 824 | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Col<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list) | | Col<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list) | |
|
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
|
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| mem_setup(); | | | |
| | | | |
| (*this).operator=(list); | | (*this).operator=(list); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| const Col<eT>& | | const Col<eT>& | |
| Col<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& li
st) | | Col<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& li
st) | |
| { | | { | |
| | | | |
| skipping to change at line 1053 | | skipping to change at line 1030 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat<eT>::mem_local[
0]); | | eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat<eT>::mem_local[
0]); | |
| | | | |
| arrayops::inplace_set_fixed<eT,fixed_n_elem>( mem_use, eT(1) ); | | arrayops::inplace_set_fixed<eT,fixed_n_elem>( mem_use, eT(1) ); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | inline | |
| | | Col<eT>::Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* | |
| | | in_mem) | |
| | | : Mat<eT>(arma_fixed_indicator(), in_n_elem, 1, 1, in_mem) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | } | |
| | | | |
| #ifdef ARMA_EXTRA_COL_MEAT | | #ifdef ARMA_EXTRA_COL_MEAT | |
| #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_MEAT) | | #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_MEAT) | |
| #endif | | #endif | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 21 change blocks. |
| 36 lines changed or deleted | | 21 lines changed or added | |
|
| Mat_meat.hpp | | Mat_meat.hpp | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| { | | { | |
| if(n_elem > arma_config::mat_prealloc) | | if(n_elem > arma_config::mat_prealloc) | |
| { | | { | |
| memory::release( access::rw(mem) ); | | memory::release( access::rw(mem) ); | |
| } | | } | |
| } | | } | |
| | | | |
| if(arma_config::debug == true) | | if(arma_config::debug == true) | |
| { | | { | |
| // try to expose buggy user code that accesses deleted objects | | // try to expose buggy user code that accesses deleted objects | |
|
| access::rw(n_rows) = 0; | | access::rw(mem) = 0; | |
| access::rw(n_cols) = 0; | | | |
| access::rw(n_elem) = 0; | | | |
| access::rw(mem) = 0; | | | |
| } | | } | |
| | | | |
| arma_type_check(( is_supported_elem_type<eT>::value == false )); | | arma_type_check(( is_supported_elem_type<eT>::value == false )); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| Mat<eT>::Mat() | | Mat<eT>::Mat() | |
| : n_rows(0) | | : n_rows(0) | |
| , n_cols(0) | | , n_cols(0) | |
| | | | |
| skipping to change at line 103 | | skipping to change at line 100 | |
| , mem_state(0) | | , mem_state(0) | |
| , mem() | | , mem() | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| init_cold(); | | init_cold(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
|
| | | Mat<eT>::Mat(const arma_fixed_indicator&, const uword in_n_rows, const uwor | |
| | | d in_n_cols, const uhword in_vec_state, const eT* in_mem) | |
| | | : n_rows (in_n_rows) | |
| | | , n_cols (in_n_cols) | |
| | | , n_elem (in_n_rows*in_n_cols) | |
| | | , vec_state (in_vec_state) | |
| | | , mem_state (3) | |
| | | , mem (in_mem) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| void | | void | |
| Mat<eT>::init_cold() | | Mat<eT>::init_cold() | |
| { | | { | |
| arma_extra_debug_sigprint( arma_boost::format("n_rows = %d, n_cols = %d")
% n_rows % n_cols ); | | arma_extra_debug_sigprint( arma_boost::format("n_rows = %d, n_cols = %d")
% n_rows % n_cols ); | |
| | | | |
| // ensure that n_elem can hold the result of (n_rows * n_cols) | | // ensure that n_elem can hold the result of (n_rows * n_cols) | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( | | ( | |
| | | | |
| skipping to change at line 182 | | skipping to change at line 192 | |
| in_n_rows = 1; | | in_n_rows = 1; | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| arma_debug_set_error | | arma_debug_set_error | |
| ( | | ( | |
| err_state, | | err_state, | |
| err_msg, | | err_msg, | |
| ( ((t_vec_state == 1) && (in_n_cols != 1)) || ((t_vec_state == 2) &
& (in_n_rows != 1)) ), | | ( ((t_vec_state == 1) && (in_n_cols != 1)) || ((t_vec_state == 2) &
& (in_n_rows != 1)) ), | |
|
| "Mat::init(): object is a vector; requested size is not compatible" | | "Mat::init(): object is a row or column vector; requested size is n
ot compatible" | |
| ); | | ); | |
| } | | } | |
| } | | } | |
| | | | |
| // ensure that n_elem can hold the result of (n_rows * n_cols) | | // ensure that n_elem can hold the result of (n_rows * n_cols) | |
| | | | |
| arma_debug_set_error | | arma_debug_set_error | |
| ( | | ( | |
| err_state, | | err_state, | |
| err_msg, | | err_msg, | |
| | | | |
| skipping to change at line 5088 | | skipping to change at line 5098 | |
| inline | | inline | |
| uword | | uword | |
| Mat<eT>::size() const | | Mat<eT>::size() const | |
| { | | { | |
| return n_elem; | | return n_elem; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| arma_inline | | arma_inline | |
|
| void | | | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::mem_setup() | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| access::rw(Mat<eT>::n_rows) = fixed_n_rows; | | | |
| access::rw(Mat<eT>::n_cols) = fixed_n_cols; | | | |
| access::rw(Mat<eT>::n_elem) = fixed_n_elem; | | | |
| access::rw(Mat<eT>::vec_state) = 0; | | | |
| access::rw(Mat<eT>::mem_state) = 3; | | | |
| access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : mem_loca | | | |
| l; | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | | |
| arma_inline | | | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed() | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed() | |
|
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_e
xtra) ? mem_local_extra : mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
|
| | | | |
| mem_setup(); | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| arma_inline | | arma_inline | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const fixed<fixed_n_rows,
fixed_n_cols>& X) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const fixed<fixed_n_rows,
fixed_n_cols>& X) | |
|
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_e
xtra) ? mem_local_extra : mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| eT* dest = (use_extra) ? mem_local_extra : mem_local; | | eT* dest = (use_extra) ? mem_local_extra : mem_local; | |
| | | | |
| arrayops::copy( dest, X.mem, fixed_n_elem ); | | arrayops::copy( dest, X.mem, fixed_n_elem ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const Base<eT,T1>& A) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const Base<eT,T1>& A) | |
|
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_e
xtra) ? mem_local_extra : mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Mat<eT>::operator=(A.get_ref()); | | Mat<eT>::operator=(A.get_ref()); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const Base<pod_type,T1>&
A, const Base<pod_type,T2>& B) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const Base<pod_type,T1>&
A, const Base<pod_type,T2>& B) | |
|
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_e
xtra) ? mem_local_extra : mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Mat<eT>::init(A,B); | | Mat<eT>::init(A,B); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| inline | | inline | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const eT* aux_mem) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const eT* aux_mem) | |
|
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_e
xtra) ? mem_local_extra : mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | eT* dest = (use_extra) ? mem_local_extra : mem_local; | |
| | | | |
|
| arrayops::copy( const_cast<eT*>(Mat<eT>::mem), aux_mem, fixed_n_elem ); | | arrayops::copy( dest, aux_mem, fixed_n_elem ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| inline | | inline | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const char* text) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const char* text) | |
|
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_e
xtra) ? mem_local_extra : mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Mat<eT>::operator=(text); | | Mat<eT>::operator=(text); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| inline | | inline | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const std::string& text) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const std::string& text) | |
|
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_e
xtra) ? mem_local_extra : mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Mat<eT>::operator=(text); | | Mat<eT>::operator=(text); | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| inline | | inline | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const std::initializer_li
st<eT>& list) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const std::initializer_li
st<eT>& list) | |
|
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use_e
xtra) ? mem_local_extra : mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| (*this).operator=(list); | | (*this).operator=(list); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| inline | | inline | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const std::initialize
r_list<eT>& list) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const std::initialize
r_list<eT>& list) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
End of changes. 21 change blocks. |
| 38 lines changed or deleted | | 26 lines changed or added | |
|
| Proxy.hpp | | Proxy.hpp | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 39 | |
| struct Proxy_fixed | | struct Proxy_fixed | |
| { | | { | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef T1 stored_type; | | typedef T1 stored_type; | |
| typedef const elem_type* ea_type; | | typedef const elem_type* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = true; | | static const bool is_fixed = true; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = T1::is_row; | | static const bool is_row = T1::is_row; | |
| static const bool is_col = T1::is_col; | | static const bool is_col = T1::is_col; | |
| | | | |
| arma_aligned const T1& Q; | | arma_aligned const T1& Q; | |
| | | | |
| inline explicit Proxy_fixed(const T1& A) | | inline explicit Proxy_fixed(const T1& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 96 | | skipping to change at line 97 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<eT> stored_type; | | typedef Mat<eT> stored_type; | |
| typedef const eT* ea_type; | | typedef const eT* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| | | | |
| arma_aligned const Mat<eT>& Q; | | arma_aligned const Mat<eT>& Q; | |
| | | | |
| inline explicit Proxy(const Mat<eT>& A) | | inline explicit Proxy(const Mat<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 136 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Col<eT> stored_type; | | typedef Col<eT> stored_type; | |
| typedef const eT* ea_type; | | typedef const eT* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = true; | | static const bool is_col = true; | |
| | | | |
| arma_aligned const Col<eT>& Q; | | arma_aligned const Col<eT>& Q; | |
| | | | |
| inline explicit Proxy(const Col<eT>& A) | | inline explicit Proxy(const Col<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 172 | | skipping to change at line 175 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Row<eT> stored_type; | | typedef Row<eT> stored_type; | |
| typedef const eT* ea_type; | | typedef const eT* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = true; | | static const bool is_row = true; | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| | | | |
| arma_aligned const Row<eT>& Q; | | arma_aligned const Row<eT>& Q; | |
| | | | |
| inline explicit Proxy(const Row<eT>& A) | | inline explicit Proxy(const Row<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 210 | | skipping to change at line 214 | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Gen<T1, gen_type> stored_type; | | typedef Gen<T1, gen_type> stored_type; | |
| typedef const Gen<T1, gen_type>& ea_type; | | typedef const Gen<T1, gen_type>& ea_type; | |
| | | | |
| static const bool prefer_at_accessor = Gen<T1, gen_type>::prefer_at_acces
sor; | | static const bool prefer_at_accessor = Gen<T1, gen_type>::prefer_at_acces
sor; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = Gen<T1, gen_type>::is_row; | | static const bool is_row = Gen<T1, gen_type>::is_row; | |
| static const bool is_col = Gen<T1, gen_type>::is_col; | | static const bool is_col = Gen<T1, gen_type>::is_col; | |
| | | | |
| arma_aligned const Gen<T1, gen_type>& Q; | | arma_aligned const Gen<T1, gen_type>& Q; | |
| | | | |
| inline explicit Proxy(const Gen<T1, gen_type>& A) | | inline explicit Proxy(const Gen<T1, gen_type>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 248 | | skipping to change at line 253 | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<elem_type> stored_type; | | typedef Mat<elem_type> stored_type; | |
| typedef const elem_type* ea_type; | | typedef const elem_type* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = Op<T1, op_type>::is_row; | | static const bool is_row = Op<T1, op_type>::is_row; | |
| static const bool is_col = Op<T1, op_type>::is_col; | | static const bool is_col = Op<T1, op_type>::is_col; | |
| | | | |
| arma_aligned const Mat<elem_type> Q; | | arma_aligned const Mat<elem_type> Q; | |
| | | | |
| inline explicit Proxy(const Op<T1, op_type>& A) | | inline explicit Proxy(const Op<T1, op_type>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 281 | | skipping to change at line 287 | |
| }; | | }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct Proxy_xtrans_default | | struct Proxy_xtrans_default | |
| { | | { | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| arma_aligned const Mat<eT> Q; | | arma_aligned const Mat<eT> Q; | |
| | | | |
| arma_hot | | arma_hot | |
| inline Proxy_xtrans_default(const T1& A) | | inline Proxy_xtrans_default(const T1& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 309 | | skipping to change at line 316 | |
| }; | | }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct Proxy_xtrans_vector< Op<T1, op_htrans> > | | struct Proxy_xtrans_vector< Op<T1, op_htrans> > | |
| { | | { | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = quasi_unwrap<T1>::has_subview; | | static const bool has_subview = quasi_unwrap<T1>::has_subview; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = true; | |
| | | | |
| arma_aligned const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col
or subview_col | | arma_aligned const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col
or subview_col | |
| arma_aligned const Mat<eT> Q; | | arma_aligned const Mat<eT> Q; | |
| | | | |
| inline Proxy_xtrans_vector(const Op<T1, op_htrans>& A) | | inline Proxy_xtrans_vector(const Op<T1, op_htrans>& A) | |
| : U(A.m) | | : U(A.m) | |
| , Q(const_cast<eT*>(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false
) | | , Q(const_cast<eT*>(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false
) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| skipping to change at line 332 | | skipping to change at line 340 | |
| }; | | }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct Proxy_xtrans_vector< Op<T1, op_strans> > | | struct Proxy_xtrans_vector< Op<T1, op_strans> > | |
| { | | { | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = quasi_unwrap<T1>::has_subview; | | static const bool has_subview = quasi_unwrap<T1>::has_subview; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = true; | |
| | | | |
| arma_aligned const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col
or subview_col | | arma_aligned const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col
or subview_col | |
| arma_aligned const Mat<eT> Q; | | arma_aligned const Mat<eT> Q; | |
| | | | |
| inline Proxy_xtrans_vector(const Op<T1, op_strans>& A) | | inline Proxy_xtrans_vector(const Op<T1, op_strans>& A) | |
| : U(A.m) | | : U(A.m) | |
| , Q(const_cast<eT*>(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false
) | | , Q(const_cast<eT*>(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false
) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| skipping to change at line 384 | | skipping to change at line 393 | |
| Proxy_xtrans; | | Proxy_xtrans; | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<elem_type> stored_type; | | typedef Mat<elem_type> stored_type; | |
| typedef const elem_type* ea_type; | | typedef const elem_type* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = Proxy_xtrans::prefer_at_accessor; | | static const bool prefer_at_accessor = Proxy_xtrans::prefer_at_accessor; | |
| static const bool has_subview = Proxy_xtrans::has_subview; | | static const bool has_subview = Proxy_xtrans::has_subview; | |
| static const bool is_fixed = Proxy_xtrans::is_fixed; | | static const bool is_fixed = Proxy_xtrans::is_fixed; | |
|
| | | static const bool fake_mat = Proxy_xtrans::fake_mat; | |
| | | | |
| // NOTE: the Op class takes care of swapping row and col for op_htrans | | // NOTE: the Op class takes care of swapping row and col for op_htrans | |
| static const bool is_row = Op<T1, op_htrans>::is_row; | | static const bool is_row = Op<T1, op_htrans>::is_row; | |
| static const bool is_col = Op<T1, op_htrans>::is_col; | | static const bool is_col = Op<T1, op_htrans>::is_col; | |
| | | | |
| using Proxy_xtrans::Q; | | using Proxy_xtrans::Q; | |
| | | | |
| inline explicit Proxy(const Op<T1, op_htrans>& A) | | inline explicit Proxy(const Op<T1, op_htrans>& A) | |
| : Proxy_xtrans(A) | | : Proxy_xtrans(A) | |
| { | | { | |
| | | | |
| skipping to change at line 438 | | skipping to change at line 448 | |
| Proxy_xtrans; | | Proxy_xtrans; | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<elem_type> stored_type; | | typedef Mat<elem_type> stored_type; | |
| typedef const elem_type* ea_type; | | typedef const elem_type* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = Proxy_xtrans::prefer_at_accessor; | | static const bool prefer_at_accessor = Proxy_xtrans::prefer_at_accessor; | |
| static const bool has_subview = Proxy_xtrans::has_subview; | | static const bool has_subview = Proxy_xtrans::has_subview; | |
| static const bool is_fixed = Proxy_xtrans::is_fixed; | | static const bool is_fixed = Proxy_xtrans::is_fixed; | |
|
| | | static const bool fake_mat = Proxy_xtrans::fake_mat; | |
| | | | |
| // NOTE: the Op class takes care of swapping row and col for op_strans | | // NOTE: the Op class takes care of swapping row and col for op_strans | |
| static const bool is_row = Op<T1, op_strans>::is_row; | | static const bool is_row = Op<T1, op_strans>::is_row; | |
| static const bool is_col = Op<T1, op_strans>::is_col; | | static const bool is_col = Op<T1, op_strans>::is_col; | |
| | | | |
| using Proxy_xtrans::Q; | | using Proxy_xtrans::Q; | |
| | | | |
| inline explicit Proxy(const Op<T1, op_strans>& A) | | inline explicit Proxy(const Op<T1, op_strans>& A) | |
| : Proxy_xtrans(A) | | : Proxy_xtrans(A) | |
| { | | { | |
| | | | |
| skipping to change at line 477 | | skipping to change at line 488 | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<elem_type> stored_type; | | typedef Mat<elem_type> stored_type; | |
| typedef const elem_type* ea_type; | | typedef const elem_type* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = Glue<T1, T2, glue_type>::is_row; | | static const bool is_row = Glue<T1, T2, glue_type>::is_row; | |
| static const bool is_col = Glue<T1, T2, glue_type>::is_col; | | static const bool is_col = Glue<T1, T2, glue_type>::is_col; | |
| | | | |
| arma_aligned const Mat<elem_type> Q; | | arma_aligned const Mat<elem_type> Q; | |
| | | | |
| inline explicit Proxy(const Glue<T1, T2, glue_type>& A) | | inline explicit Proxy(const Glue<T1, T2, glue_type>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 515 | | skipping to change at line 527 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef subview<eT> stored_type; | | typedef subview<eT> stored_type; | |
| typedef const subview<eT>& ea_type; | | typedef const subview<eT>& ea_type; | |
| | | | |
| static const bool prefer_at_accessor = true; | | static const bool prefer_at_accessor = true; | |
| static const bool has_subview = true; | | static const bool has_subview = true; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| | | | |
| arma_aligned const subview<eT>& Q; | | arma_aligned const subview<eT>& Q; | |
| | | | |
| inline explicit Proxy(const subview<eT>& A) | | inline explicit Proxy(const subview<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 553 | | skipping to change at line 566 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef subview_col<eT> stored_type; | | typedef subview_col<eT> stored_type; | |
| typedef const eT* ea_type; | | typedef const eT* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = true; | | static const bool has_subview = true; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = true; | | static const bool is_col = true; | |
| | | | |
| arma_aligned const subview_col<eT>& Q; | | arma_aligned const subview_col<eT>& Q; | |
| | | | |
| inline explicit Proxy(const subview_col<eT>& A) | | inline explicit Proxy(const subview_col<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 591 | | skipping to change at line 605 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef subview_row<eT> stored_type; | | typedef subview_row<eT> stored_type; | |
| typedef const subview_row<eT>& ea_type; | | typedef const subview_row<eT>& ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = true; | | static const bool has_subview = true; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = true; | | static const bool is_row = true; | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| | | | |
| arma_aligned const subview_row<eT>& Q; | | arma_aligned const subview_row<eT>& Q; | |
| | | | |
| inline explicit Proxy(const subview_row<eT>& A) | | inline explicit Proxy(const subview_row<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 629 | | skipping to change at line 644 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<eT> stored_type; | | typedef Mat<eT> stored_type; | |
| typedef const eT* ea_type; | | typedef const eT* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = true; | | static const bool is_col = true; | |
| | | | |
| arma_aligned const Mat<eT> Q; | | arma_aligned const Mat<eT> Q; | |
| | | | |
| inline explicit Proxy(const subview_elem1<eT,T1>& A) | | inline explicit Proxy(const subview_elem1<eT,T1>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 667 | | skipping to change at line 683 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<eT> stored_type; | | typedef Mat<eT> stored_type; | |
| typedef const eT* ea_type; | | typedef const eT* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| | | | |
| arma_aligned const Mat<eT> Q; | | arma_aligned const Mat<eT> Q; | |
| | | | |
| inline explicit Proxy(const subview_elem2<eT,T1,T2>& A) | | inline explicit Proxy(const subview_elem2<eT,T1,T2>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 705 | | skipping to change at line 722 | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef diagview<eT> stored_type; | | typedef diagview<eT> stored_type; | |
| typedef const diagview<eT>& ea_type; | | typedef const diagview<eT>& ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = true; | | static const bool has_subview = true; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = true; | | static const bool is_col = true; | |
| | | | |
| arma_aligned const diagview<eT>& Q; | | arma_aligned const diagview<eT>& Q; | |
| | | | |
| inline explicit Proxy(const diagview<eT>& A) | | inline explicit Proxy(const diagview<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 743 | | skipping to change at line 761 | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef eOp<T1, eop_type> stored_type; | | typedef eOp<T1, eop_type> stored_type; | |
| typedef const eOp<T1, eop_type>& ea_type; | | typedef const eOp<T1, eop_type>& ea_type; | |
| | | | |
| static const bool prefer_at_accessor = eOp<T1, eop_type>::prefer_at_acces
sor; | | static const bool prefer_at_accessor = eOp<T1, eop_type>::prefer_at_acces
sor; | |
| static const bool has_subview = eOp<T1, eop_type>::has_subview; | | static const bool has_subview = eOp<T1, eop_type>::has_subview; | |
| static const bool is_fixed = eOp<T1, eop_type>::is_fixed; | | static const bool is_fixed = eOp<T1, eop_type>::is_fixed; | |
|
| | | static const bool fake_mat = eOp<T1, eop_type>::fake_mat; | |
| | | | |
| static const bool is_row = eOp<T1, eop_type>::is_row; | | static const bool is_row = eOp<T1, eop_type>::is_row; | |
| static const bool is_col = eOp<T1, eop_type>::is_col; | | static const bool is_col = eOp<T1, eop_type>::is_col; | |
| | | | |
| arma_aligned const eOp<T1, eop_type>& Q; | | arma_aligned const eOp<T1, eop_type>& Q; | |
| | | | |
| inline explicit Proxy(const eOp<T1, eop_type>& A) | | inline explicit Proxy(const eOp<T1, eop_type>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 781 | | skipping to change at line 800 | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef eGlue<T1, T2, eglue_type> stored_type; | | typedef eGlue<T1, T2, eglue_type> stored_type; | |
| typedef const eGlue<T1, T2, eglue_type>& ea_type; | | typedef const eGlue<T1, T2, eglue_type>& ea_type; | |
| | | | |
| static const bool prefer_at_accessor = eGlue<T1, T2, eglue_type>::prefer_
at_accessor; | | static const bool prefer_at_accessor = eGlue<T1, T2, eglue_type>::prefer_
at_accessor; | |
| static const bool has_subview = eGlue<T1, T2, eglue_type>::has_sub
view; | | static const bool has_subview = eGlue<T1, T2, eglue_type>::has_sub
view; | |
| static const bool is_fixed = eGlue<T1, T2, eglue_type>::is_fixe
d; | | static const bool is_fixed = eGlue<T1, T2, eglue_type>::is_fixe
d; | |
|
| | | static const bool fake_mat = eGlue<T1, T2, eglue_type>::fake_ma
t; | |
| | | | |
| static const bool is_row = eGlue<T1, T2, eglue_type>::is_row; | | static const bool is_row = eGlue<T1, T2, eglue_type>::is_row; | |
| static const bool is_col = eGlue<T1, T2, eglue_type>::is_col; | | static const bool is_col = eGlue<T1, T2, eglue_type>::is_col; | |
| | | | |
| arma_aligned const eGlue<T1, T2, eglue_type>& Q; | | arma_aligned const eGlue<T1, T2, eglue_type>& Q; | |
| | | | |
| inline explicit Proxy(const eGlue<T1, T2, eglue_type>& A) | | inline explicit Proxy(const eGlue<T1, T2, eglue_type>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 819 | | skipping to change at line 839 | |
| public: | | public: | |
| | | | |
| typedef out_eT elem_type; | | typedef out_eT elem_type; | |
| typedef typename get_pod_type<out_eT>::result pod_type; | | typedef typename get_pod_type<out_eT>::result pod_type; | |
| typedef Mat<out_eT> stored_type; | | typedef Mat<out_eT> stored_type; | |
| typedef const elem_type* ea_type; | | typedef const elem_type* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = mtOp<out_eT, T1, op_type>::is_row; | | static const bool is_row = mtOp<out_eT, T1, op_type>::is_row; | |
| static const bool is_col = mtOp<out_eT, T1, op_type>::is_col; | | static const bool is_col = mtOp<out_eT, T1, op_type>::is_col; | |
| | | | |
| arma_aligned const Mat<out_eT> Q; | | arma_aligned const Mat<out_eT> Q; | |
| | | | |
| inline explicit Proxy(const mtOp<out_eT, T1, op_type>& A) | | inline explicit Proxy(const mtOp<out_eT, T1, op_type>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 857 | | skipping to change at line 878 | |
| public: | | public: | |
| | | | |
| typedef out_eT elem_type; | | typedef out_eT elem_type; | |
| typedef typename get_pod_type<out_eT>::result pod_type; | | typedef typename get_pod_type<out_eT>::result pod_type; | |
| typedef Mat<out_eT> stored_type; | | typedef Mat<out_eT> stored_type; | |
| typedef const elem_type* ea_type; | | typedef const elem_type* ea_type; | |
| | | | |
| static const bool prefer_at_accessor = false; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = false; | | static const bool has_subview = false; | |
| static const bool is_fixed = false; | | static const bool is_fixed = false; | |
|
| | | static const bool fake_mat = false; | |
| | | | |
| static const bool is_row = mtGlue<out_eT, T1, T2, glue_type>::is_row; | | static const bool is_row = mtGlue<out_eT, T1, T2, glue_type>::is_row; | |
| static const bool is_col = mtGlue<out_eT, T1, T2, glue_type>::is_col; | | static const bool is_col = mtGlue<out_eT, T1, T2, glue_type>::is_col; | |
| | | | |
| arma_aligned const Mat<out_eT> Q; | | arma_aligned const Mat<out_eT> Q; | |
| | | | |
| inline explicit Proxy(const mtGlue<out_eT, T1, T2, glue_type>& A) | | inline explicit Proxy(const mtGlue<out_eT, T1, T2, glue_type>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
End of changes. 22 change blocks. |
| 0 lines changed or deleted | | 22 lines changed or added | |
|
| Row_meat.hpp | | Row_meat.hpp | |
| | | | |
| skipping to change at line 607 | | skipping to change at line 607 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of
bounds"); | | arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of
bounds"); | |
| | | | |
| return Mat<eT>::memptr() + Mat<eT>::n_cols; | | return Mat<eT>::memptr() + Mat<eT>::n_cols; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
|
| arma_inline | | | |
| void | | | |
| Row<eT>::fixed<fixed_n_elem>::mem_setup() | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| access::rw(Mat<eT>::n_rows) = 1; | | | |
| access::rw(Mat<eT>::n_cols) = fixed_n_elem; | | | |
| access::rw(Mat<eT>::n_elem) = fixed_n_elem; | | | |
| access::rw(Mat<eT>::vec_state) = 2; | | | |
| access::rw(Mat<eT>::mem_state) = 3; | | | |
| access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>: | | | |
| :mem_local; | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| template<uword fixed_n_elem> | | | |
| inline | | inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed() | | Row<eT>::fixed<fixed_n_elem>::fixed() | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
|
| | | | |
| mem_setup(); | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed(const fixed<fixed_n_elem>& X) | | Row<eT>::fixed<fixed_n_elem>::fixed(const fixed<fixed_n_elem>& X) | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | | eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | |
| | | | |
| arrayops::copy( dest, X.mem, fixed_n_elem ); | | arrayops::copy( dest, X.mem, fixed_n_elem ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X) | | Row<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X) | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Row<eT>::operator=(X); | | Row<eT>::operator=(X); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A) | | Row<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A) | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Row<eT>::operator=(A.get_ref()); | | Row<eT>::operator=(A.get_ref()); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed(const Base<pod_type,T1>& A, const Base<
pod_type,T2>& B) | | Row<eT>::fixed<fixed_n_elem>::fixed(const Base<pod_type,T1>& A, const Base<
pod_type,T2>& B) | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Row<eT>::init(A,B); | | Row<eT>::init(A,B); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed(const eT* aux_mem) | | Row<eT>::fixed<fixed_n_elem>::fixed(const eT* aux_mem) | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | |
| | | | |
|
| arrayops::copy( const_cast<eT*>(Mat<eT>::mem), aux_mem, fixed_n_elem ); | | arrayops::copy( dest, aux_mem, fixed_n_elem ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed(const char* text) | | Row<eT>::fixed<fixed_n_elem>::fixed(const char* text) | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Row<eT>::operator=(text); | | Row<eT>::operator=(text); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed(const std::string& text) | | Row<eT>::fixed<fixed_n_elem>::fixed(const std::string& text) | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
|
| mem_setup(); | | | |
| | | | |
| Row<eT>::operator=(text); | | Row<eT>::operator=(text); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| template<typename T1> | | template<typename T1> | |
| const Row<eT>& | | const Row<eT>& | |
| Row<eT>::fixed<fixed_n_elem>::operator=(const Base<eT,T1>& A) | | Row<eT>::fixed<fixed_n_elem>::operator=(const Base<eT,T1>& A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 786 | | skipping to change at line 764 | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| Row<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list) | | Row<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list) | |
|
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local
_extra : Mat<eT>::mem_local) ) | |
| { | | { | |
|
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| mem_setup(); | | | |
| | | | |
| (*this).operator=(list); | | (*this).operator=(list); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| inline | | inline | |
| const Row<eT>& | | const Row<eT>& | |
| Row<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& li
st) | | Row<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& li
st) | |
| { | | { | |
| | | | |
| skipping to change at line 993 | | skipping to change at line 970 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat<eT>::mem_local[
0]); | | eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat<eT>::mem_local[
0]); | |
| | | | |
| arrayops::inplace_set_fixed<eT,fixed_n_elem>( mem_use, eT(1) ); | | arrayops::inplace_set_fixed<eT,fixed_n_elem>( mem_use, eT(1) ); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | inline | |
| | | Row<eT>::Row(const arma_fixed_indicator&, const uword in_n_elem, const eT* | |
| | | in_mem) | |
| | | : Mat<eT>(arma_fixed_indicator(), 1, in_n_elem, 2, in_mem) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | } | |
| | | | |
| #ifdef ARMA_EXTRA_ROW_MEAT | | #ifdef ARMA_EXTRA_ROW_MEAT | |
| #include ARMA_INCFILE_WRAP(ARMA_EXTRA_ROW_MEAT) | | #include ARMA_INCFILE_WRAP(ARMA_EXTRA_ROW_MEAT) | |
| #endif | | #endif | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 21 change blocks. |
| 36 lines changed or deleted | | 21 lines changed or added | |
|
| op_htrans_meat.hpp | | op_htrans_meat.hpp | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| op_htrans::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const typename arm
a_cx_only<eT>::result* junk) | | op_htrans::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const typename arm
a_cx_only<eT>::result* junk) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| const uword A_n_cols = A.n_cols; | | const uword A_n_cols = A.n_cols; | |
| | | | |
| out.set_size(A_n_cols, A_n_rows); | | out.set_size(A_n_cols, A_n_rows); | |
| | | | |
|
| for(uword in_row = 0; in_row < A_n_rows; ++in_row) | | if( (A_n_cols == 1) || (A_n_rows == 1) ) | |
| { | | { | |
|
| const uword out_col = in_row; | | const uword n_elem = A.n_elem; | |
| | | | |
|
| for(uword in_col = 0; in_col < A_n_cols; ++in_col) | | const eT* A_mem = A.memptr(); | |
| | | eT* out_mem = out.memptr(); | |
| | | | |
| | | for(uword i=0; i < n_elem; ++i) | |
| { | | { | |
|
| const uword out_row = in_col; | | out_mem[i] = std::conj(A_mem[i]); | |
| out.at(out_row, out_col) = std::conj( A.at(in_row, in_col) ); | | | |
| } | | } | |
| } | | } | |
|
| | | else | |
| | | { | |
| | | for(uword in_row = 0; in_row < A_n_rows; ++in_row) | |
| | | { | |
| | | const uword out_col = in_row; | |
| | | | |
|
| | | for(uword in_col = 0; in_col < A_n_cols; ++in_col) | |
| | | { | |
| | | const uword out_row = in_col; | |
| | | out.at(out_row, out_col) = std::conj( A.at(in_row, in_col) ); | |
| | | } | |
| | | } | |
| | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_hot | | arma_hot | |
| arma_inline | | arma_inline | |
| void | | void | |
| op_htrans::apply(Mat<eT>& out, const Mat<eT>& A, const typename arma_not_cx
<eT>::result* junk) | | op_htrans::apply(Mat<eT>& out, const Mat<eT>& A, const typename arma_not_cx
<eT>::result* junk) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
| skipping to change at line 82 | | skipping to change at line 96 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
| if(&out != &A) | | if(&out != &A) | |
| { | | { | |
| op_htrans::apply_noalias(out, A); | | op_htrans::apply_noalias(out, A); | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| if(out.n_rows == out.n_cols) | | const uword n_rows = out.n_rows; | |
| | | const uword n_cols = out.n_cols; | |
| | | | |
| | | if(n_rows == n_cols) | |
| { | | { | |
| arma_extra_debug_print("doing in-place hermitian transpose of a squar
e matrix"); | | arma_extra_debug_print("doing in-place hermitian transpose of a squar
e matrix"); | |
| | | | |
|
| const uword n_rows = out.n_rows; | | for(uword col=0; col < n_cols; ++col) | |
| const uword n_cols = out.n_cols; | | | |
| | | | |
| for(uword col=0; col<n_cols; ++col) | | | |
| { | | { | |
| eT* coldata = out.colptr(col); | | eT* coldata = out.colptr(col); | |
| | | | |
| out.at(col,col) = std::conj( out.at(col,col) ); | | out.at(col,col) = std::conj( out.at(col,col) ); | |
| | | | |
|
| for(uword row=(col+1); row<n_rows; ++row) | | for(uword row=(col+1); row < n_rows; ++row) | |
| { | | { | |
| const eT val1 = std::conj(coldata[row]); | | const eT val1 = std::conj(coldata[row]); | |
| const eT val2 = std::conj(out.at(col,row)); | | const eT val2 = std::conj(out.at(col,row)); | |
| | | | |
| out.at(col,row) = val1; | | out.at(col,row) = val1; | |
| coldata[row] = val2; | | coldata[row] = val2; | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| | | | |
| skipping to change at line 120 | | skipping to change at line 134 | |
| out.steal_mem(tmp); | | out.steal_mem(tmp); | |
| } | | } | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_htrans::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_htrans>&
in) | | op_htrans::apply_proxy(Mat<typename T1::elem_type>& out, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
|
| const unwrap<T1> tmp(in.m); | | const Proxy<T1> P(X); | |
| const Mat<eT>& A = tmp.M; | | | |
| | | // allow detection of in-place transpose | |
| | | if( (is_Mat<typename Proxy<T1>::stored_type>::value == true) && (Proxy<T1 | |
| | | >::fake_mat == false) ) | |
| | | { | |
| | | const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q); | |
| | | | |
| | | op_htrans::apply(out, tmp.M); | |
| | | } | |
| | | else | |
| | | { | |
| | | const uword n_rows = P.get_n_rows(); | |
| | | const uword n_cols = P.get_n_cols(); | |
| | | | |
| | | const bool is_alias = P.is_alias(out); | |
| | | | |
| | | if( (resolves_to_vector<T1>::value == true) && (Proxy<T1>::prefer_at_ac | |
| | | cessor == false) ) | |
| | | { | |
| | | if(is_alias == false) | |
| | | { | |
| | | out.set_size(n_cols, n_rows); | |
| | | | |
| | | eT* out_mem = out.memptr(); | |
| | | | |
| | | const uword n_elem = P.get_n_elem(); | |
| | | | |
| | | typename Proxy<T1>::ea_type Pea = P.get_ea(); | |
| | | | |
| | | for(uword i=0; i < n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = std::conj(Pea[i]); | |
| | | } | |
| | | } | |
| | | else // aliasing | |
| | | { | |
| | | Mat<eT> out2(n_cols, n_rows); | |
| | | | |
| | | eT* out_mem = out2.memptr(); | |
| | | | |
| | | const uword n_elem = P.get_n_elem(); | |
| | | | |
| | | typename Proxy<T1>::ea_type Pea = P.get_ea(); | |
| | | | |
| | | for(uword i=0; i < n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = std::conj(Pea[i]); | |
| | | } | |
| | | | |
| | | out.steal_mem(out2); | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | if(is_alias == false) | |
| | | { | |
| | | out.set_size(n_cols, n_rows); | |
| | | | |
| | | for(uword k=0; k < n_cols; ++k) | |
| | | for(uword i=0; i < n_rows; ++i) | |
| | | { | |
| | | out.at(k,i) = std::conj(P.at(i,k)); | |
| | | } | |
| | | } | |
| | | else // aliasing | |
| | | { | |
| | | Mat<eT> out2(n_cols, n_rows); | |
| | | | |
|
| op_htrans::apply(out, A); | | for(uword k=0; k < n_cols; ++k) | |
| | | for(uword i=0; i < n_rows; ++i) | |
| | | { | |
| | | out2.at(k,i) = std::conj(P.at(i,k)); | |
| | | } | |
| | | | |
| | | out.steal_mem(out2); | |
| | | } | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | template<typename T1> | |
| | | arma_hot | |
| | | inline | |
| | | void | |
| | | op_htrans::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_htrans>& | |
| | | in, const typename arma_not_cx<typename T1::elem_type>::result* junk) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | arma_ignore(junk); | |
| | | | |
| | | op_strans::apply_proxy(out, in.m); | |
| | | } | |
| | | | |
| | | template<typename T1> | |
| | | arma_hot | |
| | | inline | |
| | | void | |
| | | op_htrans::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_htrans>& | |
| | | in, const typename arma_cx_only<typename T1::elem_type>::result* junk) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | arma_ignore(junk); | |
| | | | |
| | | op_htrans::apply_proxy(out, in.m); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
| op_htrans::apply(Mat<typename T1::elem_type>& out, const Op< Op<T1, op_trim
at>, op_htrans>& in) | | op_htrans::apply(Mat<typename T1::elem_type>& out, const Op< Op<T1, op_trim
at>, op_htrans>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | | |
| skipping to change at line 157 | | skipping to change at line 268 | |
| op_trimat::apply_htrans(out, A, upper); | | op_trimat::apply_htrans(out, A, upper); | |
| } | | } | |
| | | | |
| // | | // | |
| // op_htrans2 | | // op_htrans2 | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_hot | | arma_hot | |
| arma_inline | | arma_inline | |
| void | | void | |
|
| op_htrans2::apply(Mat<eT>& out, const Mat<eT>& A, const eT val, const typen
ame arma_not_cx<eT>::result* junk) | | op_htrans2::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| arma_ignore(junk); | | | |
| | | | |
|
| op_strans2::apply(out, A, val); | | const uword A_n_rows = A.n_rows; | |
| | | const uword A_n_cols = A.n_cols; | |
| | | | |
| | | out.set_size(A_n_cols, A_n_rows); | |
| | | | |
| | | if( (A_n_cols == 1) || (A_n_rows == 1) ) | |
| | | { | |
| | | const uword n_elem = A.n_elem; | |
| | | | |
| | | const eT* A_mem = A.memptr(); | |
| | | eT* out_mem = out.memptr(); | |
| | | | |
| | | for(uword i=0; i < n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = val * std::conj(A_mem[i]); | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(uword in_row = 0; in_row < A_n_rows; ++in_row) | |
| | | { | |
| | | const uword out_col = in_row; | |
| | | | |
| | | for(uword in_col = 0; in_col < A_n_cols; ++in_col) | |
| | | { | |
| | | const uword out_row = in_col; | |
| | | out.at(out_row, out_col) = val * std::conj( A.at(in_row, in_col) ); | |
| | | } | |
| | | } | |
| | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_htrans2::apply(Mat<eT>& out, const Mat<eT>& A, const eT val, const typen
ame arma_cx_only<eT>::result* junk) | | op_htrans2::apply(Mat<eT>& out, const Mat<eT>& A, const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| arma_ignore(junk); | | | |
| | | | |
|
| // TODO: replace with specialised implementation | | if(&out != &A) | |
| | | { | |
| | | op_htrans2::apply_noalias(out, A, val); | |
| | | } | |
| | | else | |
| | | { | |
| | | const uword n_rows = out.n_rows; | |
| | | const uword n_cols = out.n_cols; | |
| | | | |
| | | if(n_rows == n_cols) | |
| | | { | |
| | | arma_extra_debug_print("doing in-place hermitian transpose of a squar | |
| | | e matrix"); | |
| | | | |
| | | // TODO: do multiplication while swapping | |
| | | | |
| | | for(uword col=0; col < n_cols; ++col) | |
| | | { | |
| | | eT* coldata = out.colptr(col); | |
| | | | |
| | | out.at(col,col) = std::conj( out.at(col,col) ); | |
| | | | |
| | | for(uword row=(col+1); row < n_rows; ++row) | |
| | | { | |
| | | const eT val1 = std::conj(coldata[row]); | |
| | | const eT val2 = std::conj(out.at(col,row)); | |
| | | | |
| | | out.at(col,row) = val1; | |
| | | coldata[row] = val2; | |
| | | } | |
| | | } | |
| | | | |
|
| op_htrans::apply(out, A); | | arrayops::inplace_mul( out.memptr(), val, out.n_elem ); | |
| | | } | |
| | | else | |
| | | { | |
| | | Mat<eT> tmp; | |
| | | op_htrans2::apply_noalias(tmp, A, val); | |
| | | | |
|
| arrayops::inplace_mul( out.memptr(), val, out.n_elem ); | | out.steal_mem(tmp); | |
| | | } | |
| | | } | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_htrans2::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_htrans2>
& in) | | op_htrans2::apply_proxy(Mat<typename T1::elem_type>& out, const T1& X, cons
t typename T1::elem_type val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
|
| const unwrap<T1> tmp(in.m); | | const Proxy<T1> P(X); | |
| | | | |
| | | if( | |
| | | (is_Mat<typename Proxy<T1>::stored_type>::value || is_Mat_fixed<typenam | |
| | | e Proxy<T1>::stored_type>::value) | |
| | | && | |
| | | (Proxy<T1>::fake_mat == false) // can't rely on simple alias checking | |
| | | for matrices constructed out of auxiliary memory | |
| | | ) | |
| | | { | |
| | | const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q); // need this u | |
| | | nwrap to keep stupid compilers happy | |
| | | | |
| | | op_htrans2::apply(out, tmp.M, val); | |
| | | } | |
| | | else | |
| | | { | |
| | | const uword n_rows = P.get_n_rows(); | |
| | | const uword n_cols = P.get_n_cols(); | |
| | | | |
| | | const bool is_alias = P.is_alias(out); | |
| | | | |
| | | if( (resolves_to_vector<T1>::value == true) && (Proxy<T1>::prefer_at_ac | |
| | | cessor == false) ) | |
| | | { | |
| | | if(is_alias == false) | |
| | | { | |
| | | out.set_size(n_cols, n_rows); | |
| | | | |
| | | eT* out_mem = out.memptr(); | |
| | | | |
| | | const uword n_elem = P.get_n_elem(); | |
| | | | |
| | | typename Proxy<T1>::ea_type Pea = P.get_ea(); | |
| | | | |
| | | for(uword i=0; i < n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = val * std::conj(Pea[i]); | |
| | | } | |
| | | } | |
| | | else // aliasing | |
| | | { | |
| | | Mat<eT> out2(n_cols, n_rows); | |
| | | | |
| | | eT* out_mem = out2.memptr(); | |
| | | | |
| | | const uword n_elem = P.get_n_elem(); | |
| | | | |
| | | typename Proxy<T1>::ea_type Pea = P.get_ea(); | |
| | | | |
| | | for(uword i=0; i < n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = val * std::conj(Pea[i]); | |
| | | } | |
| | | | |
| | | out.steal_mem(out2); | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | if(is_alias == false) | |
| | | { | |
| | | out.set_size(n_cols, n_rows); | |
| | | | |
| | | for(uword k=0; k < n_cols; ++k) | |
| | | for(uword i=0; i < n_rows; ++i) | |
| | | { | |
| | | out.at(k,i) = val * std::conj(P.at(i,k)); | |
| | | } | |
| | | } | |
| | | else // aliasing | |
| | | { | |
| | | Mat<eT> out2(n_cols, n_rows); | |
| | | | |
| | | for(uword k=0; k < n_cols; ++k) | |
| | | for(uword i=0; i < n_rows; ++i) | |
| | | { | |
| | | out2.at(k,i) = val * std::conj(P.at(i,k)); | |
| | | } | |
| | | | |
| | | out.steal_mem(out2); | |
| | | } | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | template<typename T1> | |
| | | arma_hot | |
| | | inline | |
| | | void | |
| | | op_htrans2::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_htrans2> | |
| | | & in, const typename arma_not_cx<typename T1::elem_type>::result* junk) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | arma_ignore(junk); | |
| | | | |
| | | op_strans2::apply_proxy(out, in.m, in.aux); | |
| | | } | |
| | | | |
| | | template<typename T1> | |
| | | arma_hot | |
| | | inline | |
| | | void | |
| | | op_htrans2::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_htrans2> | |
| | | & in, const typename arma_cx_only<typename T1::elem_type>::result* junk) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | arma_ignore(junk); | |
| | | | |
|
| op_htrans2::apply(out, tmp.M, in.aux); | | op_htrans2::apply_proxy(out, in.m, in.aux); | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 23 change blocks. |
| 26 lines changed or deleted | | 312 lines changed or added | |
|
| op_strans_meat.hpp | | op_strans_meat.hpp | |
| | | | |
| skipping to change at line 195 | | skipping to change at line 195 | |
| | | | |
| out.steal_mem(tmp); | | out.steal_mem(tmp); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_strans::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_strans>&
in) | | op_strans::apply_proxy(Mat<typename T1::elem_type>& out, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
|
| const unwrap<T1> tmp(in.m); | | const Proxy<T1> P(X); | |
| const Mat<eT>& A = tmp.M; | | | |
| | | if( | |
| | | (is_Mat<typename Proxy<T1>::stored_type>::value || is_Mat_fixed<typenam | |
| | | e Proxy<T1>::stored_type>::value) | |
| | | && | |
| | | (Proxy<T1>::fake_mat == false) // can't rely on simple alias checking | |
| | | for matrices constructed out of auxiliary memory | |
| | | ) | |
| | | { | |
| | | const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q); // need this u | |
| | | nwrap to keep stupid compilers happy | |
| | | | |
| | | op_strans::apply(out, tmp.M); | |
| | | } | |
| | | else | |
| | | { | |
| | | const uword n_rows = P.get_n_rows(); | |
| | | const uword n_cols = P.get_n_cols(); | |
| | | | |
| | | const bool is_alias = P.is_alias(out); | |
| | | | |
| | | if( (resolves_to_vector<T1>::value == true) && (Proxy<T1>::prefer_at_ac | |
| | | cessor == false) ) | |
| | | { | |
| | | if(is_alias == false) | |
| | | { | |
| | | out.set_size(n_cols, n_rows); | |
| | | | |
| | | eT* out_mem = out.memptr(); | |
| | | | |
| | | const uword n_elem = P.get_n_elem(); | |
| | | | |
| | | typename Proxy<T1>::ea_type Pea = P.get_ea(); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < n_elem; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = Pea[i]; | |
| | | const eT tmp_j = Pea[j]; | |
| | | | |
| | | out_mem[i] = tmp_i; | |
| | | out_mem[j] = tmp_j; | |
| | | } | |
| | | | |
| | | if(i < n_elem) | |
| | | { | |
| | | out_mem[i] = Pea[i]; | |
| | | } | |
| | | } | |
| | | else // aliasing | |
| | | { | |
| | | Mat<eT> out2(n_cols, n_rows); | |
| | | | |
| | | eT* out_mem = out2.memptr(); | |
| | | | |
| | | const uword n_elem = P.get_n_elem(); | |
| | | | |
| | | typename Proxy<T1>::ea_type Pea = P.get_ea(); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < n_elem; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = Pea[i]; | |
| | | const eT tmp_j = Pea[j]; | |
| | | | |
| | | out_mem[i] = tmp_i; | |
| | | out_mem[j] = tmp_j; | |
| | | } | |
| | | | |
| | | if(i < n_elem) | |
| | | { | |
| | | out_mem[i] = Pea[i]; | |
| | | } | |
| | | | |
| | | out.steal_mem(out2); | |
| | | } | |
| | | } | |
| | | else // general matrix transpose | |
| | | { | |
| | | if(is_alias == false) | |
| | | { | |
| | | out.set_size(n_cols, n_rows); | |
| | | | |
| | | for(uword k=0; k < n_cols; ++k) | |
| | | { | |
| | | uword i, j; | |
| | | | |
| | | for(i=0, j=1; j < n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = P.at(i,k); | |
| | | const eT tmp_j = P.at(j,k); | |
| | | | |
| | | out.at(k,i) = tmp_i; | |
| | | out.at(k,j) = tmp_j; | |
| | | } | |
| | | | |
| | | if(i < n_rows) | |
| | | { | |
| | | out.at(k,i) = P.at(i,k); | |
| | | } | |
| | | } | |
| | | } | |
| | | else // aliasing | |
| | | { | |
| | | Mat<eT> out2(n_cols, n_rows); | |
| | | | |
| | | for(uword k=0; k < n_cols; ++k) | |
| | | { | |
| | | uword i, j; | |
| | | | |
| | | for(i=0, j=1; j < n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = P.at(i,k); | |
| | | const eT tmp_j = P.at(j,k); | |
| | | | |
| | | out2.at(k,i) = tmp_i; | |
| | | out2.at(k,j) = tmp_j; | |
| | | } | |
| | | | |
| | | if(i < n_rows) | |
| | | { | |
| | | out2.at(k,i) = P.at(i,k); | |
| | | } | |
| | | } | |
| | | | |
| | | out.steal_mem(out2); | |
| | | } | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | template<typename T1> | |
| | | arma_hot | |
| | | inline | |
| | | void | |
| | | op_strans::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_strans>& | |
| | | in) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
|
| op_strans::apply(out, A); | | op_strans::apply_proxy(out, in.m); | |
| } | | } | |
| | | | |
| // | | // | |
| // op_strans2 | | // op_strans2 | |
| | | | |
| //! for tiny square matrices (size <= 4x4) | | //! for tiny square matrices (size <= 4x4) | |
| template<typename eT> | | template<typename eT> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
| | | | |
| skipping to change at line 284 | | skipping to change at line 417 | |
| outm[pos<false,3,3>::n4] = val * Am[pos<true,3,3>::n4]; | | outm[pos<false,3,3>::n4] = val * Am[pos<true,3,3>::n4]; | |
| } | | } | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| ; | | ; | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
|
| //! Immediate transpose of a dense matrix | | | |
| template<typename eT> | | template<typename eT> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
| op_strans2::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const eT val) | | op_strans2::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const uword A_n_cols = A.n_cols; | | const uword A_n_cols = A.n_cols; | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| skipping to change at line 407 | | skipping to change at line 539 | |
| else | | else | |
| { | | { | |
| Mat<eT> tmp; | | Mat<eT> tmp; | |
| op_strans2::apply_noalias(tmp, A, val); | | op_strans2::apply_noalias(tmp, A, val); | |
| | | | |
| out.steal_mem(tmp); | | out.steal_mem(tmp); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
|
| | | template<typename T1> | |
| | | arma_hot | |
| | | inline | |
| | | void | |
| | | op_strans2::apply_proxy(Mat<typename T1::elem_type>& out, const T1& X, cons | |
| | | t typename T1::elem_type val) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | typedef typename T1::elem_type eT; | |
| | | | |
| | | const Proxy<T1> P(X); | |
| | | | |
| | | // allow detection of in-place transpose | |
| | | if( (is_Mat<typename Proxy<T1>::stored_type>::value == true) && (Proxy<T1 | |
| | | >::fake_mat == false) ) | |
| | | { | |
| | | const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q); | |
| | | | |
| | | op_strans2::apply(out, tmp.M, val); | |
| | | } | |
| | | else | |
| | | { | |
| | | const uword n_rows = P.get_n_rows(); | |
| | | const uword n_cols = P.get_n_cols(); | |
| | | | |
| | | const bool is_alias = P.is_alias(out); | |
| | | | |
| | | if( (resolves_to_vector<T1>::value == true) && (Proxy<T1>::prefer_at_ac | |
| | | cessor == false) ) | |
| | | { | |
| | | if(is_alias == false) | |
| | | { | |
| | | out.set_size(n_cols, n_rows); | |
| | | | |
| | | eT* out_mem = out.memptr(); | |
| | | | |
| | | const uword n_elem = P.get_n_elem(); | |
| | | | |
| | | typename Proxy<T1>::ea_type Pea = P.get_ea(); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < n_elem; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = Pea[i]; | |
| | | const eT tmp_j = Pea[j]; | |
| | | | |
| | | out_mem[i] = val * tmp_i; | |
| | | out_mem[j] = val * tmp_j; | |
| | | } | |
| | | | |
| | | if(i < n_elem) | |
| | | { | |
| | | out_mem[i] = val * Pea[i]; | |
| | | } | |
| | | } | |
| | | else // aliasing | |
| | | { | |
| | | Mat<eT> out2(n_cols, n_rows); | |
| | | | |
| | | eT* out_mem = out2.memptr(); | |
| | | | |
| | | const uword n_elem = P.get_n_elem(); | |
| | | | |
| | | typename Proxy<T1>::ea_type Pea = P.get_ea(); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < n_elem; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = Pea[i]; | |
| | | const eT tmp_j = Pea[j]; | |
| | | | |
| | | out_mem[i] = val * tmp_i; | |
| | | out_mem[j] = val * tmp_j; | |
| | | } | |
| | | | |
| | | if(i < n_elem) | |
| | | { | |
| | | out_mem[i] = val * Pea[i]; | |
| | | } | |
| | | | |
| | | out.steal_mem(out2); | |
| | | } | |
| | | } | |
| | | else // general matrix transpose | |
| | | { | |
| | | if(is_alias == false) | |
| | | { | |
| | | out.set_size(n_cols, n_rows); | |
| | | | |
| | | for(uword k=0; k < n_cols; ++k) | |
| | | { | |
| | | uword i, j; | |
| | | | |
| | | for(i=0, j=1; j < n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = P.at(i,k); | |
| | | const eT tmp_j = P.at(j,k); | |
| | | | |
| | | out.at(k,i) = val * tmp_i; | |
| | | out.at(k,j) = val * tmp_j; | |
| | | } | |
| | | | |
| | | if(i < n_rows) | |
| | | { | |
| | | out.at(k,i) = val * P.at(i,k); | |
| | | } | |
| | | } | |
| | | } | |
| | | else // aliasing | |
| | | { | |
| | | Mat<eT> out2(n_cols, n_rows); | |
| | | | |
| | | for(uword k=0; k < n_cols; ++k) | |
| | | { | |
| | | uword i, j; | |
| | | | |
| | | for(i=0, j=1; j < n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = P.at(i,k); | |
| | | const eT tmp_j = P.at(j,k); | |
| | | | |
| | | out2.at(k,i) = val * tmp_i; | |
| | | out2.at(k,j) = val * tmp_j; | |
| | | } | |
| | | | |
| | | if(i < n_rows) | |
| | | { | |
| | | out2.at(k,i) = val * P.at(i,k); | |
| | | } | |
| | | } | |
| | | | |
| | | out.steal_mem(out2); | |
| | | } | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 280 lines changed or added | |
|