| Col_meat.hpp | | Col_meat.hpp | |
| | | | |
| skipping to change at line 1108 | | skipping to change at line 1108 | |
| } | | } | |
| | | | |
| 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>&
list) | | Col<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>&
list) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const uword N = list.size(); | | const uword N = uword(list.size()); | |
| | | | |
| arma_debug_check( (N > fixed_n_elem), "Col::fixed: initialiser list is
too long" ); | | arma_debug_check( (N > fixed_n_elem), "Col::fixed: initialiser list is
too long" ); | |
| | | | |
| eT* this_mem = (*this).memptr(); | | eT* this_mem = (*this).memptr(); | |
| | | | |
| arrayops::copy( this_mem, list.begin(), N ); | | arrayops::copy( this_mem, list.begin(), N ); | |
| | | | |
| for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } | | for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } | |
| | | | |
| return *this; | | return *this; | |
| | | | |
| skipping to change at line 1142 | | skipping to change at line 1142 | |
| { | | { | |
| eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | | eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | |
| const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | | const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | |
| | | | |
| arrayops::copy( dest, src, fixed_n_elem ); | | arrayops::copy( dest, src, fixed_n_elem ); | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| template<typename eT> | | #if defined(ARMA_GOOD_COMPILER) | |
| template<uword fixed_n_elem> | | | |
| template<typename T1, typename eop_type> | | | |
| inline | | | |
| const Col<eT>& | | | |
| Col<eT>::fixed<fixed_n_elem>::operator=(const eOp<T1, eop_type>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
|
| arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | | template<typename eT> | |
| | | template<uword fixed_n_elem> | |
| const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X | | template<typename T1, typename eop_type> | |
| .P.is_alias(*this)); | | inline | |
| | | const Col<eT>& | |
| if(bad_alias == false) | | Col<eT>::fixed<fixed_n_elem>::operator=(const eOp<T1, eop_type>& X) | |
| { | | { | |
|
| arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.g
et_n_cols(), "Col::fixed::operator="); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| eop_type::apply(*this, X); | | arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | |
| } | | | |
| else | | | |
| { | | | |
| arma_extra_debug_print("bad_alias = true"); | | | |
| | | | |
|
| Col<eT> tmp(X); | | const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview &&
X.P.is_alias(*this)); | |
| | | | |
|
| (*this) = tmp; | | if(bad_alias == false) | |
| } | | { | |
| | | arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X | |
| | | .get_n_cols(), "Col::fixed::operator="); | |
| | | | |
|
| return *this; | | eop_type::apply(*this, X); | |
| } | | } | |
| | | else | |
| | | { | |
| | | arma_extra_debug_print("bad_alias = true"); | |
| | | | |
|
| template<typename eT> | | Col<eT> tmp(X); | |
| template<uword fixed_n_elem> | | | |
| template<typename T1, typename T2, typename eglue_type> | | | |
| inline | | | |
| const Col<eT>& | | | |
| Col<eT>::fixed<fixed_n_elem>::operator=(const eGlue<T1, T2, eglue_type>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
|
| arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | | (*this) = tmp; | |
| arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); | | } | |
| | | | |
|
| const bool bad_alias = | | return *this; | |
| ( | | } | |
| (eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias | | | |
| (*this)) | | | |
| || | | | |
| (eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias | | | |
| (*this)) | | | |
| ); | | | |
| | | | |
|
| if(bad_alias == false) | | template<typename eT> | |
| | | template<uword fixed_n_elem> | |
| | | template<typename T1, typename T2, typename eglue_type> | |
| | | inline | |
| | | const Col<eT>& | |
| | | Col<eT>::fixed<fixed_n_elem>::operator=(const eGlue<T1, T2, eglue_type>& | |
| | | X) | |
| { | | { | |
|
| arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.g
et_n_cols(), "Col::fixed::operator="); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| eglue_type::apply(*this, X); | | arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | |
| } | | arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); | |
| else | | | |
| { | | const bool bad_alias = | |
| arma_extra_debug_print("bad_alias = true"); | | ( | |
| | | (eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_ali | |
| | | as(*this)) | |
| | | || | |
| | | (eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_ali | |
| | | as(*this)) | |
| | | ); | |
| | | | |
| | | if(bad_alias == false) | |
| | | { | |
| | | arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X | |
| | | .get_n_cols(), "Col::fixed::operator="); | |
| | | | |
| | | eglue_type::apply(*this, X); | |
| | | } | |
| | | else | |
| | | { | |
| | | arma_extra_debug_print("bad_alias = true"); | |
| | | | |
| | | Col<eT> tmp(X); | |
| | | | |
|
| Col<eT> tmp(X); | | (*this) = tmp; | |
| | | } | |
| | | | |
|
| (*this) = tmp; | | return *this; | |
| } | | } | |
| | | | |
|
| return *this; | | #endif | |
| } | | | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
| const Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type, o
p_htrans > | | const Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type, o
p_htrans > | |
| Col<eT>::fixed<fixed_n_elem>::t() const | | Col<eT>::fixed<fixed_n_elem>::t() const | |
| { | | { | |
| return Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type
, op_htrans >(*this); | | return Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type
, op_htrans >(*this); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 17 change blocks. |
| 55 lines changed or deleted | | 61 lines changed or added | |
|
| Mat_bones.hpp | | Mat_bones.hpp | |
| | | | |
| skipping to change at line 64 | | skipping to change at line 64 | |
| inline Mat(const std::string& text); | | inline Mat(const std::string& text); | |
| inline const Mat& operator=(const std::string& text); | | inline const Mat& operator=(const std::string& text); | |
| | | | |
| inline Mat(const std::vector<eT>& x); | | inline Mat(const std::vector<eT>& x); | |
| inline const Mat& operator=(const std::vector<eT>& x); | | inline const Mat& operator=(const std::vector<eT>& x); | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| inline Mat(const std::initializer_list<eT>& list); | | inline Mat(const std::initializer_list<eT>& list); | |
| inline const Mat& operator=(const std::initializer_list<eT>& list); | | inline const Mat& operator=(const std::initializer_list<eT>& list); | |
| | | | |
|
| | | inline Mat(const std::initializer_list< std::initializer | |
| | | _list<eT> >& list); | |
| | | inline const Mat& operator=(const std::initializer_list< std::initializer | |
| | | _list<eT> >& list); | |
| | | | |
| inline Mat(Mat&& m); | | inline Mat(Mat&& m); | |
| inline const Mat& operator=(Mat&& m); | | inline const Mat& operator=(Mat&& m); | |
| #endif | | #endif | |
| | | | |
| inline Mat( eT* aux_mem, const uword aux_n_rows, const uword aux_n_c
ols, const bool copy_aux_mem = true, const bool strict = true); | | inline Mat( eT* aux_mem, const uword aux_n_rows, const uword aux_n_c
ols, const bool copy_aux_mem = true, const bool strict = true); | |
| inline Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_c
ols); | | inline Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_c
ols); | |
| | | | |
| arma_inline const Mat& operator=(const eT val); | | arma_inline const Mat& operator=(const eT val); | |
| arma_inline const Mat& operator+=(const eT val); | | arma_inline const Mat& operator+=(const eT val); | |
| arma_inline const Mat& operator-=(const eT val); | | arma_inline const Mat& operator-=(const eT val); | |
| | | | |
| skipping to change at line 620 | | skipping to change at line 623 | |
| template<uword fixed_n_rows, uword fixed_n_cols> class fixed; | | template<uword fixed_n_rows, uword fixed_n_cols> class fixed; | |
| | | | |
| protected: | | protected: | |
| | | | |
| inline void init_cold(); | | inline void init_cold(); | |
| inline void init_warm(uword in_rows, uword in_cols); | | inline void init_warm(uword in_rows, uword in_cols); | |
| | | | |
| inline void init(const std::string& text); | | inline void init(const std::string& text); | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
|
| inline void init(const std::initializer_list<eT>& list); | | inline void init(const std::initializer_list<eT>& list); | |
| | | inline void init(const std::initializer_list< std::initializer_list<eT> | |
| | | >& list); | |
| #endif | | #endif | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); | | inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); | |
| | | | |
| inline Mat(const char junk, const eT* aux_mem, const uword aux_n_rows, co
nst uword aux_n_cols); | | inline Mat(const char junk, const eT* aux_mem, const uword aux_n_rows, co
nst uword aux_n_cols); | |
| | | | |
| inline Mat(const arma_vec_indicator&, const uhword in_vec_state); | | inline Mat(const arma_vec_indicator&, const uhword in_vec_state); | |
| inline Mat(const arma_vec_indicator&, const uword in_n_rows, const uword
in_n_cols, const uhword in_vec_state); | | inline Mat(const arma_vec_indicator&, const uword in_n_rows, const uword
in_n_cols, const uhword in_vec_state); | |
| | | | |
| | | | |
| skipping to change at line 689 | | skipping to change at line 693 | |
| | | | |
| inline fixed(const char* text); | | inline fixed(const char* text); | |
| inline fixed(const std::string& text); | | inline fixed(const std::string& text); | |
| | | | |
| using Mat<eT>::operator=; | | using Mat<eT>::operator=; | |
| using Mat<eT>::operator(); | | using Mat<eT>::operator(); | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| inline fixed(const std::initializer_list<eT>& list); | | inline fixed(const std::initializer_list<eT>& list); | |
| inline const Mat& operator=(const std::initializer_list<eT>& list); | | inline const Mat& operator=(const std::initializer_list<eT>& list); | |
|
| | | | |
| | | inline fixed(const std::initializer_list< std::initializ | |
| | | er_list<eT> >& list); | |
| | | inline const Mat& operator=(const std::initializer_list< std::initializ | |
| | | er_list<eT> >& list); | |
| #endif | | #endif | |
| | | | |
| arma_inline const Mat& operator=(const fixed<fixed_n_rows, fixed_n_cols>&
X); | | arma_inline const Mat& operator=(const fixed<fixed_n_rows, fixed_n_cols>&
X); | |
| | | | |
|
| template<typename T1, typename eop_type> inline const Mat& operator=(cons | | #if defined(ARMA_GOOD_COMPILER) | |
| t eOp<T1, eop_type>& X); | | template<typename T1, typename eop_type> inline const Ma | |
| | | t& operator=(const eOp<T1, eop_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Mat& | | template<typename T1, typename T2, typename eglue_type> inline const Ma | |
| operator=(const eGlue<T1, T2, eglue_type>& X); | | t& operator=(const eGlue<T1, T2, eglue_type>& X); | |
| | | #endif | |
| | | | |
| arma_inline const Op< Mat_fixed_type, op_htrans > t() const; | | arma_inline const Op< Mat_fixed_type, op_htrans > t() const; | |
| arma_inline const Op< Mat_fixed_type, op_htrans > ht() const; | | arma_inline const Op< Mat_fixed_type, op_htrans > ht() const; | |
| arma_inline const Op< Mat_fixed_type, op_strans > st() const; | | arma_inline const Op< Mat_fixed_type, op_strans > st() const; | |
| | | | |
| arma_inline arma_warn_unused const eT& at_alt (const uword i) const; | | arma_inline arma_warn_unused const eT& at_alt (const uword i) const; | |
| | | | |
| arma_inline arma_warn_unused eT& operator[] (const uword i); | | arma_inline arma_warn_unused eT& operator[] (const uword i); | |
| arma_inline arma_warn_unused const eT& operator[] (const uword i) const; | | arma_inline arma_warn_unused const eT& operator[] (const uword i) const; | |
| arma_inline arma_warn_unused eT& at (const uword i); | | arma_inline arma_warn_unused eT& at (const uword i); | |
| | | | |
End of changes. 4 change blocks. |
| 6 lines changed or deleted | | 19 lines changed or added | |
|
| Mat_meat.hpp | | Mat_meat.hpp | |
|
| // Copyright (C) 2008-2014 Conrad Sanderson | | // Copyright (C) 2008-2015 Conrad Sanderson | |
| // Copyright (C) 2008-2014 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2015 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2012-2014 Ryan Curtin | | // Copyright (C) 2012-2014 Ryan Curtin | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup Mat | | //! \addtogroup Mat | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| | | | |
| skipping to change at line 539 | | skipping to change at line 539 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| init(list); | | init(list); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
|
| | | Mat<eT>::Mat(const std::initializer_list< std::initializer_list<eT> >& li | |
| | | st) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem(0) | |
| | | , vec_state(0) | |
| | | , mem_state(0) | |
| | | , mem() | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | init(list); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator=(const std::initializer_list< std::initializer_list<eT> | |
| | | >& list) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | init(list); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| Mat<eT>::Mat(Mat<eT>&& X) | | Mat<eT>::Mat(Mat<eT>&& X) | |
| : n_rows (X.n_rows) | | : n_rows (X.n_rows) | |
| , n_cols (X.n_cols) | | , n_cols (X.n_cols) | |
| , n_elem (X.n_elem) | | , n_elem (X.n_elem) | |
| , vec_state(0 ) | | , vec_state(0 ) | |
| , mem_state(0 ) | | , mem_state(0 ) | |
| , mem ( ) | | , mem ( ) | |
| { | | { | |
| arma_extra_debug_sigprint(arma_boost::format("this = %x X = %x") % th
is % &X); | | arma_extra_debug_sigprint(arma_boost::format("this = %x X = %x") % th
is % &X); | |
| | | | |
| | | | |
| skipping to change at line 702 | | skipping to change at line 729 | |
| init_warm(in_mat.n_rows, in_mat.n_cols); | | init_warm(in_mat.n_rows, in_mat.n_cols); | |
| | | | |
| arrayops::copy( memptr(), in_mat.mem, in_mat.n_elem ); | | arrayops::copy( memptr(), in_mat.mem, in_mat.n_elem ); | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| | | | |
|
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| Mat<eT>::init(const std::initializer_list<eT>& list) | | Mat<eT>::init(const std::initializer_list<eT>& list) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const uword N = list.size(); | | const uword N = uword(list.size()); | |
| | | | |
|
| set_size(1, N); | | set_size(1, N); | |
| | | | |
|
| arrayops::copy( memptr(), list.begin(), N ); | | arrayops::copy( memptr(), list.begin(), N ); | |
| } | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | void | |
| | | Mat<eT>::init(const std::initializer_list< std::initializer_list<eT> >& l | |
| | | ist) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | uword x_n_rows = uword(list.size()); | |
| | | uword x_n_cols = 0; | |
| | | | |
| | | bool x_n_cols_found = false; | |
| | | | |
| | | auto it = list.begin(); | |
| | | auto it_end = list.end(); | |
| | | | |
| | | for(; it != it_end; ++it) | |
| | | { | |
| | | if(x_n_cols_found == false) | |
| | | { | |
| | | x_n_cols = (*it).size(); | |
| | | x_n_cols_found = true; | |
| | | } | |
| | | else | |
| | | { | |
| | | arma_check( ((*it).size() != x_n_cols), "Mat::init(): inconsistent | |
| | | number of columns in initialiser list" ); | |
| | | } | |
| | | } | |
| | | | |
| | | Mat<eT>& t = (*this); | |
| | | | |
| | | if(t.mem_state == 3) | |
| | | { | |
| | | arma_debug_check( ((x_n_rows != t.n_rows) || (x_n_cols != t.n_cols)), | |
| | | "Mat::init(): size mismatch between fixed size matrix and initialiser list | |
| | | " ); | |
| | | } | |
| | | else | |
| | | { | |
| | | t.set_size(x_n_rows, x_n_cols); | |
| | | } | |
| | | | |
| | | uword row_num = 0; | |
| | | | |
| | | auto row_it = list.begin(); | |
| | | auto row_it_end = list.end(); | |
| | | | |
| | | for(; row_it != row_it_end; ++row_it) | |
| | | { | |
| | | uword col_num = 0; | |
| | | | |
| | | auto col_it = (*row_it).begin(); | |
| | | auto col_it_end = (*row_it).end(); | |
| | | | |
| | | for(; col_it != col_it_end; ++col_it) | |
| | | { | |
| | | t.at(row_num, col_num) = (*col_it); | |
| | | ++col_num; | |
| | | } | |
| | | | |
| | | ++row_num; | |
| | | } | |
| | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| //! for constructing a complex matrix out of two non-complex matrices | | //! for constructing a complex matrix out of two non-complex matrices | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| void | | void | |
| Mat<eT>::init | | Mat<eT>::init | |
| ( | | ( | |
| | | | |
| skipping to change at line 6859 | | skipping to change at line 6947 | |
| } | | } | |
| | | | |
| 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::initiali
zer_list<eT>& list) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const std::initiali
zer_list<eT>& list) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const uword N = list.size(); | | const uword N = uword(list.size()); | |
| | | | |
| arma_debug_check( (N > fixed_n_elem), "Mat::fixed: initialiser list is
too long" ); | | arma_debug_check( (N > fixed_n_elem), "Mat::fixed: initialiser list is
too long" ); | |
| | | | |
| eT* this_mem = (*this).memptr(); | | eT* this_mem = (*this).memptr(); | |
| | | | |
| arrayops::copy( this_mem, list.begin(), N ); | | arrayops::copy( this_mem, list.begin(), N ); | |
| | | | |
| for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } | | for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | inline | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const std::initializer_ | |
| | | list< std::initializer_list<eT> >& list) | |
| | | : Mat<eT>( arma_fixed_indicator(), fixed_n_rows, fixed_n_cols, 0, ((use | |
| | | _extra) ? mem_local_extra : mem_local) ) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | Mat<eT>::init(list); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const std::initiali | |
| | | zer_list< std::initializer_list<eT> >& list) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::init(list); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| 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 | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const fixed<fixed_n_r
ows, fixed_n_cols>& X) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const fixed<fixed_n_r
ows, fixed_n_cols>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | | |
| skipping to change at line 6893 | | skipping to change at line 7005 | |
| { | | { | |
| eT* dest = (use_extra) ? mem_local_extra : mem_local; | | eT* dest = (use_extra) ? mem_local_extra : mem_local; | |
| const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | | const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | |
| | | | |
| arrayops::copy( dest, src, fixed_n_elem ); | | arrayops::copy( dest, src, fixed_n_elem ); | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| template<typename eT> | | #if defined(ARMA_GOOD_COMPILER) | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | | |
| template<typename T1, typename eop_type> | | | |
| inline | | | |
| const Mat<eT>& | | | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const eOp<T1, eop_typ | | | |
| e>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
|
| arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | template<typename T1, typename eop_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const eOp<T1, eop_t | |
| | | ype>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X
.P.is_alias(*this)); | | arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | |
| | | | |
|
| if(bad_alias == false) | | const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && | |
| { | | X.P.is_alias(*this)); | |
| arma_debug_assert_same_size(fixed_n_rows, fixed_n_cols, X.get_n_rows(), | | | |
| X.get_n_cols(), "Mat::fixed::operator="); | | | |
| | | | |
|
| eop_type::apply(*this, X); | | if(bad_alias == false) | |
| } | | { | |
| else | | arma_debug_assert_same_size(fixed_n_rows, fixed_n_cols, X.get_n_rows( | |
| { | | ), X.get_n_cols(), "Mat::fixed::operator="); | |
| arma_extra_debug_print("bad_alias = true"); | | | |
| | | | |
|
| Mat<eT> tmp(X); | | eop_type::apply(*this, X); | |
| | | } | |
| | | else | |
| | | { | |
| | | arma_extra_debug_print("bad_alias = true"); | |
| | | | |
| | | Mat<eT> tmp(X); | |
| | | | |
|
| (*this) = tmp; | | (*this) = tmp; | |
| | | } | |
| | | | |
| | | return *this; | |
| } | | } | |
| | | | |
|
| return *this; | | template<typename eT> | |
| } | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | template<typename T1, typename T2, typename eglue_type> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const eGlue<T1, T2, | |
| | | eglue_type>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
|
| template<typename eT> | | arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); | |
| template<typename T1, typename T2, typename eglue_type> | | | |
| inline | | | |
| const Mat<eT>& | | | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const eGlue<T1, T2, e | | | |
| glue_type>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
|
| arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | | const bool bad_alias = | |
| arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); | | ( | |
| | | (eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_ali | |
| | | as(*this)) | |
| | | || | |
| | | (eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_ali | |
| | | as(*this)) | |
| | | ); | |
| | | | |
|
| const bool bad_alias = | | if(bad_alias == false) | |
| ( | | { | |
| (eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias | | arma_debug_assert_same_size(fixed_n_rows, fixed_n_cols, X.get_n_rows( | |
| (*this)) | | ), X.get_n_cols(), "Mat::fixed::operator="); | |
| || | | | |
| (eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias | | | |
| (*this)) | | | |
| ); | | | |
| | | | |
|
| if(bad_alias == false) | | eglue_type::apply(*this, X); | |
| { | | } | |
| arma_debug_assert_same_size(fixed_n_rows, fixed_n_cols, X.get_n_rows(), | | else | |
| X.get_n_cols(), "Mat::fixed::operator="); | | { | |
| | | arma_extra_debug_print("bad_alias = true"); | |
| | | | |
|
| eglue_type::apply(*this, X); | | Mat<eT> tmp(X); | |
| } | | | |
| else | | | |
| { | | | |
| arma_extra_debug_print("bad_alias = true"); | | | |
| | | | |
|
| Mat<eT> tmp(X); | | (*this) = tmp; | |
| | | } | |
| | | | |
|
| (*this) = tmp; | | return *this; | |
| } | | } | |
| | | | |
|
| return *this; | | #endif | |
| } | | | |
| | | | |
| 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 | |
| const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>::Mat
_fixed_type, op_htrans > | | const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>::Mat
_fixed_type, op_htrans > | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::t() const | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::t() const | |
| { | | { | |
| return Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>::
Mat_fixed_type, op_htrans >(*this); | | return Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>::
Mat_fixed_type, op_htrans >(*this); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 24 change blocks. |
| 69 lines changed or deleted | | 195 lines changed or added | |
|
| Row_meat.hpp | | Row_meat.hpp | |
| | | | |
| skipping to change at line 1048 | | skipping to change at line 1048 | |
| } | | } | |
| | | | |
| 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>&
list) | | Row<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>&
list) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const uword N = list.size(); | | const uword N = uword(list.size()); | |
| | | | |
| arma_debug_check( (N > fixed_n_elem), "Row::fixed: initialiser list is
too long" ); | | arma_debug_check( (N > fixed_n_elem), "Row::fixed: initialiser list is
too long" ); | |
| | | | |
| eT* this_mem = (*this).memptr(); | | eT* this_mem = (*this).memptr(); | |
| | | | |
| arrayops::copy( this_mem, list.begin(), N ); | | arrayops::copy( this_mem, list.begin(), N ); | |
| | | | |
| for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } | | for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } | |
| | | | |
| return *this; | | return *this; | |
| | | | |
| skipping to change at line 1082 | | skipping to change at line 1082 | |
| { | | { | |
| eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | | eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | |
| const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | | const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | |
| | | | |
| arrayops::copy( dest, src, fixed_n_elem ); | | arrayops::copy( dest, src, fixed_n_elem ); | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| template<typename eT> | | #if defined(ARMA_GOOD_COMPILER) | |
| template<uword fixed_n_elem> | | | |
| template<typename T1, typename eop_type> | | | |
| inline | | | |
| const Row<eT>& | | | |
| Row<eT>::fixed<fixed_n_elem>::operator=(const eOp<T1, eop_type>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
|
| arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | | template<typename eT> | |
| | | template<uword fixed_n_elem> | |
| const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X | | template<typename T1, typename eop_type> | |
| .P.is_alias(*this)); | | inline | |
| | | const Row<eT>& | |
| if(bad_alias == false) | | Row<eT>::fixed<fixed_n_elem>::operator=(const eOp<T1, eop_type>& X) | |
| { | | { | |
|
| arma_debug_assert_same_size(uword(1), fixed_n_elem, X.get_n_rows(), X.g
et_n_cols(), "Row::fixed::operator="); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| eop_type::apply(*this, X); | | arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | |
| } | | | |
| else | | | |
| { | | | |
| arma_extra_debug_print("bad_alias = true"); | | | |
| | | | |
|
| Row<eT> tmp(X); | | const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview &&
X.P.is_alias(*this)); | |
| | | | |
|
| (*this) = tmp; | | if(bad_alias == false) | |
| } | | { | |
| | | arma_debug_assert_same_size(uword(1), fixed_n_elem, X.get_n_rows(), X | |
| | | .get_n_cols(), "Row::fixed::operator="); | |
| | | | |
|
| return *this; | | eop_type::apply(*this, X); | |
| } | | } | |
| | | else | |
| | | { | |
| | | arma_extra_debug_print("bad_alias = true"); | |
| | | | |
|
| template<typename eT> | | Row<eT> tmp(X); | |
| template<uword fixed_n_elem> | | | |
| template<typename T1, typename T2, typename eglue_type> | | | |
| inline | | | |
| const Row<eT>& | | | |
| Row<eT>::fixed<fixed_n_elem>::operator=(const eGlue<T1, T2, eglue_type>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
|
| arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | | (*this) = tmp; | |
| arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); | | } | |
| | | | |
|
| const bool bad_alias = | | return *this; | |
| ( | | } | |
| (eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias | | | |
| (*this)) | | | |
| || | | | |
| (eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias | | | |
| (*this)) | | | |
| ); | | | |
| | | | |
|
| if(bad_alias == false) | | template<typename eT> | |
| | | template<uword fixed_n_elem> | |
| | | template<typename T1, typename T2, typename eglue_type> | |
| | | inline | |
| | | const Row<eT>& | |
| | | Row<eT>::fixed<fixed_n_elem>::operator=(const eGlue<T1, T2, eglue_type>& | |
| | | X) | |
| { | | { | |
|
| arma_debug_assert_same_size(uword(1), fixed_n_elem, X.get_n_rows(), X.g
et_n_cols(), "Row::fixed::operator="); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| eglue_type::apply(*this, X); | | arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); | |
| } | | arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); | |
| else | | | |
| { | | const bool bad_alias = | |
| arma_extra_debug_print("bad_alias = true"); | | ( | |
| | | (eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_ali | |
| | | as(*this)) | |
| | | || | |
| | | (eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_ali | |
| | | as(*this)) | |
| | | ); | |
| | | | |
| | | if(bad_alias == false) | |
| | | { | |
| | | arma_debug_assert_same_size(uword(1), fixed_n_elem, X.get_n_rows(), X | |
| | | .get_n_cols(), "Row::fixed::operator="); | |
| | | | |
| | | eglue_type::apply(*this, X); | |
| | | } | |
| | | else | |
| | | { | |
| | | arma_extra_debug_print("bad_alias = true"); | |
| | | | |
| | | Row<eT> tmp(X); | |
| | | | |
|
| Row<eT> tmp(X); | | (*this) = tmp; | |
| | | } | |
| | | | |
|
| (*this) = tmp; | | return *this; | |
| } | | } | |
| | | | |
|
| return *this; | | #endif | |
| } | | | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
| const Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type, o
p_htrans > | | const Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type, o
p_htrans > | |
| Row<eT>::fixed<fixed_n_elem>::t() const | | Row<eT>::fixed<fixed_n_elem>::t() const | |
| { | | { | |
| return Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type
, op_htrans >(*this); | | return Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type
, op_htrans >(*this); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 17 change blocks. |
| 55 lines changed or deleted | | 61 lines changed or added | |
|