| Col_bones.hpp | | Col_bones.hpp | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| typedef typename get_pod_type<eT>::result pod_type; | | typedef typename get_pod_type<eT>::result pod_type; | |
| | | | |
| static const bool is_col = true; | | static const bool is_col = true; | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| | | | |
| inline Col(); | | inline Col(); | |
| inline Col(const Col<eT>& X); | | inline Col(const Col<eT>& X); | |
| inline explicit Col(const uword n_elem); | | inline explicit Col(const uword n_elem); | |
| inline Col(const uword in_rows, const uword in_cols); | | inline Col(const uword in_rows, const uword in_cols); | |
| | | | |
|
| | | template<typename fill_type> inline Col(const uword n_elem, | |
| | | const fill::fill_class<fill_type>& f); | |
| | | template<typename fill_type> inline Col(const uword in_rows, const uword | |
| | | in_cols, const fill::fill_class<fill_type>& f); | |
| | | | |
| inline Col(const char* text); | | inline Col(const char* text); | |
| inline const Col& operator=(const char* text); | | inline const Col& operator=(const char* text); | |
| | | | |
| inline Col(const std::string& text); | | inline Col(const std::string& text); | |
| inline const Col& operator=(const std::string& text); | | inline const Col& operator=(const std::string& text); | |
| | | | |
| inline Col(const std::vector<eT>& x); | | inline Col(const std::vector<eT>& x); | |
| inline const Col& operator=(const std::vector<eT>& x); | | inline const Col& operator=(const std::vector<eT>& x); | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| inline Col(const std::initializer_list<eT>& list); | | inline Col(const std::initializer_list<eT>& list); | |
| inline const Col& operator=(const std::initializer_list<eT>& list); | | inline const Col& operator=(const std::initializer_list<eT>& list); | |
|
| | | | |
| | | inline Col(Col&& m); | |
| | | inline const Col& operator=(Col&& m); | |
| #endif | | #endif | |
| | | | |
| inline explicit Col(const SpCol<eT>& X); | | inline explicit Col(const SpCol<eT>& X); | |
| | | | |
| inline const Col& operator=(const eT val); | | inline const Col& operator=(const eT val); | |
|
| | | inline const Col& operator=(const Col& m); | |
| | | | |
| template<typename T1> inline Col(const Base<eT,T1>& X); | | template<typename T1> inline Col(const Base<eT,T1>& X); | |
| template<typename T1> inline const Col& operator=(const Base<eT,T1>& X); | | template<typename T1> inline const Col& operator=(const Base<eT,T1>& X); | |
| | | | |
| inline Col( eT* aux_mem, const uword aux_length, const bool copy_aux
_mem = true, const bool strict = true); | | inline Col( eT* aux_mem, const uword aux_length, const bool copy_aux
_mem = true, const bool strict = true); | |
| inline Col(const eT* aux_mem, const uword aux_length); | | inline Col(const eT* aux_mem, const uword aux_length); | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>&
B); | | inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>&
B); | |
| | | | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 75 | |
| | | | |
| inline Col(const subview_cube<eT>& X); | | inline Col(const subview_cube<eT>& X); | |
| inline const Col& operator=(const subview_cube<eT>& X); | | inline const Col& operator=(const subview_cube<eT>& X); | |
| | | | |
| inline mat_injector<Col> operator<<(const eT val); | | inline mat_injector<Col> operator<<(const eT val); | |
| | | | |
| arma_inline const Op<Col<eT>,op_htrans> t() const; | | arma_inline const Op<Col<eT>,op_htrans> t() const; | |
| arma_inline const Op<Col<eT>,op_htrans> ht() const; | | arma_inline const Op<Col<eT>,op_htrans> ht() const; | |
| arma_inline const Op<Col<eT>,op_strans> st() const; | | arma_inline const Op<Col<eT>,op_strans> st() const; | |
| | | | |
|
| arma_inline eT& row(const uword row_num); | | arma_inline eT& row(const uword row_num); // TODO: inconsistent;
should return a subview_row; change API for 4.0 ? | |
| arma_inline eT row(const uword row_num) const; | | arma_inline eT row(const uword row_num) const; | |
| | | | |
|
| | | using Mat<eT>::rows; | |
| | | using Mat<eT>::operator(); | |
| | | | |
| arma_inline subview_col<eT> rows(const uword in_row1, const uword i
n_row2); | | arma_inline subview_col<eT> rows(const uword in_row1, const uword i
n_row2); | |
| arma_inline const subview_col<eT> rows(const uword in_row1, const uword i
n_row2) const; | | arma_inline const subview_col<eT> rows(const uword in_row1, const uword i
n_row2) const; | |
| | | | |
| arma_inline subview_col<eT> subvec(const uword in_row1, const uword
in_row2); | | arma_inline subview_col<eT> subvec(const uword in_row1, const uword
in_row2); | |
| arma_inline const subview_col<eT> subvec(const uword in_row1, const uword
in_row2) const; | | arma_inline const subview_col<eT> subvec(const uword in_row1, const uword
in_row2) const; | |
| | | | |
|
| | | arma_inline subview_col<eT> rows(const span& row_span); | |
| | | arma_inline const subview_col<eT> rows(const span& row_span) const; | |
| | | | |
| arma_inline subview_col<eT> subvec(const span& row_span); | | arma_inline subview_col<eT> subvec(const span& row_span); | |
| arma_inline const subview_col<eT> subvec(const span& row_span) const; | | arma_inline const subview_col<eT> subvec(const span& row_span) const; | |
| | | | |
|
| using Mat<eT>::operator(); | | | |
| | | | |
| arma_inline subview_col<eT> operator()(const span& row_span); | | arma_inline subview_col<eT> operator()(const span& row_span); | |
| arma_inline const subview_col<eT> operator()(const span& row_span) const; | | arma_inline const subview_col<eT> operator()(const span& row_span) const; | |
| | | | |
| inline void shed_row (const uword row_num); | | inline void shed_row (const uword row_num); | |
| inline void shed_rows(const uword in_row1, const uword in_row2); | | inline void shed_rows(const uword in_row1, const uword in_row2); | |
| | | | |
| inline void insert_rows(const uword row_num, const
uword N, const bool set_to_zero = true); | | inline void insert_rows(const uword row_num, const
uword N, const bool set_to_zero = true); | |
| template<typename T1> inline void insert_rows(const uword row_num, const
Base<eT,T1>& X); | | template<typename T1> inline void insert_rows(const uword row_num, const
Base<eT,T1>& X); | |
| | | | |
| arma_inline arma_warn_unused eT& at(const uword i); | | arma_inline arma_warn_unused eT& at(const uword i); | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 160 | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| | | | |
| static const uword n_rows = fixed_n_elem; | | static const uword n_rows = fixed_n_elem; | |
| static const uword n_cols = 1; | | static const uword n_cols = 1; | |
| static const uword n_elem = fixed_n_elem; | | static const uword n_elem = fixed_n_elem; | |
| | | | |
| arma_inline fixed(); | | arma_inline fixed(); | |
| arma_inline fixed(const fixed<fixed_n_elem>& X); | | arma_inline fixed(const fixed<fixed_n_elem>& X); | |
| inline fixed(const subview_cube<eT>& X); | | inline fixed(const subview_cube<eT>& X); | |
| | | | |
|
| | | template<typename fill_type> inline fixed(const fill::fill_class<fi
ll_type>& f); | |
| template<typename T1> inline fixed(const Base<eT,T1>& A); | | template<typename T1> inline fixed(const Base<eT,T1>& A); | |
| template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>&
A, const Base<pod_type,T2>& B); | | template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>&
A, const Base<pod_type,T2>& B); | |
| | | | |
| inline fixed(const eT* aux_mem); | | inline fixed(const eT* aux_mem); | |
| | | | |
| inline fixed(const char* text); | | inline fixed(const char* text); | |
| inline fixed(const std::string& text); | | inline fixed(const std::string& text); | |
| | | | |
| template<typename T1> inline const Col& operator=(const Base<eT,T1>& A); | | template<typename T1> inline const Col& operator=(const Base<eT,T1>& A); | |
| | | | |
| | | | |
| skipping to change at line 171 | | skipping to change at line 183 | |
| inline const Col& operator=(const std::string& text); | | inline const Col& operator=(const std::string& text); | |
| inline const Col& operator=(const subview_cube<eT>& X); | | inline const Col& operator=(const subview_cube<eT>& X); | |
| | | | |
| using Col<eT>::operator(); | | using Col<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 Col& operator=(const std::initializer_list<eT>& list); | | inline const Col& operator=(const std::initializer_list<eT>& list); | |
| #endif | | #endif | |
| | | | |
|
| | | arma_inline const Col& operator=(const fixed<fixed_n_elem>& X); | |
| | | | |
| arma_inline const Op< Col_fixed_type, op_htrans > t() const; | | arma_inline const Op< Col_fixed_type, op_htrans > t() const; | |
| arma_inline const Op< Col_fixed_type, op_htrans > ht() const; | | arma_inline const Op< Col_fixed_type, op_htrans > ht() const; | |
| arma_inline const Op< Col_fixed_type, op_strans > st() const; | | arma_inline const Op< Col_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); | |
| arma_inline arma_warn_unused const eT& at (const uword i) const; | | arma_inline arma_warn_unused const eT& at (const uword i) const; | |
| | | | |
End of changes. 9 change blocks. |
| 3 lines changed or deleted | | 19 lines changed or added | |
|
| Col_meat.hpp | | Col_meat.hpp | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| Col<eT>::Col(const uword in_n_rows, const uword in_n_cols) | | Col<eT>::Col(const uword in_n_rows, const uword in_n_cols) | |
| : Mat<eT>(arma_vec_indicator(), 0, 0, 1) | | : Mat<eT>(arma_vec_indicator(), 0, 0, 1) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::init_warm(in_n_rows, in_n_cols); | | Mat<eT>::init_warm(in_n_rows, in_n_cols); | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | template<typename fill_type> | |
| | | inline | |
| | | Col<eT>::Col(const uword in_n_elem, const fill::fill_class<fill_type>& f) | |
| | | : Mat<eT>(arma_vec_indicator(), in_n_elem, 1, 1) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | (*this).fill(f); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename fill_type> | |
| | | inline | |
| | | Col<eT>::Col(const uword in_n_rows, const uword in_n_cols, const fill::fill | |
| | | _class<fill_type>& f) | |
| | | : Mat<eT>(arma_vec_indicator(), 0, 0, 1) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::init_warm(in_n_rows, in_n_cols); | |
| | | | |
| | | (*this).fill(f); | |
| | | } | |
| | | | |
| //! construct a column vector from specified text | | //! construct a column vector from specified text | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| Col<eT>::Col(const char* text) | | Col<eT>::Col(const char* text) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| access::rw(Mat<eT>::vec_state) = 2; | | access::rw(Mat<eT>::vec_state) = 2; | |
| | | | |
| Mat<eT>::operator=(text); | | Mat<eT>::operator=(text); | |
| | | | |
| skipping to change at line 186 | | skipping to change at line 210 | |
| | | | |
| Mat<eT>::operator=(list); | | Mat<eT>::operator=(list); | |
| | | | |
| std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) ); | | std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) ); | |
| | | | |
| access::rw(Mat<eT>::vec_state) = 1; | | access::rw(Mat<eT>::vec_state) = 1; | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | inline | |
| | | Col<eT>::Col(Col<eT>&& X) | |
| | | : Mat<eT>(arma_vec_indicator(), 1) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | (*this).steal_mem(X); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | const Col<eT>& | |
| | | Col<eT>::operator=(Col<eT>&& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | (*this).steal_mem(X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| Col<eT>::Col(const SpCol<eT>& X) | | Col<eT>::Col(const SpCol<eT>& X) | |
| : Mat<eT>(arma_vec_indicator(), X.n_elem, 1, 1) | | : Mat<eT>(arma_vec_indicator(), X.n_elem, 1, 1) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| arrayops::inplace_set(Mat<eT>::memptr(), eT(0), X.n_elem); | | arrayops::inplace_set(Mat<eT>::memptr(), eT(0), X.n_elem); | |
| | | | |
| for(typename SpCol<eT>::const_iterator it = X.begin(); it != X.end(); ++i
t) | | for(typename SpCol<eT>::const_iterator it = X.begin(); it != X.end(); ++i
t) | |
|
| | | { | |
| at(it.row()) = (*it); | | at(it.row()) = (*it); | |
|
| | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Col<eT>& | | const Col<eT>& | |
| Col<eT>::operator=(const eT val) | | Col<eT>::operator=(const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator=(val); | | Mat<eT>::operator=(val); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | inline | |
| | | const Col<eT>& | |
| | | Col<eT>::operator=(const Col<eT>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::operator=(X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| Col<eT>::Col(const Base<eT,T1>& X) | | Col<eT>::Col(const Base<eT,T1>& X) | |
| : Mat<eT>(arma_vec_indicator(), 1) | | : Mat<eT>(arma_vec_indicator(), 1) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator=(X.get_ref()); | | Mat<eT>::operator=(X.get_ref()); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 434 | | skipping to change at line 494 | |
| arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) )
, "Col::subvec(): indices out of bounds or incorrectly used"); | | arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) )
, "Col::subvec(): indices out of bounds or incorrectly used"); | |
| | | | |
| const uword subview_n_rows = in_row2 - in_row1 + 1; | | const uword subview_n_rows = in_row2 - in_row1 + 1; | |
| | | | |
| return subview_col<eT>(*this, 0, in_row1, subview_n_rows); | | return subview_col<eT>(*this, 0, in_row1, subview_n_rows); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| subview_col<eT> | | subview_col<eT> | |
|
| | | Col<eT>::rows(const span& row_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return subvec(row_span); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview_col<eT> | |
| | | Col<eT>::rows(const span& row_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return subvec(row_span); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview_col<eT> | |
| Col<eT>::subvec(const span& row_span) | | Col<eT>::subvec(const span& row_span) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const bool row_all = row_span.whole; | | const bool row_all = row_span.whole; | |
| | | | |
| const uword local_n_rows = Mat<eT>::n_rows; | | const uword local_n_rows = Mat<eT>::n_rows; | |
| | | | |
| const uword in_row1 = row_all ? 0 : row_span.a; | | const uword in_row1 = row_all ? 0 : row_span.a; | |
| const uword in_row2 = row_span.b; | | const uword in_row2 = row_span.b; | |
| | | | |
| skipping to change at line 708 | | skipping to change at line 788 | |
| } | | } | |
| | | | |
| 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) ) | | : 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); | |
| | | | |
|
| 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; | |
| | | | |
|
| arrayops::copy( dest, X.mem, fixed_n_elem ); | | arrayops::copy( dest, src, 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) ) | | : 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); | |
| | | | |
| 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 fill_type> | |
| | | inline | |
| | | Col<eT>::fixed<fixed_n_elem>::fixed(const fill::fill_class<fill_type>&) | |
| | | : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local | |
| | | _extra : Mat<eT>::mem_local) ) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | if(is_same_type<fill_type, fill::fill_zeros>::yes) (*this).zeros(); | |
| | | if(is_same_type<fill_type, fill::fill_ones >::yes) (*this).ones(); | |
| | | if(is_same_type<fill_type, fill::fill_eye >::yes) (*this).eye(); | |
| | | if(is_same_type<fill_type, fill::fill_randu>::yes) (*this).randu(); | |
| | | if(is_same_type<fill_type, fill::fill_randn>::yes) (*this).randn(); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | 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) ) | | : 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); | |
| | | | |
| Col<eT>::operator=(A.get_ref()); | | Col<eT>::operator=(A.get_ref()); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 897 | | skipping to change at line 994 | |
| 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; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
|
| | | const Col<eT>& | |
| | | Col<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | |
| | | const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | |
| | | | |
| | | arrayops::copy( dest, src, fixed_n_elem ); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_elem> | |
| | | 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); | |
| } | | } | |
| | | | |
| 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 > | |
| | | | |
End of changes. 10 change blocks. |
| 2 lines changed or deleted | | 117 lines changed or added | |
|
| Cube_bones.hpp | | Cube_bones.hpp | |
| | | | |
| skipping to change at line 53 | | skipping to change at line 53 | |
| arma_align_mem Mat<eT>* mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ]; | | arma_align_mem Mat<eT>* mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ]; | |
| arma_align_mem eT mem_local[ Cube_prealloc::mem_n_elem ]; | | arma_align_mem eT mem_local[ Cube_prealloc::mem_n_elem ]; | |
| | | | |
| public: | | public: | |
| | | | |
| inline ~Cube(); | | inline ~Cube(); | |
| inline Cube(); | | inline Cube(); | |
| | | | |
| inline Cube(const uword in_rows, const uword in_cols, const uword in_slic
es); | | inline Cube(const uword in_rows, const uword in_cols, const uword in_slic
es); | |
| | | | |
|
| | | template<typename fill_type> | |
| | | inline Cube(const uword in_rows, const uword in_cols, const uword in_slic | |
| | | es, const fill::fill_class<fill_type>& f); | |
| | | | |
| | | #if defined(ARMA_USE_CXX11) | |
| | | inline Cube(Cube&& m); | |
| | | inline const Cube& operator=(Cube&& m); | |
| | | #endif | |
| | | | |
| inline Cube( eT* aux_mem, const uword aux_n_rows, const uword aux_n_
cols, const uword aux_n_slices, const bool copy_aux_mem = true, const bool
strict = true); | | inline Cube( eT* aux_mem, const uword aux_n_rows, const uword aux_n_
cols, const uword aux_n_slices, const bool copy_aux_mem = true, const bool
strict = true); | |
| inline Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_
cols, const uword aux_n_slices); | | inline Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_
cols, const uword aux_n_slices); | |
| | | | |
| arma_inline const Cube& operator=(const eT val); | | arma_inline const Cube& operator=(const eT val); | |
| arma_inline const Cube& operator+=(const eT val); | | arma_inline const Cube& operator+=(const eT val); | |
| arma_inline const Cube& operator-=(const eT val); | | arma_inline const Cube& operator-=(const eT val); | |
| arma_inline const Cube& operator*=(const eT val); | | arma_inline const Cube& operator*=(const eT val); | |
| arma_inline const Cube& operator/=(const eT val); | | arma_inline const Cube& operator/=(const eT val); | |
| | | | |
| inline Cube(const Cube& m); | | inline Cube(const Cube& m); | |
| | | | |
| skipping to change at line 94 | | skipping to change at line 102 | |
| | | | |
| arma_inline subview_cube<eT> subcube(const uword in_row1, const uwo
rd in_col1, const uword in_slice1, const uword in_row2, const uword in_col2
, const uword in_slice2); | | arma_inline subview_cube<eT> subcube(const uword in_row1, const uwo
rd in_col1, const uword in_slice1, const uword in_row2, const uword in_col2
, const uword in_slice2); | |
| arma_inline const subview_cube<eT> subcube(const uword in_row1, const uwo
rd in_col1, const uword in_slice1, const uword in_row2, const uword in_col2
, const uword in_slice2) const; | | arma_inline const subview_cube<eT> subcube(const uword in_row1, const uwo
rd in_col1, const uword in_slice1, const uword in_row2, const uword in_col2
, const uword in_slice2) const; | |
| | | | |
| inline subview_cube<eT> subcube(const span& row_span, const sp
an& col_span, const span& slice_span); | | inline subview_cube<eT> subcube(const span& row_span, const sp
an& col_span, const span& slice_span); | |
| inline const subview_cube<eT> subcube(const span& row_span, const sp
an& col_span, const span& slice_span) const; | | inline const subview_cube<eT> subcube(const span& row_span, const sp
an& col_span, const span& slice_span) const; | |
| | | | |
| inline subview_cube<eT> operator()(const span& row_span, const
span& col_span, const span& slice_span); | | inline subview_cube<eT> operator()(const span& row_span, const
span& col_span, const span& slice_span); | |
| inline const subview_cube<eT> operator()(const span& row_span, const
span& col_span, const span& slice_span) const; | | inline const subview_cube<eT> operator()(const span& row_span, const
span& col_span, const span& slice_span) const; | |
| | | | |
|
| | | arma_inline subview_cube<eT> tube(const uword in_row1, const uword | |
| | | in_col1); | |
| | | arma_inline const subview_cube<eT> tube(const uword in_row1, const uword | |
| | | in_col1) const; | |
| | | | |
| | | arma_inline subview_cube<eT> tube(const uword in_row1, const uword | |
| | | in_col1, const uword in_row2, const uword in_col2); | |
| | | arma_inline const subview_cube<eT> tube(const uword in_row1, const uword | |
| | | in_col1, const uword in_row2, const uword in_col2) const; | |
| | | | |
| | | inline subview_cube<eT> tube(const span& row_span, const span& | |
| | | col_span); | |
| | | inline const subview_cube<eT> tube(const span& row_span, const span& | |
| | | col_span) const; | |
| | | | |
| inline void shed_slice(const uword slice_num); | | inline void shed_slice(const uword slice_num); | |
| | | | |
| inline void shed_slices(const uword in_slice1, const uword in_slice2); | | inline void shed_slices(const uword in_slice1, const uword in_slice2); | |
| | | | |
| inline void insert_slices(const uword slice_num, const uword N, const boo
l set_to_zero = true); | | inline void insert_slices(const uword slice_num, const uword N, const boo
l set_to_zero = true); | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline void insert_slices(const uword row_num, const BaseCube<eT,T1>& X); | | inline void insert_slices(const uword row_num, const BaseCube<eT,T1>& X); | |
| | | | |
| template<typename gen_type> inline Cube(const GenCube<e
T, gen_type>& X); | | template<typename gen_type> inline Cube(const GenCube<e
T, gen_type>& X); | |
| | | | |
| skipping to change at line 323 | | skipping to change at line 340 | |
| | | | |
| static const bool use_extra = (fixed_n_elem > Cube_prealloc::mem_n_elem); | | static const bool use_extra = (fixed_n_elem > Cube_prealloc::mem_n_elem); | |
| | | | |
| arma_aligned Mat<eT>* mat_ptrs_local_extra[ (fixed_n_slices > Cube_prea
lloc::mat_ptrs_size) ? fixed_n_slices : 1 ]; | | arma_aligned Mat<eT>* mat_ptrs_local_extra[ (fixed_n_slices > Cube_prea
lloc::mat_ptrs_size) ? fixed_n_slices : 1 ]; | |
| arma_align_mem eT mem_local_extra [ use_extra
? fixed_n_elem : 1 ]; | | arma_align_mem eT mem_local_extra [ use_extra
? fixed_n_elem : 1 ]; | |
| | | | |
| arma_inline void mem_setup(); | | arma_inline void mem_setup(); | |
| | | | |
| public: | | public: | |
| | | | |
|
| inline fixed() { mem_setup(); } | | inline fixed(); | |
| | | inline fixed(const fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X); | |
| | | | |
|
| inline const Cube& operator=(const eT val) { mem_setup(); Cube<eT>::opera | | template<typename fill_type> inline fixed(const fill::fill_class<fi | |
| tor=(val); return *this; } | | ll_type>& f); | |
| | | template<typename T1> inline fixed(const BaseCube<eT,T1>& A) | |
| template<typename T1> | | ; | |
| inline fixed(const BaseCube<eT,T1>& A) { mem_setup(); Cube<eT>::operator= | | template<typename T1, typename T2> inline fixed(const BaseCube<pod_type,T | |
| (A.get_ref()); } | | 1>& A, const BaseCube<pod_type,T2>& B); | |
| | | | |
| template<typename T1> | | | |
| inline const Cube& operator=(const BaseCube<eT,T1>& A) { Cube<eT>::operat | | | |
| or=(A.get_ref()); return *this; } | | | |
| | | | |
| template<typename T1, typename T2> | | | |
| inline explicit fixed(const BaseCube<pod_type,T1>& A, const BaseCube<pod_ | | | |
| type,T2>& B) { mem_setup(); Cube<eT>::init(A,B); } | | | |
| | | | |
|
| | | using Cube<eT>::operator=; | |
| using Cube<eT>::operator(); | | using Cube<eT>::operator(); | |
| | | | |
|
| | | inline const Cube& operator=(const fixed<fixed_n_rows, fixed_n_cols, fixe | |
| | | d_n_slices>& X); | |
| | | | |
| 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); | |
| arma_inline arma_warn_unused const eT& at (const uword i) const; | | arma_inline arma_warn_unused const eT& at (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 in_row, co
nst uword in_col, const uword in_slice); | | arma_inline arma_warn_unused eT& at (const uword in_row, co
nst uword in_col, const uword in_slice); | |
| | | | |
End of changes. 6 change blocks. |
| 15 lines changed or deleted | | 36 lines changed or added | |
|
| Cube_meat.hpp | | Cube_meat.hpp | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| , n_elem(in_n_rows*in_n_cols*in_n_slices) | | , n_elem(in_n_rows*in_n_cols*in_n_slices) | |
| , mem_state(0) | | , mem_state(0) | |
| , mat_ptrs() | | , mat_ptrs() | |
| , mem() | | , mem() | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| init_cold(); | | init_cold(); | |
| } | | } | |
| | | | |
|
| | | //! construct the cube to have user specified dimensions and fill with spec | |
| | | ified pattern | |
| | | template<typename eT> | |
| | | template<typename fill_type> | |
| | | inline | |
| | | Cube<eT>::Cube(const uword in_n_rows, const uword in_n_cols, const uword in | |
| | | _n_slices, const fill::fill_class<fill_type>&) | |
| | | : n_rows(in_n_rows) | |
| | | , n_cols(in_n_cols) | |
| | | , n_elem_slice(in_n_rows*in_n_cols) | |
| | | , n_slices(in_n_slices) | |
| | | , n_elem(in_n_rows*in_n_cols*in_n_slices) | |
| | | , mem_state(0) | |
| | | , mat_ptrs() | |
| | | , mem() | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | init_cold(); | |
| | | | |
| | | if(is_same_type<fill_type, fill::fill_zeros>::yes) (*this).zeros(); | |
| | | if(is_same_type<fill_type, fill::fill_ones >::yes) (*this).ones(); | |
| | | if(is_same_type<fill_type, fill::fill_randu>::yes) (*this).randu(); | |
| | | if(is_same_type<fill_type, fill::fill_randn>::yes) (*this).randn(); | |
| | | | |
| | | if(is_same_type<fill_type, fill::fill_eye >::yes) { arma_debug_check(tr | |
| | | ue, "Cube::Cube(): unsupported fill type"); } | |
| | | } | |
| | | | |
| | | #if defined(ARMA_USE_CXX11) | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | Cube<eT>::Cube(Cube<eT>&& in_cube) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem_slice(0) | |
| | | , n_slices(0) | |
| | | , n_elem(0) | |
| | | , mem_state(0) | |
| | | , mat_ptrs() | |
| | | , mem() | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | arma_extra_debug_sigprint(arma_boost::format("this = %x in_cube = %x" | |
| | | ) % this % &in_cube); | |
| | | | |
| | | (*this).steal_mem(in_cube); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | const Cube<eT>& | |
| | | Cube<eT>::operator=(Cube<eT>&& in_cube) | |
| | | { | |
| | | arma_extra_debug_sigprint(arma_boost::format("this = %x in_cube = %x" | |
| | | ) % this % &in_cube); | |
| | | | |
| | | (*this).steal_mem(in_cube); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | #endif | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| Cube<eT>::init_cold() | | Cube<eT>::init_cold() | |
| { | | { | |
| arma_extra_debug_sigprint( arma_boost::format("n_rows = %d, n_cols = %d,
n_slices = %d") % n_rows % n_cols % n_slices ); | | arma_extra_debug_sigprint( arma_boost::format("n_rows = %d, n_cols = %d,
n_slices = %d") % n_rows % n_cols % n_slices ); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( | | ( | |
| | | | |
| skipping to change at line 893 | | skipping to change at line 953 | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const subview_cube<eT> | | const subview_cube<eT> | |
| Cube<eT>::operator()(const span& row_span, const span& col_span, const span
& slice_span) const | | Cube<eT>::operator()(const span& row_span, const span& col_span, const span
& slice_span) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return (*this).subcube(row_span, col_span, slice_span); | | return (*this).subcube(row_span, col_span, slice_span); | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview_cube<eT> | |
| | | Cube<eT>::tube(const uword in_row1, const uword in_col1) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ((in_row1 >= n_rows) || (in_col1 >= n_cols)), | |
| | | "Cube::tube(): indices out of bounds" | |
| | | ); | |
| | | | |
| | | return subview_cube<eT>(*this, in_row1, in_col1, 0, 1, 1, n_slices); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview_cube<eT> | |
| | | Cube<eT>::tube(const uword in_row1, const uword in_col1) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ((in_row1 >= n_rows) || (in_col1 >= n_cols)), | |
| | | "Cube::tube(): indices out of bounds" | |
| | | ); | |
| | | | |
| | | return subview_cube<eT>(*this, in_row1, in_col1, 0, 1, 1, n_slices); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview_cube<eT> | |
| | | Cube<eT>::tube(const uword in_row1, const uword in_col1, const uword in_row | |
| | | 2, const uword in_col2) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | (in_row1 > in_row2) || (in_col1 > in_col2) || | |
| | | (in_row2 >= n_rows) || (in_col2 >= n_cols), | |
| | | "Cube::tube(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | const uword subcube_n_rows = in_row2 - in_row1 + 1; | |
| | | const uword subcube_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
| | | return subview_cube<eT>(*this, in_row1, in_col1, 0, subcube_n_rows, subcu | |
| | | be_n_cols, n_slices); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview_cube<eT> | |
| | | Cube<eT>::tube(const uword in_row1, const uword in_col1, const uword in_row | |
| | | 2, const uword in_col2) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | (in_row1 > in_row2) || (in_col1 > in_col2) || | |
| | | (in_row2 >= n_rows) || (in_col2 >= n_cols), | |
| | | "Cube::tube(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | const uword subcube_n_rows = in_row2 - in_row1 + 1; | |
| | | const uword subcube_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
| | | return subview_cube<eT>(*this, in_row1, in_col1, 0, subcube_n_rows, subcu | |
| | | be_n_cols, n_slices); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | subview_cube<eT> | |
| | | Cube<eT>::tube(const span& row_span, const span& col_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const bool row_all = row_span.whole; | |
| | | const bool col_all = col_span.whole; | |
| | | | |
| | | const uword local_n_rows = n_rows; | |
| | | const uword local_n_cols = n_cols; | |
| | | | |
| | | const uword in_row1 = row_all ? 0 : row_span.a; | |
| | | const uword in_row2 = row_span.b; | |
| | | const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 | |
| | | + 1; | |
| | | | |
| | | const uword in_col1 = col_all ? 0 : col_span.a; | |
| | | const uword in_col2 = col_span.b; | |
| | | const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 | |
| | | + 1; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) | |
| | | ) | |
| | | || | |
| | | ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) | |
| | | ) | |
| | | , | |
| | | "Cube::tube(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview_cube<eT>(*this, in_row1, in_col1, 0, subcube_n_rows, subcu | |
| | | be_n_cols, n_slices); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | const subview_cube<eT> | |
| | | Cube<eT>::tube(const span& row_span, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const bool row_all = row_span.whole; | |
| | | const bool col_all = col_span.whole; | |
| | | | |
| | | const uword local_n_rows = n_rows; | |
| | | const uword local_n_cols = n_cols; | |
| | | | |
| | | const uword in_row1 = row_all ? 0 : row_span.a; | |
| | | const uword in_row2 = row_span.b; | |
| | | const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 | |
| | | + 1; | |
| | | | |
| | | const uword in_col1 = col_all ? 0 : col_span.a; | |
| | | const uword in_col2 = col_span.b; | |
| | | const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 | |
| | | + 1; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) | |
| | | ) | |
| | | || | |
| | | ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) | |
| | | ) | |
| | | , | |
| | | "Cube::tube(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview_cube<eT>(*this, in_row1, in_col1, 0, subcube_n_rows, subcu | |
| | | be_n_cols, n_slices); | |
| | | } | |
| | | | |
| //! remove specified slice | | //! remove specified slice | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| Cube<eT>::shed_slice(const uword slice_num) | | Cube<eT>::shed_slice(const uword slice_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( slice_num >= n_slices, "Cube::shed_slice(): index out o
f bounds"); | | arma_debug_check( slice_num >= n_slices, "Cube::shed_slice(): index out o
f bounds"); | |
| | | | |
| | | | |
| skipping to change at line 2265 | | skipping to change at line 2463 | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Cube<eT>& | | const Cube<eT>& | |
| Cube<eT>::zeros() | | Cube<eT>::zeros() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return (*this).fill(eT(0)); | | arrayops::fill_zeros(memptr(), n_elem); | |
| | | | |
| | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Cube<eT>& | | const Cube<eT>& | |
| Cube<eT>::zeros(const uword in_rows, const uword in_cols, const uword in_sl
ices) | | Cube<eT>::zeros(const uword in_rows, const uword in_cols, const uword in_sl
ices) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| set_size(in_rows, in_cols, in_slices); | | set_size(in_rows, in_cols, in_slices); | |
| | | | |
|
| return (*this).fill(eT(0)); | | return (*this).zeros(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Cube<eT>& | | const Cube<eT>& | |
| Cube<eT>::ones() | | Cube<eT>::ones() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return (*this).fill(eT(1)); | | return (*this).fill(eT(1)); | |
| | | | |
| skipping to change at line 2894 | | skipping to change at line 3094 | |
| //! if memory can't be stolen, copy the given cube | | //! if memory can't be stolen, copy the given cube | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| Cube<eT>::steal_mem(Cube<eT>& x) | | Cube<eT>::steal_mem(Cube<eT>& x) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| if(this != &x) | | if(this != &x) | |
| { | | { | |
|
| if( (x.mem_state == 0) && (x.n_elem > Cube_prealloc::mem_n_elem) ) | | if( (mem_state <= 1) && (x.mem_state <= 1) && (x.n_elem > Cube_prealloc
::mem_n_elem) ) | |
| { | | { | |
| reset(); | | reset(); | |
| | | | |
| const uword x_n_slices = x.n_slices; | | const uword x_n_slices = x.n_slices; | |
| | | | |
| access::rw(n_rows) = x.n_rows; | | access::rw(n_rows) = x.n_rows; | |
| access::rw(n_cols) = x.n_cols; | | access::rw(n_cols) = x.n_cols; | |
| access::rw(n_elem_slice) = x.n_elem_slice; | | access::rw(n_elem_slice) = x.n_elem_slice; | |
| access::rw(n_slices) = x_n_slices; | | access::rw(n_slices) = x_n_slices; | |
| access::rw(n_elem) = x.n_elem; | | access::rw(n_elem) = x.n_elem; | |
| | | | |
| skipping to change at line 2928 | | skipping to change at line 3128 | |
| mat_ptrs[i] = x.mat_ptrs[i]; | | mat_ptrs[i] = x.mat_ptrs[i]; | |
| x.mat_ptrs[i] = 0; | | x.mat_ptrs[i] = 0; | |
| } | | } | |
| } | | } | |
| | | | |
| access::rw(x.n_rows) = 0; | | access::rw(x.n_rows) = 0; | |
| access::rw(x.n_cols) = 0; | | access::rw(x.n_cols) = 0; | |
| access::rw(x.n_elem_slice) = 0; | | access::rw(x.n_elem_slice) = 0; | |
| access::rw(x.n_slices) = 0; | | access::rw(x.n_slices) = 0; | |
| access::rw(x.n_elem) = 0; | | access::rw(x.n_elem) = 0; | |
|
| | | access::rw(x.mem_state) = 0; | |
| access::rw(x.mem) = 0; | | access::rw(x.mem) = 0; | |
| } | | } | |
| else | | else | |
| { | | { | |
| (*this).operator=(x); | | (*this).operator=(x); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
|
| | | // | |
| | | // Cube::fixed | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
| arma_inline | | arma_inline | |
| void | | void | |
| Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::mem_setup() | | Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::mem_setup() | |
| { | | { | |
|
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint(); | |
| | | | |
| if(fixed_n_elem > 0) | | if(fixed_n_elem > 0) | |
| { | | { | |
| access::rw(Cube<eT>::n_rows) = fixed_n_rows; | | access::rw(Cube<eT>::n_rows) = fixed_n_rows; | |
| access::rw(Cube<eT>::n_cols) = fixed_n_cols; | | access::rw(Cube<eT>::n_cols) = fixed_n_cols; | |
| access::rw(Cube<eT>::n_elem_slice) = fixed_n_rows * fixed_n_cols; | | access::rw(Cube<eT>::n_elem_slice) = fixed_n_rows * fixed_n_cols; | |
| access::rw(Cube<eT>::n_slices) = fixed_n_slices; | | access::rw(Cube<eT>::n_slices) = fixed_n_slices; | |
| access::rw(Cube<eT>::n_elem) = fixed_n_elem; | | access::rw(Cube<eT>::n_elem) = fixed_n_elem; | |
| access::rw(Cube<eT>::mem_state) = 3; | | access::rw(Cube<eT>::mem_state) = 3; | |
| access::rw(Cube<eT>::mat_ptrs) = const_cast< const Mat<eT>** >( \ | | access::rw(Cube<eT>::mat_ptrs) = const_cast< const Mat<eT>** >( \ | |
| | | | |
| skipping to change at line 2974 | | skipping to change at line 3178 | |
| access::rw(Cube<eT>::n_slices) = 0; | | access::rw(Cube<eT>::n_slices) = 0; | |
| access::rw(Cube<eT>::n_elem) = 0; | | access::rw(Cube<eT>::n_elem) = 0; | |
| access::rw(Cube<eT>::mem_state) = 3; | | access::rw(Cube<eT>::mem_state) = 3; | |
| access::rw(Cube<eT>::mat_ptrs) = 0; | | access::rw(Cube<eT>::mat_ptrs) = 0; | |
| access::rw(Cube<eT>::mem) = 0; | | access::rw(Cube<eT>::mem) = 0; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
|
| | | inline | |
| | | Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed() | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | mem_setup(); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
| | | inline | |
| | | Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const fi | |
| | | xed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | mem_setup(); | |
| | | | |
| | | eT* dest = (use_extra) ? mem_local_extra : mem_local; | |
| | | const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | |
| | | | |
| | | arrayops::copy( dest, src, fixed_n_elem ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
| | | template<typename fill_type> | |
| | | inline | |
| | | Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const fi | |
| | | ll::fill_class<fill_type>&) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | mem_setup(); | |
| | | | |
| | | if(is_same_type<fill_type, fill::fill_zeros>::yes) (*this).zeros(); | |
| | | if(is_same_type<fill_type, fill::fill_ones >::yes) (*this).ones(); | |
| | | if(is_same_type<fill_type, fill::fill_randu>::yes) (*this).randu(); | |
| | | if(is_same_type<fill_type, fill::fill_randn>::yes) (*this).randn(); | |
| | | | |
| | | if(is_same_type<fill_type, fill::fill_eye >::yes) { arma_debug_check(tr | |
| | | ue, "Cube::fixed::fixed(): unsupported fill type"); } | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
| | | template<typename T1> | |
| | | inline | |
| | | Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const Ba | |
| | | seCube<eT,T1>& A) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | mem_setup(); | |
| | | | |
| | | Cube<eT>::operator=(A.get_ref()); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
| | | template<typename T1, typename T2> | |
| | | inline | |
| | | Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const Ba | |
| | | seCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | mem_setup(); | |
| | | | |
| | | Cube<eT>::init(A,B); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
| | | inline | |
| | | const Cube<eT>& | |
| | | Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::operator=(cons | |
| | | t fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | eT* dest = (use_extra) ? mem_local_extra : mem_local; | |
| | | const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | |
| | | | |
| | | arrayops::copy( dest, src, fixed_n_elem ); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| eT& | | eT& | |
| Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::operator[] (co
nst uword i) | | Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::operator[] (co
nst uword i) | |
| { | | { | |
| return (use_extra) ? mem_local_extra[i] : mem_local[i]; | | return (use_extra) ? mem_local_extra[i] : mem_local[i]; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | | template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> | |
| | | | |
| skipping to change at line 3102 | | skipping to change at line 3391 | |
| (in_slice >= fixed_n_slices) | | (in_slice >= fixed_n_slices) | |
| , | | , | |
| "Cube::operator(): index out of bounds" | | "Cube::operator(): index out of bounds" | |
| ); | | ); | |
| | | | |
| const uword i = in_slice*fixed_n_elem_slice + in_col*fixed_n_rows + in_ro
w; | | const uword i = in_slice*fixed_n_elem_slice + in_col*fixed_n_rows + in_ro
w; | |
| | | | |
| return (use_extra) ? mem_local_extra[i] : mem_local[i]; | | return (use_extra) ? mem_local_extra[i] : mem_local[i]; | |
| } | | } | |
| | | | |
|
| | | // | |
| | | // Cube_aux | |
| | | | |
| //! prefix ++ | | //! prefix ++ | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| void | | void | |
| Cube_aux::prefix_pp(Cube<eT>& x) | | Cube_aux::prefix_pp(Cube<eT>& x) | |
| { | | { | |
| eT* memptr = x.memptr(); | | eT* memptr = x.memptr(); | |
| const uword n_elem = x.n_elem; | | const uword n_elem = x.n_elem; | |
| | | | |
| uword i,j; | | uword i,j; | |
| | | | |
End of changes. 10 change blocks. |
| 4 lines changed or deleted | | 321 lines changed or added | |
|
| Mat_bones.hpp | | Mat_bones.hpp | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 48 | |
| public: | | public: | |
| | | | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| | | | |
| inline ~Mat(); | | inline ~Mat(); | |
| inline Mat(); | | inline Mat(); | |
| | | | |
| inline Mat(const uword in_rows, const uword in_cols); | | inline Mat(const uword in_rows, const uword in_cols); | |
| | | | |
|
| | | template<typename fill_type> | |
| | | inline Mat(const uword in_rows, const uword in_cols, const fill::fill_cla | |
| | | ss<fill_type>& f); | |
| | | | |
| inline Mat(const char* text); | | inline Mat(const char* text); | |
| inline const Mat& operator=(const char* text); | | inline const Mat& operator=(const char* text); | |
| | | | |
| 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(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); | |
| 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 169 | | skipping to change at line 175 | |
| | | | |
| inline Col<eT> unsafe_col(const uword col_num); | | inline Col<eT> unsafe_col(const uword col_num); | |
| inline const Col<eT> unsafe_col(const uword col_num) const; | | inline const Col<eT> unsafe_col(const uword col_num) const; | |
| | | | |
| arma_inline subview<eT> rows(const uword in_row1, const uword in_ro
w2); | | arma_inline subview<eT> rows(const uword in_row1, const uword in_ro
w2); | |
| arma_inline const subview<eT> rows(const uword in_row1, const uword in_ro
w2) const; | | arma_inline const subview<eT> rows(const uword in_row1, const uword in_ro
w2) const; | |
| | | | |
| arma_inline subview<eT> cols(const uword in_col1, const uword in_co
l2); | | arma_inline subview<eT> cols(const uword in_col1, const uword in_co
l2); | |
| arma_inline const subview<eT> cols(const uword in_col1, const uword in_co
l2) const; | | arma_inline const subview<eT> cols(const uword in_col1, const uword in_co
l2) const; | |
| | | | |
|
| | | inline subview<eT> rows(const span& row_span); | |
| | | inline const subview<eT> rows(const span& row_span) const; | |
| | | | |
| | | arma_inline subview<eT> cols(const span& col_span); | |
| | | arma_inline const subview<eT> cols(const span& col_span) const; | |
| | | | |
| arma_inline subview<eT> submat(const uword in_row1, const uword in_
col1, const uword in_row2, const uword in_col2); | | arma_inline subview<eT> submat(const uword in_row1, const uword in_
col1, const uword in_row2, const uword in_col2); | |
| arma_inline const subview<eT> submat(const uword in_row1, const uword in_
col1, const uword in_row2, const uword in_col2) const; | | arma_inline const subview<eT> submat(const uword in_row1, const uword in_
col1, const uword in_row2, const uword in_col2) const; | |
| | | | |
| inline subview<eT> submat (const span& row_span, const span
& col_span); | | inline subview<eT> submat (const span& row_span, const span
& col_span); | |
| inline const subview<eT> submat (const span& row_span, const span
& col_span) const; | | inline const subview<eT> submat (const span& row_span, const span
& col_span) const; | |
| | | | |
| inline subview<eT> operator()(const span& row_span, const span
& col_span); | | inline subview<eT> operator()(const span& row_span, const span
& col_span); | |
| inline const subview<eT> operator()(const span& row_span, const span
& col_span) const; | | inline const subview<eT> operator()(const span& row_span, const span
& col_span) const; | |
| | | | |
| template<typename T1> arma_inline subview_elem1<eT,T1> elem(const B
ase<uword,T1>& a); | | template<typename T1> arma_inline subview_elem1<eT,T1> elem(const B
ase<uword,T1>& a); | |
| | | | |
| skipping to change at line 347 | | skipping to change at line 359 | |
| inline void reshape(const uword in_rows, const uword in_cols, const uwor
d dim = 0); | | inline void reshape(const uword in_rows, const uword in_cols, const uwor
d dim = 0); | |
| | | | |
| template<typename functor> | | template<typename functor> | |
| inline const Mat& transform(functor F); | | inline const Mat& transform(functor F); | |
| | | | |
| template<typename functor> | | template<typename functor> | |
| inline const Mat& imbue(functor F); | | inline const Mat& imbue(functor F); | |
| | | | |
| arma_hot inline const Mat& fill(const eT val); | | arma_hot inline const Mat& fill(const eT val); | |
| | | | |
|
| | | template<typename fill_type> | |
| | | arma_hot inline const Mat& fill(const fill::fill_class<fill_type>& f); | |
| | | | |
| inline const Mat& zeros(); | | inline const Mat& zeros(); | |
| inline const Mat& zeros(const uword in_elem); | | inline const Mat& zeros(const uword in_elem); | |
| inline const Mat& zeros(const uword in_rows, const uword in_cols); | | inline const Mat& zeros(const uword in_rows, const uword in_cols); | |
| | | | |
| inline const Mat& ones(); | | inline const Mat& ones(); | |
| inline const Mat& ones(const uword in_elem); | | inline const Mat& ones(const uword in_elem); | |
| inline const Mat& ones(const uword in_rows, const uword in_cols); | | inline const Mat& ones(const uword in_rows, const uword in_cols); | |
| | | | |
| inline const Mat& randu(); | | inline const Mat& randu(); | |
| inline const Mat& randu(const uword in_elem); | | inline const Mat& randu(const uword in_elem); | |
| | | | |
| skipping to change at line 540 | | skipping to change at line 555 | |
| static const bool is_col = (fixed_n_cols == 1) ? true : false; | | static const bool is_col = (fixed_n_cols == 1) ? true : false; | |
| static const bool is_row = (fixed_n_rows == 1) ? true : false; | | static const bool is_row = (fixed_n_rows == 1) ? true : false; | |
| | | | |
| static const uword n_rows = fixed_n_rows; | | static const uword n_rows = fixed_n_rows; | |
| static const uword n_cols = fixed_n_cols; | | static const uword n_cols = fixed_n_cols; | |
| static const uword n_elem = fixed_n_elem; | | static const uword n_elem = fixed_n_elem; | |
| | | | |
| arma_inline fixed(); | | arma_inline fixed(); | |
| arma_inline fixed(const fixed<fixed_n_rows, fixed_n_cols>& X); | | arma_inline fixed(const fixed<fixed_n_rows, fixed_n_cols>& X); | |
| | | | |
|
| | | template<typename fill_type> inline fixed(const fill::fill_class<fi
ll_type>& f); | |
| template<typename T1> inline fixed(const Base<eT,T1>& A); | | template<typename T1> inline fixed(const Base<eT,T1>& A); | |
| template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>&
A, const Base<pod_type,T2>& B); | | template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>&
A, const Base<pod_type,T2>& B); | |
| | | | |
| inline fixed(const eT* aux_mem); | | inline fixed(const eT* aux_mem); | |
| | | | |
| 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); | |
| #endif | | #endif | |
| | | | |
|
| | | arma_inline const Mat& operator=(const fixed<fixed_n_rows, fixed_n_cols>& | |
| | | X); | |
| | | | |
| 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); | |
| arma_inline arma_warn_unused const eT& at (const uword i) const; | | arma_inline arma_warn_unused const eT& at (const uword i) const; | |
| | | | |
End of changes. 6 change blocks. |
| 0 lines changed or deleted | | 20 lines changed or added | |
|
| Mat_meat.hpp | | Mat_meat.hpp | |
| | | | |
| skipping to change at line 64 | | skipping to change at line 64 | |
| , n_elem(in_n_rows*in_n_cols) | | , n_elem(in_n_rows*in_n_cols) | |
| , vec_state(0) | | , vec_state(0) | |
| , mem_state(0) | | , mem_state(0) | |
| , mem() | | , mem() | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| init_cold(); | | init_cold(); | |
| } | | } | |
| | | | |
|
| | | //! construct the matrix to have user specified dimensions and fill with sp | |
| | | ecified pattern | |
| | | template<typename eT> | |
| | | template<typename fill_type> | |
| | | inline | |
| | | Mat<eT>::Mat(const uword in_n_rows, const uword in_n_cols, const fill::fill | |
| | | _class<fill_type>& f) | |
| | | : n_rows(in_n_rows) | |
| | | , n_cols(in_n_cols) | |
| | | , n_elem(in_n_rows*in_n_cols) | |
| | | , vec_state(0) | |
| | | , mem_state(0) | |
| | | , mem() | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | init_cold(); | |
| | | | |
| | | (*this).fill(f); | |
| | | } | |
| | | | |
| //! constructor used by Row and Col classes | | //! constructor used by Row and Col classes | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| Mat<eT>::Mat(const arma_vec_indicator&, const uhword in_vec_state) | | Mat<eT>::Mat(const arma_vec_indicator&, const uhword in_vec_state) | |
| : n_rows( (in_vec_state == 2) ? 1 : 0 ) | | : n_rows( (in_vec_state == 2) ? 1 : 0 ) | |
| , n_cols( (in_vec_state == 1) ? 1 : 0 ) | | , n_cols( (in_vec_state == 1) ? 1 : 0 ) | |
| , n_elem(0) | | , n_elem(0) | |
| , vec_state(in_vec_state) | | , vec_state(in_vec_state) | |
| , mem_state(0) | | , mem_state(0) | |
| , mem() | | , mem() | |
| | | | |
| skipping to change at line 475 | | skipping to change at line 494 | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::operator=(const std::initializer_list<eT>& list) | | Mat<eT>::operator=(const std::initializer_list<eT>& list) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| init(list); | | init(list); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | inline | |
| | | Mat<eT>::Mat(Mat<eT>&& in_mat) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem(0) | |
| | | , vec_state(0) | |
| | | , mem_state(0) | |
| | | , mem() | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | arma_extra_debug_sigprint(arma_boost::format("this = %x in_mat = %x") | |
| | | % this % &in_mat); | |
| | | | |
| | | (*this).steal_mem(in_mat); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator=(Mat<eT>&& in_mat) | |
| | | { | |
| | | arma_extra_debug_sigprint(arma_boost::format("this = %x in_mat = %x") | |
| | | % this % &in_mat); | |
| | | | |
| | | (*this).steal_mem(in_mat); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| //! Set the matrix to be equal to the specified scalar. | | //! Set the matrix to be equal to the specified scalar. | |
| //! NOTE: the size of the matrix will be 1x1 | | //! NOTE: the size of the matrix will be 1x1 | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::operator=(const eT val) | | Mat<eT>::operator=(const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 757 | | skipping to change at line 804 | |
| | | | |
| if(this != &x) | | if(this != &x) | |
| { | | { | |
| const uword x_n_rows = x.n_rows; | | const uword x_n_rows = x.n_rows; | |
| const uword x_n_cols = x.n_cols; | | const uword x_n_cols = x.n_cols; | |
| const uword x_n_elem = x.n_elem; | | const uword x_n_elem = x.n_elem; | |
| const uword x_vec_state = x.vec_state; | | const uword x_vec_state = x.vec_state; | |
| const uword x_mem_state = x.mem_state; | | const uword x_mem_state = x.mem_state; | |
| | | | |
| const uword t_vec_state = vec_state; | | const uword t_vec_state = vec_state; | |
|
| | | const uword t_mem_state = mem_state; | |
| | | | |
| bool layout_ok = false; | | bool layout_ok = false; | |
| | | | |
| if(t_vec_state == x_vec_state) | | if(t_vec_state == x_vec_state) | |
| { | | { | |
| layout_ok = true; | | layout_ok = true; | |
| } | | } | |
| else | | else | |
| { | | { | |
| if( (t_vec_state == 1) && ( x_n_cols == 1) ) | | if( (t_vec_state == 1) && ( x_n_cols == 1) ) | |
| { | | { | |
| layout_ok = true; | | layout_ok = true; | |
| } | | } | |
| | | | |
| if( (t_vec_state == 2) && ( x_n_rows == 1) ) | | if( (t_vec_state == 2) && ( x_n_rows == 1) ) | |
| { | | { | |
| layout_ok = true; | | layout_ok = true; | |
| } | | } | |
| } | | } | |
| | | | |
|
| if( (x_mem_state == 0) && (x_n_elem > arma_config::mat_prealloc) && (la
yout_ok == true) ) | | if( (t_mem_state <= 1) && (x_mem_state <= 1) && (x_n_elem > arma_config
::mat_prealloc) && (layout_ok == true) ) | |
| { | | { | |
| reset(); | | reset(); | |
| // note: calling reset() also prevents fixed size matrices from chang
ing size or using non-local memory | | // note: calling reset() also prevents fixed size matrices from chang
ing size or using non-local memory | |
| | | | |
| access::rw(n_rows) = x_n_rows; | | access::rw(n_rows) = x_n_rows; | |
| access::rw(n_cols) = x_n_cols; | | access::rw(n_cols) = x_n_cols; | |
| access::rw(n_elem) = x_n_elem; | | access::rw(n_elem) = x_n_elem; | |
| access::rw(mem) = x.mem; | | access::rw(mem) = x.mem; | |
| | | | |
|
| access::rw(x.n_rows) = 0; | | access::rw(x.n_rows) = 0; | |
| access::rw(x.n_cols) = 0; | | access::rw(x.n_cols) = 0; | |
| access::rw(x.n_elem) = 0; | | access::rw(x.n_elem) = 0; | |
| access::rw(x.mem) = 0; | | access::rw(x.mem_state) = 0; | |
| | | access::rw(x.mem) = 0; | |
| } | | } | |
| else | | else | |
| { | | { | |
| (*this).operator=(x); | | (*this).operator=(x); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| //! construct a matrix from a given auxiliary array of eTs. | | //! construct a matrix from a given auxiliary array of eTs. | |
| //! if copy_aux_mem is true, new memory is allocated and the array is copie
d. | | //! if copy_aux_mem is true, new memory is allocated and the array is copie
d. | |
| | | | |
| skipping to change at line 2407 | | skipping to change at line 2456 | |
| ( | | ( | |
| (in_col1 > in_col2) || (in_col2 >= n_cols), | | (in_col1 > in_col2) || (in_col2 >= n_cols), | |
| "Mat::cols(): indices out of bounds or incorrectly used" | | "Mat::cols(): indices out of bounds or incorrectly used" | |
| ); | | ); | |
| | | | |
| const uword subview_n_cols = in_col2 - in_col1 + 1; | | const uword subview_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
| return subview<eT>(*this, 0, in_col1, n_rows, subview_n_cols); | | return subview<eT>(*this, 0, in_col1, n_rows, subview_n_cols); | |
| } | | } | |
| | | | |
|
| | | //! creation of subview (submatrix comprised of specified row vectors) | |
| | | template<typename eT> | |
| | | inline | |
| | | subview<eT> | |
| | | Mat<eT>::rows(const span& row_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const bool row_all = row_span.whole; | |
| | | | |
| | | const uword local_n_rows = n_rows; | |
| | | | |
| | | const uword in_row1 = row_all ? 0 : row_span.a; | |
| | | const uword in_row2 = row_span.b; | |
| | | const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + | |
| | | 1; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) | |
| | | ) | |
| | | , | |
| | | "Mat::rows(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview<eT>(*this, in_row1, 0, submat_n_rows, n_cols); | |
| | | } | |
| | | | |
| | | //! creation of subview (submatrix comprised of specified row vectors) | |
| | | template<typename eT> | |
| | | inline | |
| | | const subview<eT> | |
| | | Mat<eT>::rows(const span& row_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const bool row_all = row_span.whole; | |
| | | | |
| | | const uword local_n_rows = n_rows; | |
| | | | |
| | | const uword in_row1 = row_all ? 0 : row_span.a; | |
| | | const uword in_row2 = row_span.b; | |
| | | const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + | |
| | | 1; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) | |
| | | ) | |
| | | , | |
| | | "Mat::rows(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview<eT>(*this, in_row1, 0, submat_n_rows, n_cols); | |
| | | } | |
| | | | |
| | | //! creation of subview (submatrix comprised of specified column vectors) | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview<eT> | |
| | | Mat<eT>::cols(const span& col_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const bool col_all = col_span.whole; | |
| | | | |
| | | const uword local_n_cols = n_cols; | |
| | | | |
| | | const uword in_col1 = col_all ? 0 : col_span.a; | |
| | | const uword in_col2 = col_span.b; | |
| | | const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + | |
| | | 1; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) | |
| | | ) | |
| | | , | |
| | | "Mat::cols(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview<eT>(*this, 0, in_col1, n_rows, submat_n_cols); | |
| | | } | |
| | | | |
| | | //! creation of subview (submatrix comprised of specified column vectors) | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview<eT> | |
| | | Mat<eT>::cols(const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const bool col_all = col_span.whole; | |
| | | | |
| | | const uword local_n_cols = n_cols; | |
| | | | |
| | | const uword in_col1 = col_all ? 0 : col_span.a; | |
| | | const uword in_col2 = col_span.b; | |
| | | const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + | |
| | | 1; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) | |
| | | ) | |
| | | , | |
| | | "Mat::cols(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview<eT>(*this, 0, in_col1, n_rows, submat_n_cols); | |
| | | } | |
| | | | |
| //! creation of subview (submatrix) | | //! creation of subview (submatrix) | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| subview<eT> | | subview<eT> | |
| Mat<eT>::submat(const uword in_row1, const uword in_col1, const uword in_ro
w2, const uword in_col2) | | Mat<eT>::submat(const uword in_row1, const uword in_col1, const uword in_ro
w2, const uword in_col2) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| | | | |
| skipping to change at line 4636 | | skipping to change at line 4789 | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::fill(const eT val) | | Mat<eT>::fill(const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arrayops::inplace_set( memptr(), val, n_elem ); | | arrayops::inplace_set( memptr(), val, n_elem ); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | //! fill the matrix with the specified value | |
| | | template<typename eT> | |
| | | template<typename fill_type> | |
| | | arma_hot | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::fill(const fill::fill_class<fill_type>&) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | if(is_same_type<fill_type, fill::fill_zeros>::yes) (*this).zeros(); | |
| | | if(is_same_type<fill_type, fill::fill_ones >::yes) (*this).ones(); | |
| | | if(is_same_type<fill_type, fill::fill_eye >::yes) (*this).eye(); | |
| | | if(is_same_type<fill_type, fill::fill_randu>::yes) (*this).randu(); | |
| | | if(is_same_type<fill_type, fill::fill_randn>::yes) (*this).randn(); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::zeros() | | Mat<eT>::zeros() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return fill(eT(0)); | | arrayops::fill_zeros(memptr(), n_elem); | |
| | | | |
| | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::zeros(const uword in_elem) | | Mat<eT>::zeros(const uword in_elem) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| set_size(in_elem); | | set_size(in_elem); | |
| | | | |
|
| return fill(eT(0)); | | return (*this).zeros(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Mat<eT>& | | const Mat<eT>& | |
|
| Mat<eT>::zeros(const uword in_rows, const uword in_cols) | | Mat<eT>::zeros(const uword in_n_rows, const uword in_n_cols) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| set_size(in_rows, in_cols); | | set_size(in_n_rows, in_n_cols); | |
| | | | |
|
| return fill(eT(0)); | | return (*this).zeros(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::ones() | | Mat<eT>::ones() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return fill(eT(1)); | | return fill(eT(1)); | |
| | | | |
| skipping to change at line 4783 | | skipping to change at line 4957 | |
| return (*this).randn(); | | return (*this).randn(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Mat<eT>& | | const Mat<eT>& | |
| Mat<eT>::eye() | | Mat<eT>::eye() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| fill(eT(0)); | | (*this).zeros(); | |
| | | | |
| const uword N = (std::min)(n_rows, n_cols); | | const uword N = (std::min)(n_rows, n_cols); | |
| | | | |
| for(uword ii=0; ii<N; ++ii) | | for(uword ii=0; ii<N; ++ii) | |
| { | | { | |
| at(ii,ii) = eT(1); | | at(ii,ii) = eT(1); | |
| } | | } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| skipping to change at line 5600 | | skipping to change at line 5774 | |
| } | | } | |
| | | | |
| 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) ) | | : 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); | |
| | | | |
|
| 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; | |
| | | | |
|
| arrayops::copy( dest, X.mem, fixed_n_elem ); | | arrayops::copy( dest, src, fixed_n_elem ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | template<typename fill_type> | |
| | | inline | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::fixed(const fill::fill_class<fi | |
| | | ll_type>&) | |
| | | : 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); | |
| | | | |
| | | if(is_same_type<fill_type, fill::fill_zeros>::yes) (*this).zeros(); | |
| | | if(is_same_type<fill_type, fill::fill_ones >::yes) (*this).ones(); | |
| | | if(is_same_type<fill_type, fill::fill_eye >::yes) (*this).eye(); | |
| | | if(is_same_type<fill_type, fill::fill_randu>::yes) (*this).randu(); | |
| | | if(is_same_type<fill_type, fill::fill_randn>::yes) (*this).randn(); | |
| } | | } | |
| | | | |
| 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) ) | | : 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); | |
| | | | |
| skipping to change at line 5703 | | skipping to change at line 5894 | |
| 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; | |
| } | | } | |
| | | | |
| #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>& | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const fixed<fixed_n_r | |
| | | ows, fixed_n_cols>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | eT* dest = (use_extra) ? mem_local_extra : mem_local; | |
| | | const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | |
| | | | |
| | | arrayops::copy( dest, src, fixed_n_elem ); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | 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); | |
| } | | } | |
| | | | |
| 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 > | |
| | | | |
End of changes. 16 change blocks. |
| 13 lines changed or deleted | | 235 lines changed or added | |
|
| Row_bones.hpp | | Row_bones.hpp | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| typedef typename get_pod_type<eT>::result pod_type; | | typedef typename get_pod_type<eT>::result pod_type; | |
| | | | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| static const bool is_row = true; | | static const bool is_row = true; | |
| | | | |
| inline Row(); | | inline Row(); | |
| inline Row(const Row<eT>& X); | | inline Row(const Row<eT>& X); | |
| inline explicit Row(const uword N); | | inline explicit Row(const uword N); | |
| inline Row(const uword in_rows, const uword in_cols); | | inline Row(const uword in_rows, const uword in_cols); | |
| | | | |
|
| | | template<typename fill_type> inline Row(const uword n_elem, | |
| | | const fill::fill_class<fill_type>& f); | |
| | | template<typename fill_type> inline Row(const uword in_rows, const uword | |
| | | in_cols, const fill::fill_class<fill_type>& f); | |
| | | | |
| inline Row(const char* text); | | inline Row(const char* text); | |
| inline const Row& operator=(const char* text); | | inline const Row& operator=(const char* text); | |
| | | | |
| inline Row(const std::string& text); | | inline Row(const std::string& text); | |
| inline const Row& operator=(const std::string& text); | | inline const Row& operator=(const std::string& text); | |
| | | | |
| inline Row(const std::vector<eT>& x); | | inline Row(const std::vector<eT>& x); | |
| inline const Row& operator=(const std::vector<eT>& x); | | inline const Row& operator=(const std::vector<eT>& x); | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| inline Row(const std::initializer_list<eT>& list); | | inline Row(const std::initializer_list<eT>& list); | |
| inline const Row& operator=(const std::initializer_list<eT>& list); | | inline const Row& operator=(const std::initializer_list<eT>& list); | |
|
| | | | |
| | | inline Row(Row&& m); | |
| | | inline const Row& operator=(Row&& m); | |
| #endif | | #endif | |
| | | | |
| inline explicit Row(const SpRow<eT>& X); | | inline explicit Row(const SpRow<eT>& X); | |
| | | | |
| inline const Row& operator=(const eT val); | | inline const Row& operator=(const eT val); | |
|
| | | inline const Row& operator=(const Row& X); | |
| | | | |
| template<typename T1> inline Row(const Base<eT,T1>& X); | | template<typename T1> inline Row(const Base<eT,T1>& X); | |
| template<typename T1> inline const Row& operator=(const Base<eT,T1>& X); | | template<typename T1> inline const Row& operator=(const Base<eT,T1>& X); | |
| | | | |
| inline Row( eT* aux_mem, const uword aux_length, const bool copy_aux
_mem = true, const bool strict = true); | | inline Row( eT* aux_mem, const uword aux_length, const bool copy_aux
_mem = true, const bool strict = true); | |
| inline Row(const eT* aux_mem, const uword aux_length); | | inline Row(const eT* aux_mem, const uword aux_length); | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline explicit Row(const Base<pod_type,T1>& A, const Base<pod_type,T2>&
B); | | inline explicit Row(const Base<pod_type,T1>& A, const Base<pod_type,T2>&
B); | |
| | | | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 75 | |
| | | | |
| inline Row(const subview_cube<eT>& X); | | inline Row(const subview_cube<eT>& X); | |
| inline const Row& operator=(const subview_cube<eT>& X); | | inline const Row& operator=(const subview_cube<eT>& X); | |
| | | | |
| inline mat_injector<Row> operator<<(const eT val); | | inline mat_injector<Row> operator<<(const eT val); | |
| | | | |
| arma_inline const Op<Row<eT>,op_htrans> t() const; | | arma_inline const Op<Row<eT>,op_htrans> t() const; | |
| arma_inline const Op<Row<eT>,op_htrans> ht() const; | | arma_inline const Op<Row<eT>,op_htrans> ht() const; | |
| arma_inline const Op<Row<eT>,op_strans> st() const; | | arma_inline const Op<Row<eT>,op_strans> st() const; | |
| | | | |
|
| arma_inline eT& col(const uword col_num); | | arma_inline eT& col(const uword col_num); // TODO: inconsistent;
should return a subview_col; change API for 4.0 ? | |
| arma_inline eT col(const uword col_num) const; | | arma_inline eT col(const uword col_num) const; | |
| | | | |
|
| | | using Mat<eT>::cols; | |
| | | using Mat<eT>::operator(); | |
| | | | |
| arma_inline subview_row<eT> cols(const uword in_col1, const uword i
n_col2); | | arma_inline subview_row<eT> cols(const uword in_col1, const uword i
n_col2); | |
| arma_inline const subview_row<eT> cols(const uword in_col1, const uword i
n_col2) const; | | arma_inline const subview_row<eT> cols(const uword in_col1, const uword i
n_col2) const; | |
| | | | |
| arma_inline subview_row<eT> subvec(const uword in_col1, const uword
in_col2); | | arma_inline subview_row<eT> subvec(const uword in_col1, const uword
in_col2); | |
| arma_inline const subview_row<eT> subvec(const uword in_col1, const uword
in_col2) const; | | arma_inline const subview_row<eT> subvec(const uword in_col1, const uword
in_col2) const; | |
| | | | |
|
| | | arma_inline subview_row<eT> cols(const span& col_span); | |
| | | arma_inline const subview_row<eT> cols(const span& col_span) const; | |
| | | | |
| arma_inline subview_row<eT> subvec(const span& col_span); | | arma_inline subview_row<eT> subvec(const span& col_span); | |
| arma_inline const subview_row<eT> subvec(const span& col_span) const; | | arma_inline const subview_row<eT> subvec(const span& col_span) const; | |
| | | | |
|
| using Mat<eT>::operator(); | | | |
| | | | |
| arma_inline subview_row<eT> operator()(const span& col_span); | | arma_inline subview_row<eT> operator()(const span& col_span); | |
| arma_inline const subview_row<eT> operator()(const span& col_span) const; | | arma_inline const subview_row<eT> operator()(const span& col_span) const; | |
| | | | |
| inline void shed_col (const uword col_num); | | inline void shed_col (const uword col_num); | |
| inline void shed_cols(const uword in_col1, const uword in_col2); | | inline void shed_cols(const uword in_col1, const uword in_col2); | |
| | | | |
| inline void insert_cols(const uword col_num, const
uword N, const bool set_to_zero = true); | | inline void insert_cols(const uword col_num, const
uword N, const bool set_to_zero = true); | |
| template<typename T1> inline void insert_cols(const uword col_num, const
Base<eT,T1>& X); | | template<typename T1> inline void insert_cols(const uword col_num, const
Base<eT,T1>& X); | |
| | | | |
| arma_inline arma_warn_unused eT& at(const uword i); | | arma_inline arma_warn_unused eT& at(const uword i); | |
| | | | |
| skipping to change at line 147 | | skipping to change at line 158 | |
| static const bool is_row = true; | | static const bool is_row = true; | |
| | | | |
| static const uword n_rows = 1; | | static const uword n_rows = 1; | |
| static const uword n_cols = fixed_n_elem; | | static const uword n_cols = fixed_n_elem; | |
| static const uword n_elem = fixed_n_elem; | | static const uword n_elem = fixed_n_elem; | |
| | | | |
| arma_inline fixed(); | | arma_inline fixed(); | |
| arma_inline fixed(const fixed<fixed_n_elem>& X); | | arma_inline fixed(const fixed<fixed_n_elem>& X); | |
| inline fixed(const subview_cube<eT>& X); | | inline fixed(const subview_cube<eT>& X); | |
| | | | |
|
| | | template<typename fill_type> inline fixed(const fill::fill_class<fi
ll_type>& f); | |
| template<typename T1> inline fixed(const Base<eT,T1>& A); | | template<typename T1> inline fixed(const Base<eT,T1>& A); | |
| template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>&
A, const Base<pod_type,T2>& B); | | template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>&
A, const Base<pod_type,T2>& B); | |
| | | | |
| inline fixed(const eT* aux_mem); | | inline fixed(const eT* aux_mem); | |
| | | | |
| inline fixed(const char* text); | | inline fixed(const char* text); | |
| inline fixed(const std::string& text); | | inline fixed(const std::string& text); | |
| | | | |
| template<typename T1> inline const Row& operator=(const Base<eT,T1>& A); | | template<typename T1> inline const Row& operator=(const Base<eT,T1>& A); | |
| | | | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 181 | |
| inline const Row& operator=(const std::string& text); | | inline const Row& operator=(const std::string& text); | |
| inline const Row& operator=(const subview_cube<eT>& X); | | inline const Row& operator=(const subview_cube<eT>& X); | |
| | | | |
| using Row<eT>::operator(); | | using Row<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 Row& operator=(const std::initializer_list<eT>& list); | | inline const Row& operator=(const std::initializer_list<eT>& list); | |
| #endif | | #endif | |
| | | | |
|
| | | arma_inline const Row& operator=(const fixed<fixed_n_elem>& X); | |
| | | | |
| arma_inline const Op< Row_fixed_type, op_htrans > t() const; | | arma_inline const Op< Row_fixed_type, op_htrans > t() const; | |
| arma_inline const Op< Row_fixed_type, op_htrans > ht() const; | | arma_inline const Op< Row_fixed_type, op_htrans > ht() const; | |
| arma_inline const Op< Row_fixed_type, op_strans > st() const; | | arma_inline const Op< Row_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); | |
| arma_inline arma_warn_unused const eT& at (const uword i) const; | | arma_inline arma_warn_unused const eT& at (const uword i) const; | |
| | | | |
End of changes. 9 change blocks. |
| 3 lines changed or deleted | | 19 lines changed or added | |
|
| Row_meat.hpp | | Row_meat.hpp | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| inline | | inline | |
| Row<eT>::Row(const uword in_n_rows, const uword in_n_cols) | | Row<eT>::Row(const uword in_n_rows, const uword in_n_cols) | |
| : Mat<eT>(arma_vec_indicator(), 2) | | : Mat<eT>(arma_vec_indicator(), 2) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::init_warm(in_n_rows, in_n_cols); | | Mat<eT>::init_warm(in_n_rows, in_n_cols); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | template<typename fill_type> | |
| | | inline | |
| | | Row<eT>::Row(const uword in_n_elem, const fill::fill_class<fill_type>& f) | |
| | | : Mat<eT>(arma_vec_indicator(), 1, in_n_elem, 2) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | (*this).fill(f); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename fill_type> | |
| | | inline | |
| | | Row<eT>::Row(const uword in_n_rows, const uword in_n_cols, const fill::fill | |
| | | _class<fill_type>& f) | |
| | | : Mat<eT>(arma_vec_indicator(), 2) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::init_warm(in_n_rows, in_n_cols); | |
| | | | |
| | | (*this).fill(f); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| inline | | inline | |
| Row<eT>::Row(const char* text) | | Row<eT>::Row(const char* text) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| access::rw(Mat<eT>::vec_state) = 2; | | access::rw(Mat<eT>::vec_state) = 2; | |
| | | | |
| Mat<eT>::operator=(text); | | Mat<eT>::operator=(text); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 152 | | skipping to change at line 176 | |
| const Row<eT>& | | const Row<eT>& | |
| Row<eT>::operator=(const std::initializer_list<eT>& list) | | Row<eT>::operator=(const std::initializer_list<eT>& list) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator=(list); | | Mat<eT>::operator=(list); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | inline | |
| | | Row<eT>::Row(Row<eT>&& X) | |
| | | : Mat<eT>(arma_vec_indicator(), 2) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | (*this).steal_mem(X); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | const Row<eT>& | |
| | | Row<eT>::operator=(Row<eT>&& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | (*this).steal_mem(X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| Row<eT>::Row(const SpRow<eT>& X) | | Row<eT>::Row(const SpRow<eT>& X) | |
| : Mat<eT>(arma_vec_indicator(), 1, X.n_elem, 1) | | : Mat<eT>(arma_vec_indicator(), 1, X.n_elem, 1) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| arrayops::inplace_set(Mat<eT>::memptr(), eT(0), X.n_elem); | | arrayops::inplace_set(Mat<eT>::memptr(), eT(0), X.n_elem); | |
| | | | |
| for(typename SpRow<eT>::const_iterator it = X.begin(); it != X.end(); ++i
t) | | for(typename SpRow<eT>::const_iterator it = X.begin(); it != X.end(); ++i
t) | |
|
| | | { | |
| at(it.col()) = (*it); | | at(it.col()) = (*it); | |
|
| | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const Row<eT>& | | const Row<eT>& | |
| Row<eT>::operator=(const eT val) | | Row<eT>::operator=(const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator=(val); | | Mat<eT>::operator=(val); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | inline | |
| | | const Row<eT>& | |
| | | Row<eT>::operator=(const Row<eT>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Mat<eT>::operator=(X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| Row<eT>::Row(const Base<eT,T1>& X) | | Row<eT>::Row(const Base<eT,T1>& X) | |
| : Mat<eT>(arma_vec_indicator(), 2) | | : Mat<eT>(arma_vec_indicator(), 2) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| Mat<eT>::operator=(X.get_ref()); | | Mat<eT>::operator=(X.get_ref()); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 400 | | skipping to change at line 460 | |
| arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) )
, "Row::subvec(): indices out of bounds or incorrectly used"); | | arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) )
, "Row::subvec(): indices out of bounds or incorrectly used"); | |
| | | | |
| const uword subview_n_cols = in_col2 - in_col1 + 1; | | const uword subview_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
| return subview_row<eT>(*this, 0, in_col1, subview_n_cols); | | return subview_row<eT>(*this, 0, in_col1, subview_n_cols); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| subview_row<eT> | | subview_row<eT> | |
|
| | | Row<eT>::cols(const span& col_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return subvec(col_span); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview_row<eT> | |
| | | Row<eT>::cols(const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return subvec(col_span); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview_row<eT> | |
| Row<eT>::subvec(const span& col_span) | | Row<eT>::subvec(const span& col_span) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const bool col_all = col_span.whole; | | const bool col_all = col_span.whole; | |
| | | | |
| const uword local_n_cols = Mat<eT>::n_cols; | | const uword local_n_cols = Mat<eT>::n_cols; | |
| | | | |
| const uword in_col1 = col_all ? 0 : col_span.a; | | const uword in_col1 = col_all ? 0 : col_span.a; | |
| const uword in_col2 = col_span.b; | | const uword in_col2 = col_span.b; | |
| | | | |
| skipping to change at line 662 | | skipping to change at line 742 | |
| } | | } | |
| | | | |
| 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) ) | | : 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); | |
| | | | |
|
| 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; | |
| | | | |
|
| arrayops::copy( dest, X.mem, fixed_n_elem ); | | arrayops::copy( dest, src, 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) ) | | : 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); | |
| | | | |
| 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 fill_type> | |
| | | inline | |
| | | Row<eT>::fixed<fixed_n_elem>::fixed(const fill::fill_class<fill_type>&) | |
| | | : Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local | |
| | | _extra : Mat<eT>::mem_local) ) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | if(is_same_type<fill_type, fill::fill_zeros>::yes) (*this).zeros(); | |
| | | if(is_same_type<fill_type, fill::fill_ones >::yes) (*this).ones(); | |
| | | if(is_same_type<fill_type, fill::fill_eye >::yes) (*this).eye(); | |
| | | if(is_same_type<fill_type, fill::fill_randu>::yes) (*this).randu(); | |
| | | if(is_same_type<fill_type, fill::fill_randn>::yes) (*this).randn(); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | 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) ) | | : 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); | |
| | | | |
| Row<eT>::operator=(A.get_ref()); | | Row<eT>::operator=(A.get_ref()); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 837 | | skipping to change at line 934 | |
| 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; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_elem> | | template<uword fixed_n_elem> | |
| arma_inline | | arma_inline | |
|
| | | const Row<eT>& | |
| | | Row<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; | |
| | | const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; | |
| | | | |
| | | arrayops::copy( dest, src, fixed_n_elem ); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_elem> | |
| | | 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); | |
| } | | } | |
| | | | |
| 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 > | |
| | | | |
End of changes. 10 change blocks. |
| 2 lines changed or deleted | | 117 lines changed or added | |
|
| SpMat_bones.hpp | | SpMat_bones.hpp | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 39 | |
| const uword vec_state; //!< 0: matrix; 1: column vector; 2: row vector | | const uword vec_state; //!< 0: matrix; 1: column vector; 2: row vector | |
| | | | |
| // So that SpValProxy can call add_element() and delete_element(). | | // So that SpValProxy can call add_element() and delete_element(). | |
| friend class SpValProxy<SpMat<eT> >; | | friend class SpValProxy<SpMat<eT> >; | |
| friend class SpSubview<eT>; | | friend class SpSubview<eT>; | |
| | | | |
| /** | | /** | |
| * The memory used to store the values of the matrix. | | * The memory used to store the values of the matrix. | |
| * In accordance with the CSC format, this stores only the actual values. | | * In accordance with the CSC format, this stores only the actual values. | |
| * The correct locations of the values are assembled from the row indices | | * The correct locations of the values are assembled from the row indices | |
|
| * and the column pointers. | | * and the column pointers. The length of this array is n_nonzero + 1; t | |
| | | he | |
| | | * final value ensures the integrity of iterators. If you are planning o | |
| | | n | |
| | | * resizing this vector, it's probably best to use mem_resize() instead. | |
| */ | | */ | |
| const eT* const values; | | const eT* const values; | |
| | | | |
| /** | | /** | |
| * The row indices of each value. row_indices[i] is the row of values[i]
. | | * The row indices of each value. row_indices[i] is the row of values[i]
. | |
| * The length of this array is n_nonzero + 1; the final value ensures the | | * The length of this array is n_nonzero + 1; the final value ensures the | |
|
| * integrity of iterators. | | * integrity of iterators. If you are planning on resizing this vector, | |
| | | it's | |
| | | * probably best to use mem_resize() instead. | |
| */ | | */ | |
| const uword* const row_indices; | | const uword* const row_indices; | |
| | | | |
| /** | | /** | |
| * The column pointers. This stores the index of the first item in colum
n i. | | * The column pointers. This stores the index of the first item in colum
n i. | |
| * That is, values[col_ptrs[i]] is the first value in column i, and it is
in | | * That is, values[col_ptrs[i]] is the first value in column i, and it is
in | |
|
| * row row_indices[col_ptrs[i]]. | | * row row_indices[col_ptrs[i]]. This array is of length (n_cols + 2); t | |
| | | he | |
| | | * element col_ptrs[n_cols] should be equal to n_nonzero, and the element | |
| | | * col_ptrs[n_cols + 1] is an invalid very large value that ensures the | |
| | | * integrity of iterators. | |
| */ | | */ | |
| const uword* const col_ptrs; | | const uword* const col_ptrs; | |
| | | | |
| inline SpMat(); //! Size will be 0x0 (empty). | | inline SpMat(); //! Size will be 0x0 (empty). | |
| inline ~SpMat(); | | inline ~SpMat(); | |
| | | | |
| inline SpMat(const uword in_rows, const uword in_cols); | | inline SpMat(const uword in_rows, const uword in_cols); | |
| | | | |
| inline SpMat(const char* text); | | inline SpMat(const char* text); | |
| inline const SpMat& operator=(const char* text); | | inline const SpMat& operator=(const char* text); | |
| inline SpMat(const std::string& text); | | inline SpMat(const std::string& text); | |
| inline const SpMat& operator=(const std::string& text); | | inline const SpMat& operator=(const std::string& text); | |
| inline SpMat(const SpMat<eT>& x); | | inline SpMat(const SpMat<eT>& x); | |
| | | | |
| template<typename T1, typename T2> inline SpMat(const Base<uword,T1>& loc
ations, const Base<eT,T2>& values, const bool sort_locations = true); | | template<typename T1, typename T2> inline SpMat(const Base<uword,T1>& loc
ations, const Base<eT,T2>& values, const bool sort_locations = true); | |
| template<typename T1, typename T2> inline SpMat(const Base<uword,T1>& loc
ations, const Base<eT,T2>& values, const uword n_rows, const uword n_cols,
const bool sort_locations = true); | | template<typename T1, typename T2> inline SpMat(const Base<uword,T1>& loc
ations, const Base<eT,T2>& values, const uword n_rows, const uword n_cols,
const bool sort_locations = true); | |
| | | | |
|
| | | template<typename T1, typename T2, typename T3> inline SpMat(const Base<u | |
| | | word,T1>& rowind, const Base<uword,T2>& colptr, const Base<eT,T3>& values, | |
| | | const uword n_rows, const uword n_cols); | |
| | | | |
| inline const SpMat& operator=(const eT val); //! Sets size to 1x1. | | inline const SpMat& operator=(const eT val); //! Sets size to 1x1. | |
| inline const SpMat& operator*=(const eT val); | | inline const SpMat& operator*=(const eT val); | |
| inline const SpMat& operator/=(const eT val); | | inline const SpMat& operator/=(const eT val); | |
| // operator+=(val) and operator-=(val) are not defined as they don't make
sense for sparse matrices | | // operator+=(val) and operator-=(val) are not defined as they don't make
sense for sparse matrices | |
| | | | |
| /** | | /** | |
| * Operators on other sparse matrices. These work as though you would ex
pect. | | * Operators on other sparse matrices. These work as though you would ex
pect. | |
| */ | | */ | |
| inline const SpMat& operator=(const SpMat& m); | | inline const SpMat& operator=(const SpMat& m); | |
| inline const SpMat& operator+=(const SpMat& m); | | inline const SpMat& operator+=(const SpMat& m); | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 17 lines changed or added | |
|
| SpMat_meat.hpp | | SpMat_meat.hpp | |
| | | | |
| skipping to change at line 298 | | skipping to change at line 298 | |
| , n_nonzero(0) | | , n_nonzero(0) | |
| , vec_state(0) | | , vec_state(0) | |
| , values(NULL) | | , values(NULL) | |
| , row_indices(NULL) | | , row_indices(NULL) | |
| , col_ptrs(NULL) | | , col_ptrs(NULL) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| init(in_n_rows, in_n_cols); | | init(in_n_rows, in_n_cols); | |
| | | | |
|
| const unwrap<T1> locs_tmp( locations_expr.get_ref() ); | | const unwrap<T1> locs_tmp( locations_expr.get_ref() ); | |
| const Mat<uword>& locs = locs_tmp.M; | | | |
| | | | |
| const unwrap<T2> vals_tmp( vals_expr.get_ref() ); | | const unwrap<T2> vals_tmp( vals_expr.get_ref() ); | |
|
| const Mat<eT>& vals = vals_tmp.M; | | | |
| | | | |
|
| arma_debug_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'value | | const Mat<uword>& locs = locs_tmp.M; | |
| s' object is not a vector" ); | | const Mat<eT>& vals = vals_tmp.M; | |
| | | | |
| arma_debug_check((locs.n_rows != 2), "SpMat::SpMat(): locations matrix mu | | | |
| st have two rows"); | | | |
| | | | |
|
| arma_debug_check((locs.n_cols != vals.n_elem), "SpMat::SpMat(): number of | | arma_debug_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'v | |
| locations is different than number of values"); | | alues' object is not a vector" ); | |
| | | arma_debug_check( (locs.n_rows != 2), "SpMat::SpMat(): location | |
| | | s matrix must have two rows" ); | |
| | | arma_debug_check( (locs.n_cols != vals.n_elem), "SpMat::SpMat(): number o | |
| | | f locations is different than number of values" ); | |
| | | | |
| // Resize to correct number of elements. | | // Resize to correct number of elements. | |
| mem_resize(vals.n_elem); | | mem_resize(vals.n_elem); | |
| | | | |
| // Reset column pointers to zero. | | // Reset column pointers to zero. | |
| arrayops::inplace_set(access::rwp(col_ptrs), uword(0), n_cols + 1); | | arrayops::inplace_set(access::rwp(col_ptrs), uword(0), n_cols + 1); | |
| | | | |
| bool actually_sorted = true; | | bool actually_sorted = true; | |
|
| | | | |
| if(sort_locations == true) | | if(sort_locations == true) | |
| { | | { | |
| // sort_index() uses std::sort() which may use quicksort... so we bette
r | | // sort_index() uses std::sort() which may use quicksort... so we bette
r | |
| // make sure it's not already sorted before taking an O(N^2) sort penal
ty. | | // make sure it's not already sorted before taking an O(N^2) sort penal
ty. | |
| for (uword i = 1; i < locs.n_cols; ++i) | | for (uword i = 1; i < locs.n_cols; ++i) | |
| { | | { | |
| if ((locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.at(
1, i - 1) && locs.at(0, i) <= locs.at(0, i - 1))) | | if ((locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.at(
1, i - 1) && locs.at(0, i) <= locs.at(0, i - 1))) | |
| { | | { | |
| actually_sorted = false; | | actually_sorted = false; | |
| break; | | break; | |
| | | | |
| skipping to change at line 376 | | skipping to change at line 375 | |
| // Check ordering in debug mode. | | // Check ordering in debug mode. | |
| if(i > 0) | | if(i > 0) | |
| { | | { | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( (locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.a
t(1, i - 1) && locs.at(0, i) < locs.at(0, i - 1)) ), | | ( (locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.a
t(1, i - 1) && locs.at(0, i) < locs.at(0, i - 1)) ), | |
| "SpMat::SpMat(): out of order points; either pass sort_locations
= true or sort points in column-major ordering" | | "SpMat::SpMat(): out of order points; either pass sort_locations
= true or sort points in column-major ordering" | |
| ); | | ); | |
| arma_debug_check((locs.at(1, i) == locs.at(1, i - 1) && locs.at(0,
i) == locs.at(0, i - 1)), "SpMat::SpMat(): two identical point locations in
list"); | | arma_debug_check((locs.at(1, i) == locs.at(1, i - 1) && locs.at(0,
i) == locs.at(0, i - 1)), "SpMat::SpMat(): two identical point locations in
list"); | |
| } | | } | |
|
| | | //! If sort_locations is false, then it is assumed that the locations and v | |
| | | alues | |
| | | //! are already sorted in column-major ordering. | |
| | | | |
| access::rw(values[i]) = vals[i]; | | access::rw(values[i]) = vals[i]; | |
| access::rw(row_indices[i]) = locs.at(0, i); | | access::rw(row_indices[i]) = locs.at(0, i); | |
| | | | |
| access::rw(col_ptrs[locs.at(1, i) + 1])++; | | access::rw(col_ptrs[locs.at(1, i) + 1])++; | |
| } | | } | |
| } | | } | |
| | | | |
| // Now fix the column pointers. | | // Now fix the column pointers. | |
| for (uword i = 0; i <= n_cols; ++i) | | for (uword i = 0; i <= n_cols; ++i) | |
| { | | { | |
| access::rw(col_ptrs[i + 1]) += col_ptrs[i]; | | access::rw(col_ptrs[i + 1]) += col_ptrs[i]; | |
| } | | } | |
| } | | } | |
| | | | |
|
| | | //! Insert a large number of values at once. | |
| | | //! Per CSC format, rowind_expr should be row indices, | |
| | | //! colptr_expr should column ptr indices locations, | |
| | | //! and values should be the corresponding values. | |
| | | //! In this constructor the size is explicitly given. | |
| | | //! Values are assumed to be sorted, and the size | |
| | | //! information is trusted | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2, typename T3> | |
| | | inline | |
| | | SpMat<eT>::SpMat | |
| | | ( | |
| | | const Base<uword,T1>& rowind_expr, | |
| | | const Base<uword,T2>& colptr_expr, | |
| | | const Base<eT, T3>& values_expr, | |
| | | const uword in_n_rows, | |
| | | const uword in_n_cols | |
| | | ) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem(0) | |
| | | , n_nonzero(0) | |
| | | , vec_state(0) | |
| | | , values(NULL) | |
| | | , row_indices(NULL) | |
| | | , col_ptrs(NULL) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | init(in_n_rows, in_n_cols); | |
| | | | |
| | | const unwrap<T1> rowind_tmp( rowind_expr.get_ref() ); | |
| | | const unwrap<T2> colptr_tmp( colptr_expr.get_ref() ); | |
| | | const unwrap<T3> vals_tmp( values_expr.get_ref() ); | |
| | | | |
| | | const Mat<uword>& rowind = rowind_tmp.M; | |
| | | const Mat<uword>& colptr = colptr_tmp.M; | |
| | | const Mat<eT>& vals = vals_tmp.M; | |
| | | | |
| | | arma_debug_check( (rowind.is_vec() == false), "SpMat::SpMat(): given 'row | |
| | | ind' object is not a vector" ); | |
| | | arma_debug_check( (colptr.is_vec() == false), "SpMat::SpMat(): given 'col | |
| | | ptr' object is not a vector" ); | |
| | | arma_debug_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'val | |
| | | ues' object is not a vector" ); | |
| | | | |
| | | arma_debug_check( (rowind.n_elem != vals.n_elem), "SpMat::SpMat(): number | |
| | | of row indices is not equal to number of values" ); | |
| | | arma_debug_check( (colptr.n_elem != (n_cols+1) ), "SpMat::SpMat(): number | |
| | | of column pointers is not equal to n_cols+1" ); | |
| | | | |
| | | // Resize to correct number of elements (this also sets n_nonzero) | |
| | | mem_resize(vals.n_elem); | |
| | | | |
| | | // copy supplied values into sparse matrix -- not checked for consistency | |
| | | arrayops::copy(access::rwp(row_indices), rowind.memptr(), rowind.n_elem ) | |
| | | ; | |
| | | arrayops::copy(access::rwp(col_ptrs), colptr.memptr(), colptr.n_elem ) | |
| | | ; | |
| | | arrayops::copy(access::rwp(values), vals.memptr(), vals.n_elem ) | |
| | | ; | |
| | | | |
| | | // important: set the sentinel as well | |
| | | access::rw(col_ptrs[n_cols + 1]) = std::numeric_limits<uword>::max(); | |
| | | } | |
| | | | |
| /** | | /** | |
| * Simple operators with plain values. These operate on every value in the | | * Simple operators with plain values. These operate on every value in the | |
| * matrix, so a sparse matrix += 1 will turn all those zeroes into ones. B
e | | * matrix, so a sparse matrix += 1 will turn all those zeroes into ones. B
e | |
| * careful and make sure that's what you really want! | | * careful and make sure that's what you really want! | |
| */ | | */ | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const SpMat<eT>& | | const SpMat<eT>& | |
| SpMat<eT>::operator=(const eT val) | | SpMat<eT>::operator=(const eT val) | |
| { | | { | |
| | | | |
| skipping to change at line 3100 | | skipping to change at line 3159 | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| SpMat<eT>::reset() | | SpMat<eT>::reset() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| set_size(0, 0); | | switch(vec_state) | |
| | | { | |
| | | default: | |
| | | init(0, 0); | |
| | | break; | |
| | | | |
| | | case 1: | |
| | | init(0, 1); | |
| | | break; | |
| | | | |
| | | case 2: | |
| | | init(1, 0); | |
| | | break; | |
| | | } | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Get the minimum or the maximum of the matrix. | | * Get the minimum or the maximum of the matrix. | |
| */ | | */ | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| arma_warn_unused | | arma_warn_unused | |
| eT | | eT | |
| SpMat<eT>::min() const | | SpMat<eT>::min() const | |
| | | | |
| skipping to change at line 3634 | | skipping to change at line 3706 | |
| access::rw(row_indices[0]) = 0; | | access::rw(row_indices[0]) = 0; | |
| | | | |
| memory::release(col_ptrs); | | memory::release(col_ptrs); | |
| | | | |
| // Set the new size accordingly. | | // Set the new size accordingly. | |
| access::rw(n_rows) = in_rows; | | access::rw(n_rows) = in_rows; | |
| access::rw(n_cols) = in_cols; | | access::rw(n_cols) = in_cols; | |
| access::rw(n_elem) = (in_rows * in_cols); | | access::rw(n_elem) = (in_rows * in_cols); | |
| access::rw(n_nonzero) = 0; | | access::rw(n_nonzero) = 0; | |
| | | | |
|
| // Try to allocate the column pointers, filling them with 0, except for t | | // Try to allocate the column pointers, filling them with 0, | |
| he | | // except for the last element which contains the maximum possible elemen | |
| // last element which contains the maximum possible element (so iterators | | t | |
| // terminate correctly). | | // (so iterators terminate correctly). | |
| access::rw(col_ptrs) = memory::acquire<uword>(in_cols + 2); | | access::rw(col_ptrs) = memory::acquire<uword>(in_cols + 2); | |
|
| access::rw(col_ptrs[in_cols + 1]) = std::numeric_limits<uword>::max(); | | | |
| | | | |
| arrayops::inplace_set(access::rwp(col_ptrs), uword(0), in_cols + 1); | | arrayops::inplace_set(access::rwp(col_ptrs), uword(0), in_cols + 1); | |
|
| | | | |
| | | access::rw(col_ptrs[in_cols + 1]) = std::numeric_limits<uword>::max(); | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Initialize the matrix from a string. | | * Initialize the matrix from a string. | |
| */ | | */ | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| SpMat<eT>::init(const std::string& text) | | SpMat<eT>::init(const std::string& text) | |
| { | | { | |
| | | | |
| skipping to change at line 3791 | | skipping to change at line 3864 | |
| if(n_nonzero != new_n_nonzero) | | if(n_nonzero != new_n_nonzero) | |
| { | | { | |
| if(new_n_nonzero == 0) | | if(new_n_nonzero == 0) | |
| { | | { | |
| memory::release(values); | | memory::release(values); | |
| memory::release(row_indices); | | memory::release(row_indices); | |
| | | | |
| access::rw(values) = memory::acquire_chunked<eT> (1); | | access::rw(values) = memory::acquire_chunked<eT> (1); | |
| access::rw(row_indices) = memory::acquire_chunked<uword>(1); | | access::rw(row_indices) = memory::acquire_chunked<uword>(1); | |
| | | | |
|
| access::rw(values[0]) = 0; | | access::rw( values[0]) = 0; | |
| access::rw(row_indices[0]) = 0; | | access::rw(row_indices[0]) = 0; | |
| } | | } | |
| else | | else | |
| { | | { | |
| // Figure out the actual amount of memory currently allocated | | // Figure out the actual amount of memory currently allocated | |
| // NOTE: this relies on memory::acquire_chunked() being used for the
'values' and 'row_indices' arrays | | // NOTE: this relies on memory::acquire_chunked() being used for the
'values' and 'row_indices' arrays | |
| const uword n_alloc = memory::enlarge_to_mult_of_chunksize(n_nonzero)
; | | const uword n_alloc = memory::enlarge_to_mult_of_chunksize(n_nonzero)
; | |
| | | | |
| if(n_alloc < new_n_nonzero) | | if(n_alloc < new_n_nonzero) | |
| { | | { | |
| | | | |
| skipping to change at line 3823 | | skipping to change at line 3896 | |
| | | | |
| memory::release(values); | | memory::release(values); | |
| memory::release(row_indices); | | memory::release(row_indices); | |
| | | | |
| access::rw(values) = new_values; | | access::rw(values) = new_values; | |
| access::rw(row_indices) = new_row_indices; | | access::rw(row_indices) = new_row_indices; | |
| } | | } | |
| | | | |
| // Set the "fake end" of the matrix by setting the last value and row | | // Set the "fake end" of the matrix by setting the last value and row | |
| // index to 0. This helps the iterators work correctly. | | // index to 0. This helps the iterators work correctly. | |
|
| access::rw(values[new_n_nonzero]) = 0; | | access::rw( values[new_n_nonzero]) = 0; | |
| access::rw(row_indices[new_n_nonzero]) = 0; | | access::rw(row_indices[new_n_nonzero]) = 0; | |
| } | | } | |
| | | | |
| access::rw(n_nonzero) = new_n_nonzero; | | access::rw(n_nonzero) = new_n_nonzero; | |
| } | | } | |
| } | | } | |
| | | | |
| // Steal memory from another matrix. | | // Steal memory from another matrix. | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| | | | |
| skipping to change at line 4094 | | skipping to change at line 4167 | |
| SpMat<eT>::end_row(const uword row_num) const | | SpMat<eT>::end_row(const uword row_num) const | |
| { | | { | |
| return const_row_iterator(*this, row_num + 1, 0); | | return const_row_iterator(*this, row_num + 1, 0); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| SpMat<eT>::clear() | | SpMat<eT>::clear() | |
| { | | { | |
|
| if (values) | | (*this).reset(); | |
| { | | | |
| memory::release(values); | | | |
| memory::release(row_indices); | | | |
| | | | |
| access::rw(values) = memory::acquire_chunked<eT> (1); | | | |
| access::rw(row_indices) = memory::acquire_chunked<uword>(1); | | | |
| | | | |
| access::rw(values[0]) = 0; | | | |
| access::rw(row_indices[0]) = 0; | | | |
| } | | | |
| | | | |
| memory::release(col_ptrs); | | | |
| | | | |
| access::rw(col_ptrs) = memory::acquire<uword>(n_cols + 2); | | | |
| access::rw(col_ptrs[n_cols + 1]) = std::numeric_limits<uword>::max(); | | | |
| | | | |
| arrayops::inplace_set(col_ptrs, eT(0), n_cols + 1); | | | |
| | | | |
| access::rw(n_nonzero) = 0; | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| SpMat<eT>::empty() const | | SpMat<eT>::empty() const | |
| { | | { | |
| return (n_elem == 0); | | return (n_elem == 0); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 14 change blocks. |
| 39 lines changed or deleted | | 102 lines changed or added | |
|
| eop_aux.hpp | | eop_aux.hpp | |
| | | | |
| skipping to change at line 235 | | skipping to change at line 235 | |
| template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result log (const eT x) { return std::log (x); } | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result log (const eT x) { return std::log (x); } | |
| template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result exp (const eT x) { return std::exp (x); } | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result exp (const eT x) { return std::exp (x); } | |
| template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result cos (const eT x) { return std::cos (x); } | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result cos (const eT x) { return std::cos (x); } | |
| template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result sin (const eT x) { return std::sin (x); } | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result sin (const eT x) { return std::sin (x); } | |
| template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result tan (const eT x) { return std::tan (x); } | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result tan (const eT x) { return std::tan (x); } | |
| template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result cosh (const eT x) { return std::cosh (x); } | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result cosh (const eT x) { return std::cosh (x); } | |
| template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result sinh (const eT x) { return std::sinh (x); } | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result sinh (const eT x) { return std::sinh (x); } | |
| template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result tanh (const eT x) { return std::tanh (x); } | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT
>::result tanh (const eT x) { return std::tanh (x); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_unsigned_integral_
only<eT>::result neg (const eT x) { return x; } | | template<typename eT> arma_inline static typename arma_unsigned_integral_
only<eT>::result neg (const eT x) { return x; } | |
|
| template<typename eT> arma_inline static typename arma_signed_only<eT>::r
esult neg (const eT x) { return -x; } | | template<typename eT> arma_inline static typename arma_signed_
only<eT>::result neg (const eT x) { return -x; } | |
| | | | |
|
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result floor(const eT x) { return x; | | :result floor (const eT x) { return x; | |
| } | | } | |
| template<typename eT> arma_inline static typename arma_real_only<eT>::res | | template<typename eT> arma_inline static typename arma_real_only<eT>: | |
| ult floor(const eT x) { return std::floor(x); | | :result floor (const eT x) { return std::floor(x); | |
| } | | } | |
| template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | | template<typename eT> arma_inline static typename arma_cx_only<eT>: | |
| t floor(const eT& x) { return eT( std::floor(x.real()), std::floor(x. | | :result floor (const eT& x) { return eT( std::floor(x.real()), std::floor(x | |
| imag()) ); } | | .imag()) ); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result ceil(const eT x) { return x; | | :result ceil (const eT x) { return x; | |
| } | | } | |
| template<typename eT> arma_inline static typename arma_real_only<eT>::res | | template<typename eT> arma_inline static typename arma_real_only<eT>: | |
| ult ceil(const eT x) { return std::ceil(x); | | :result ceil (const eT x) { return std::ceil(x); | |
| } | | } | |
| template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | | template<typename eT> arma_inline static typename arma_cx_only<eT>: | |
| t ceil(const eT& x) { return eT( std::ceil(x.real()), std::ceil(x.im | | :result ceil (const eT& x) { return eT( std::ceil(x.real()), std::ceil(x.i | |
| ag()) ); } | | mag()) ); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | #if defined(ARMA_USE_CXX11) | |
| :result round(const eT x) { return x; | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| } | | :result round (const eT x) { return x; | |
| template<typename eT> arma_inline static typename arma_real_only<eT>::res | | } | |
| ult round(const eT x) { return (x >= eT(0)) ? std::floor(x+0.5) : std: | | template<typename eT> arma_inline static typename arma_real_only<eT>: | |
| :ceil(x-0.5); } | | :result round (const eT x) { return std::round(x); | |
| template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | | } | |
| t round(const eT& x) { return eT( eop_aux::round(x.real()), eop_aux:: | | template<typename eT> arma_inline static typename arma_cx_only<eT>: | |
| round(x.imag()) ); } | | :result round (const eT& x) { return eT( std::round(x.real()), std::round(x | |
| | | .imag()) ); } | |
| | | #else | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| | | :result round (const eT x) { return x; | |
| | | } | |
| | | template<typename eT> arma_inline static typename arma_real_only<eT>: | |
| | | :result round (const eT x) { return (x >= eT(0)) ? std::floor(x+0.5) : std | |
| | | ::ceil(x-0.5); } | |
| | | template<typename eT> arma_inline static typename arma_cx_only<eT>: | |
| | | :result round (const eT& x) { return eT( eop_aux::round(x.real()), eop_aux: | |
| | | :round(x.imag()) ); } | |
| | | #endif | |
| | | | |
| | | #if defined(ARMA_USE_CXX11) | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT | |
| | | >::result log2 (const eT x) { return eT( std::log(double(x))/ double(0.693 | |
| | | 14718055994530942) ); } | |
| | | template<typename eT> arma_inline static typename arma_real_only<eT | |
| | | >::result log2 (const eT x) { return std::log2(x); | |
| | | } | |
| | | template<typename eT> arma_inline static typename arma_cx_only<eT | |
| | | >::result log2 (const eT& x) { typedef typename get_pod_type<eT>::result T; | |
| | | return std::log(x) / T(0.69314718055994530942); } | |
| | | #else | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT | |
| | | >::result log2 (const eT x) { return eT( std::log(double(x))/ double(0.693 | |
| | | 14718055994530942) ); } | |
| | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT | |
| | | >::result log2 (const eT x) { typedef typename get_pod_type<eT>::result T; | |
| | | return std::log(x) / T(0.69314718055994530942); } | |
| | | #endif | |
| | | | |
| | | #if defined(ARMA_USE_CXX11) | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT | |
| | | >::result exp2 (const eT x) { return eT( std::pow(double(2), double(x)) ); | |
| | | } | |
| | | template<typename eT> arma_inline static typename arma_real_only<eT | |
| | | >::result exp2 (const eT x) { return std::exp2(x); | |
| | | } | |
| | | template<typename eT> arma_inline static typename arma_cx_only<eT | |
| | | >::result exp2 (const eT& x) { typedef typename get_pod_type<eT>::result T; | |
| | | return std::pow( T(2), x); } | |
| | | #else | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT | |
| | | >::result exp2 (const eT x) { return eT( std::pow(double(2), double(x)) ); | |
| | | } | |
| | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT | |
| | | >::result exp2 (const eT x) { typedef typename get_pod_type<eT>::result T; | |
| | | return std::pow( T(2), x); } | |
| | | #endif | |
| | | | |
| | | template<typename eT> arma_inline static typename arma_integral_only<eT | |
| | | >::result exp10 (const eT x) { return eT( std::pow(double(10), double(x)) ) | |
| | | ; } | |
| | | template<typename eT> arma_inline static typename arma_real_or_cx_only<eT | |
| | | >::result exp10 (const eT x) { typedef typename get_pod_type<eT>::result T; | |
| | | return std::pow( T(10), x); } | |
| | | | |
| | | template<typename eT> arma_inline static typename arma_unsigned_integral_ | |
| | | only<eT>::result arma_abs (const eT x) { return x; | |
| | | } | |
| | | template<typename eT> arma_inline static typename arma_signed_integral_ | |
| | | only<eT>::result arma_abs (const eT x) { return std::abs(x); | |
| | | } | |
| | | template<typename eT> arma_inline static typename arma_real_ | |
| | | only<eT>::result arma_abs (const eT x) { return std::abs(x); | |
| | | } | |
| | | template<typename T> arma_inline static typename arma_real_ | |
| | | only< T>::result arma_abs (const std::complex<T>& x) { return std::abs(x); | |
| | | } | |
| | | | |
| | | template<typename eT> arma_inline static typename arma_unsigned_integral_ | |
| | | only<eT>::result sign (const eT x) { return (x > eT(0)) ? eT(+1) : eT(0); | |
| | | } | |
| | | template<typename eT> arma_inline static typename arma_signed_integral_ | |
| | | only<eT>::result sign (const eT x) { return (x > eT(0)) ? eT(+1) : ( (x < | |
| | | eT(0)) ? eT(-1) : eT(0) ); } | |
| | | template<typename eT> arma_inline static typename arma_real_ | |
| | | only<eT>::result sign (const eT x) { return (x > eT(0)) ? eT(+1) : ( (x < | |
| | | eT(0)) ? eT(-1) : eT(0) ); } | |
| | | template<typename eT> arma_inline static typename arma_cx_ | |
| | | only<eT>::result sign (const eT& x) { typedef typename eT::value_type T; re | |
| | | turn (x.real() != T(0) && x.imag() != T(0)) ? (x / std::abs(x)) : x; } | |
| | | | |
|
| template<typename eT> | | template<typename T1, typename T2> arma_inline static typename arma_int | |
| arma_inline | | egral_only<T1>::result pow (const T1 base, const T2 exponent) { return T1( | |
| static | | std::pow( double(base), double(exponent) ) ); } | |
| typename arma_integral_only<eT>::result | | template<typename T1, typename T2> arma_inline static typename arma_real_ | |
| log2 (const eT x) | | or_cx_only<T1>::result pow (const T1 base, const T2 exponent) { return std: | |
| { | | :pow(base, exponent); } | |
| return eT( std::log(double(x))/ double(0.69314718055994530942) ); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| static | | | |
| typename arma_real_or_cx_only<eT>::result | | | |
| log2 (const eT x) | | | |
| { | | | |
| typedef typename get_pod_type<eT>::result T; | | | |
| return std::log(x) / T(0.69314718055994530942); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| static | | | |
| typename arma_integral_only<eT>::result | | | |
| exp10 (const eT x) | | | |
| { | | | |
| return eT( std::pow(double(10), double(x)) ); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| static | | | |
| typename | | | |
| arma_real_or_cx_only<eT>::result | | | |
| exp10 (const eT x) | | | |
| { | | | |
| typedef typename get_pod_type<eT>::result T; | | | |
| return std::pow( T(10), x); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| static | | | |
| typename arma_integral_only<eT>::result | | | |
| exp2 (const eT x) | | | |
| { | | | |
| return eT( std::pow(double(2), double(x)) ); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| static | | | |
| typename arma_real_or_cx_only<eT>::result | | | |
| exp2 (const eT x) | | | |
| { | | | |
| typedef typename get_pod_type<eT>::result T; | | | |
| return std::pow( T(2), x); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2> | | | |
| arma_inline | | | |
| static | | | |
| typename arma_real_or_cx_only<T1>::result | | | |
| pow(const T1 base, const T2 exponent) | | | |
| { | | | |
| return std::pow(base, exponent); | | | |
| } | | | |
| | | | |
| template<typename T1, typename T2> | | | |
| arma_inline | | | |
| static | | | |
| typename arma_integral_only<T1>::result | | | |
| pow(const T1 base, const T2 exponent) | | | |
| { | | | |
| return T1( std::pow( double(base), double(exponent) ) ); | | | |
| } | | | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| static | | static | |
| typename arma_integral_only<eT>::result | | typename arma_integral_only<eT>::result | |
| direct_eps(const eT) | | direct_eps(const eT) | |
| { | | { | |
| return eT(0); | | return eT(0); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 370 | | skipping to change at line 334 | |
| { | | { | |
| //arma_extra_debug_sigprint(); | | //arma_extra_debug_sigprint(); | |
| | | | |
| //return std::pow( std::numeric_limits<T>::radix, (std::floor(std::log1
0(std::abs(x))/std::log10(std::numeric_limits<T>::radix))-(std::numeric_lim
its<T>::digits-1)) ); | | //return std::pow( std::numeric_limits<T>::radix, (std::floor(std::log1
0(std::abs(x))/std::log10(std::numeric_limits<T>::radix))-(std::numeric_lim
its<T>::digits-1)) ); | |
| | | | |
| const T radix_T = T(std::numeric_limits<T>::radix); | | const T radix_T = T(std::numeric_limits<T>::radix); | |
| const T digits_m1_T = T(std::numeric_limits<T>::digits - 1); | | const T digits_m1_T = T(std::numeric_limits<T>::digits - 1); | |
| | | | |
| return std::pow( radix_T, T(std::floor(std::log10(std::abs(x))/std::log
10(radix_T)) - digits_m1_T) ); | | return std::pow( radix_T, T(std::floor(std::log10(std::abs(x))/std::log
10(radix_T)) - digits_m1_T) ); | |
| } | | } | |
|
| | | | |
| //! work around a bug in GCC 4.4 | | | |
| template<typename eT> arma_inline static | | | |
| typename arma_unsigned_integral_only<eT>::result arma_abs(const eT x) | | | |
| { return x; } | | | |
| | | | |
| template<typename eT> arma_inline static | | | |
| typename arma_signed_integral_only<eT>::result arma_abs(const eT x) | | | |
| { return std::abs(x); } | | | |
| | | | |
| template<typename eT> arma_inline static | | | |
| typename arma_real_only<eT>::result arma_abs(const eT x) | | | |
| { return std::abs(x); } | | | |
| | | | |
| template<typename T> arma_inline static | | | |
| typename arma_real_only<T>::result arma_abs(const std::comp | | | |
| lex<T> x) { return std::abs(x); } | | | |
| | | | |
| }; | | }; | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 4 change blocks. |
| 123 lines changed or deleted | | 119 lines changed or added | |
|
| op_resize_meat.hpp | | op_resize_meat.hpp | |
|
| // Copyright (C) 2011 Conrad Sanderson | | // Copyright (C) 2011-2013 Conrad Sanderson | |
| // Copyright (C) 2011 NICTA (www.nicta.com.au) | | // Copyright (C) 2011-2013 NICTA (www.nicta.com.au) | |
| // | | // | |
| // 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 op_resize | | //! \addtogroup op_resize | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| | | | |
| const uword out_n_rows = in.aux_uword_a; | | const uword out_n_rows = in.aux_uword_a; | |
| const uword out_n_cols = in.aux_uword_b; | | const uword out_n_cols = in.aux_uword_b; | |
| | | | |
| const unwrap<T1> tmp(in.m); | | const unwrap<T1> tmp(in.m); | |
| const Mat<eT>& A = tmp.M; | | const Mat<eT>& A = tmp.M; | |
| | | | |
| 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; | |
| | | | |
|
| Mat<eT> B; | | | |
| | | | |
| const bool alias = (&actual_out == &A); | | const bool alias = (&actual_out == &A); | |
| | | | |
|
| | | if( alias && (A_n_rows == out_n_rows) && (A_n_cols == out_n_cols) ) | |
| | | { | |
| | | return; | |
| | | } | |
| | | | |
| | | Mat<eT> B; | |
| Mat<eT>& out = alias ? B : actual_out; | | Mat<eT>& out = alias ? B : actual_out; | |
| | | | |
| out.set_size(out_n_rows, out_n_cols); | | out.set_size(out_n_rows, out_n_cols); | |
| | | | |
| if( (out_n_rows > A_n_rows) || (out_n_cols > A_n_cols) ) | | if( (out_n_rows > A_n_rows) || (out_n_cols > A_n_cols) ) | |
| { | | { | |
| out.zeros(); | | out.zeros(); | |
| } | | } | |
| | | | |
| if( (out.n_elem > 0) && (A.n_elem > 0) ) | | if( (out.n_elem > 0) && (A.n_elem > 0) ) | |
| | | | |
| skipping to change at line 54 | | skipping to change at line 58 | |
| const uword end_row = (std::min)(out_n_rows, A_n_rows) - 1; | | const uword end_row = (std::min)(out_n_rows, A_n_rows) - 1; | |
| const uword end_col = (std::min)(out_n_cols, A_n_cols) - 1; | | const uword end_col = (std::min)(out_n_cols, A_n_cols) - 1; | |
| | | | |
| out.submat(0, 0, end_row, end_col) = A.submat(0, 0, end_row, end_col); | | out.submat(0, 0, end_row, end_col) = A.submat(0, 0, end_row, end_col); | |
| } | | } | |
| | | | |
| if(alias) | | if(alias) | |
| { | | { | |
| actual_out.steal_mem(B); | | actual_out.steal_mem(B); | |
| } | | } | |
|
| | | | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| op_resize::apply(Cube<typename T1::elem_type>& actual_out, const OpCube<T1,
op_resize>& in) | | op_resize::apply(Cube<typename T1::elem_type>& actual_out, const OpCube<T1,
op_resize>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| skipping to change at line 77 | | skipping to change at line 80 | |
| const uword out_n_cols = in.aux_uword_b; | | const uword out_n_cols = in.aux_uword_b; | |
| const uword out_n_slices = in.aux_uword_c; | | const uword out_n_slices = in.aux_uword_c; | |
| | | | |
| const unwrap_cube<T1> tmp(in.m); | | const unwrap_cube<T1> tmp(in.m); | |
| const Cube<eT>& A = tmp.M; | | const Cube<eT>& A = tmp.M; | |
| | | | |
| 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; | |
| const uword A_n_slices = A.n_slices; | | const uword A_n_slices = A.n_slices; | |
| | | | |
|
| Cube<eT> B; | | | |
| | | | |
| const bool alias = (&actual_out == &A); | | const bool alias = (&actual_out == &A); | |
| | | | |
|
| | | if( alias && (A_n_rows == out_n_rows) && (A_n_cols == out_n_cols) && (A_n | |
| | | _slices == out_n_slices) ) | |
| | | { | |
| | | return; | |
| | | } | |
| | | | |
| | | Cube<eT> B; | |
| Cube<eT>& out = alias ? B : actual_out; | | Cube<eT>& out = alias ? B : actual_out; | |
| | | | |
| out.set_size(out_n_rows, out_n_cols, out_n_slices); | | out.set_size(out_n_rows, out_n_cols, out_n_slices); | |
| | | | |
| if( (out_n_rows > A_n_rows) || (out_n_cols > A_n_cols) || (out_n_slices >
A_n_slices) ) | | if( (out_n_rows > A_n_rows) || (out_n_cols > A_n_cols) || (out_n_slices >
A_n_slices) ) | |
| { | | { | |
| out.zeros(); | | out.zeros(); | |
| } | | } | |
| | | | |
| if( (out.n_elem > 0) && (A.n_elem > 0) ) | | if( (out.n_elem > 0) && (A.n_elem > 0) ) | |
| | | | |
| skipping to change at line 103 | | skipping to change at line 110 | |
| const uword end_col = (std::min)(out_n_cols, A_n_cols) - 1; | | const uword end_col = (std::min)(out_n_cols, A_n_cols) - 1; | |
| const uword end_slice = (std::min)(out_n_slices, A_n_slices) - 1; | | const uword end_slice = (std::min)(out_n_slices, A_n_slices) - 1; | |
| | | | |
| out.subcube(0, 0, 0, end_row, end_col, end_slice) = A.subcube(0, 0, 0,
end_row, end_col, end_slice); | | out.subcube(0, 0, 0, end_row, end_col, end_slice) = A.subcube(0, 0, 0,
end_row, end_col, end_slice); | |
| } | | } | |
| | | | |
| if(alias) | | if(alias) | |
| { | | { | |
| actual_out.steal_mem(B); | | actual_out.steal_mem(B); | |
| } | | } | |
|
| | | | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 7 change blocks. |
| 8 lines changed or deleted | | 15 lines changed or added | |
|
| subview_bones.hpp | | subview_bones.hpp | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| const uword n_elem; | | const uword n_elem; | |
| | | | |
| protected: | | protected: | |
| | | | |
| arma_inline subview(const Mat<eT>& in_m, const uword in_row1, const uword
in_col1, const uword in_n_rows, const uword in_n_cols); | | arma_inline subview(const Mat<eT>& in_m, const uword in_row1, const uword
in_col1, const uword in_n_rows, const uword in_n_cols); | |
| | | | |
| public: | | public: | |
| | | | |
| inline ~subview(); | | inline ~subview(); | |
| | | | |
|
| | | inline void operator= (const eT val); | |
| inline void operator+= (const eT val); | | inline void operator+= (const eT val); | |
| inline void operator-= (const eT val); | | inline void operator-= (const eT val); | |
| inline void operator*= (const eT val); | | inline void operator*= (const eT val); | |
| inline void operator/= (const eT val); | | inline void operator/= (const eT val); | |
| | | | |
| // deliberately returning void | | // deliberately returning void | |
| template<typename T1> inline void operator= (const Base<eT,T1>& x); | | template<typename T1> inline void operator= (const Base<eT,T1>& x); | |
| template<typename T1> inline void operator+= (const Base<eT,T1>& x); | | template<typename T1> inline void operator+= (const Base<eT,T1>& x); | |
| template<typename T1> inline void operator-= (const Base<eT,T1>& x); | | template<typename T1> inline void operator-= (const Base<eT,T1>& x); | |
| template<typename T1> inline void operator%= (const Base<eT,T1>& x); | | template<typename T1> inline void operator%= (const Base<eT,T1>& x); | |
| | | | |
| skipping to change at line 186 | | skipping to change at line 187 | |
| 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; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = true; | | static const bool is_col = true; | |
| | | | |
| const eT* colmem; | | const eT* colmem; | |
| | | | |
| inline void operator= (const subview<eT>& x); | | inline void operator= (const subview<eT>& x); | |
| inline void operator= (const subview_col& x); | | inline void operator= (const subview_col& x); | |
|
| | | inline void operator= (const eT val); | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline void operator= (const Base<eT,T1>& x); | | inline void operator= (const Base<eT,T1>& x); | |
| | | | |
| arma_inline const Op<subview_col<eT>,op_htrans> t() const; | | arma_inline const Op<subview_col<eT>,op_htrans> t() const; | |
| arma_inline const Op<subview_col<eT>,op_htrans> ht() const; | | arma_inline const Op<subview_col<eT>,op_htrans> ht() const; | |
| arma_inline const Op<subview_col<eT>,op_strans> st() const; | | arma_inline const Op<subview_col<eT>,op_strans> st() const; | |
| | | | |
|
| | | inline void fill(const eT val); | |
| | | inline void zeros(); | |
| | | inline void ones(); | |
| | | | |
| arma_inline eT at_alt (const uword i) const; | | arma_inline eT at_alt (const uword i) const; | |
| | | | |
| arma_inline eT& operator[](const uword i); | | arma_inline eT& operator[](const uword i); | |
| arma_inline eT operator[](const uword i) const; | | arma_inline eT operator[](const uword i) const; | |
| | | | |
| inline eT& operator()(const uword i); | | inline eT& operator()(const uword i); | |
| inline eT operator()(const uword i) const; | | inline eT operator()(const uword i) const; | |
| | | | |
| inline eT& operator()(const uword in_row, const uword in_col); | | inline eT& operator()(const uword in_row, const uword in_col); | |
| inline eT operator()(const uword in_row, const uword in_col) const; | | inline eT operator()(const uword in_row, const uword in_col) const; | |
| | | | |
| skipping to change at line 246 | | skipping to change at line 252 | |
| 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; | |
| | | | |
| static const bool is_row = true; | | static const bool is_row = true; | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| | | | |
| inline void operator= (const subview<eT>& x); | | inline void operator= (const subview<eT>& x); | |
| inline void operator= (const subview_row& x); | | inline void operator= (const subview_row& x); | |
|
| | | inline void operator= (const eT val); | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline void operator= (const Base<eT,T1>& x); | | inline void operator= (const Base<eT,T1>& x); | |
| | | | |
| arma_inline const Op<subview_row<eT>,op_htrans> t() const; | | arma_inline const Op<subview_row<eT>,op_htrans> t() const; | |
| arma_inline const Op<subview_row<eT>,op_htrans> ht() const; | | arma_inline const Op<subview_row<eT>,op_htrans> ht() const; | |
| arma_inline const Op<subview_row<eT>,op_strans> st() const; | | arma_inline const Op<subview_row<eT>,op_strans> st() const; | |
| | | | |
| inline eT at_alt (const uword i) const; | | inline eT at_alt (const uword i) const; | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 0 lines changed or deleted | | 7 lines changed or added | |
|
| subview_meat.hpp | | subview_meat.hpp | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| , n_rows(in_n_rows) | | , n_rows(in_n_rows) | |
| , n_cols(in_n_cols) | | , n_cols(in_n_cols) | |
| , n_elem(in_n_rows*in_n_cols) | | , n_elem(in_n_rows*in_n_cols) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
|
| | | subview<eT>::operator= (const eT val) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | if(n_elem != 1) | |
| | | { | |
| | | arma_debug_assert_same_size(n_rows, n_cols, 1, 1, "copy into submatrix" | |
| | | ); | |
| | | } | |
| | | | |
| | | Mat<eT>& X = const_cast< Mat<eT>& >(m); | |
| | | | |
| | | X.at(aux_row1, aux_col1) = val; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | void | |
| subview<eT>::operator+= (const eT val) | | subview<eT>::operator+= (const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const uword local_n_cols = n_cols; | | const uword local_n_cols = n_cols; | |
| const uword local_n_rows = n_rows; | | const uword local_n_rows = n_rows; | |
| | | | |
| if(local_n_rows == 1) | | if(local_n_rows == 1) | |
| { | | { | |
| Mat<eT>& X = const_cast< Mat<eT>& >(m); | | Mat<eT>& X = const_cast< Mat<eT>& >(m); | |
| | | | |
| skipping to change at line 1146 | | skipping to change at line 1163 | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::zeros() | | subview<eT>::zeros() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| (*this).fill(eT(0)); | | const uword local_n_cols = n_cols; | |
| | | const uword local_n_rows = n_rows; | |
| | | | |
| | | if(local_n_rows == 1) | |
| | | { | |
| | | (*this).fill(eT(0)); | |
| | | } | |
| | | else | |
| | | { | |
| | | for(uword ucol=0; ucol < local_n_cols; ++ucol) | |
| | | { | |
| | | arrayops::fill_zeros( colptr(ucol), local_n_rows ); | |
| | | } | |
| | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::ones() | | subview<eT>::ones() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| (*this).fill(eT(1)); | | (*this).fill(eT(1)); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::eye() | | subview<eT>::eye() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| fill(eT(0)); | | (*this).zeros(); | |
| | | | |
| const uword N = (std::min)(n_rows, n_cols); | | const uword N = (std::min)(n_rows, n_cols); | |
| | | | |
| for(uword ii=0; ii < N; ++ii) | | for(uword ii=0; ii < N; ++ii) | |
| { | | { | |
| at(ii,ii) = eT(1); | | at(ii,ii) = eT(1); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| | | | |
| skipping to change at line 2262 | | skipping to change at line 2292 | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_col<eT>::operator=(const subview<eT>& X) | | subview_col<eT>::operator=(const subview<eT>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); | | subview<eT>::operator=(X); | |
|
| | | | |
| access::rw(colmem) = subview<eT>::colptr(0); | | | |
| | | | |
| arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible | | | |
| dimensions" ); | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_col<eT>::operator=(const subview_col<eT>& X) | | subview_col<eT>::operator=(const subview_col<eT>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); // interprets 'subview_col' as 'subview' | | subview<eT>::operator=(X); // interprets 'subview_col' as 'subview' | |
|
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | void | |
| | | subview_col<eT>::operator=(const eT val) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
|
| access::rw(colmem) = subview<eT>::colptr(0); | | if(subview<eT>::n_elem != 1) | |
| | | { | |
| | | arma_debug_assert_same_size(subview<eT>::n_rows, subview<eT>::n_cols, 1 | |
| | | , 1, "copy into submatrix"); | |
| | | } | |
| | | | |
|
| arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible
dimensions" ); | | access::rw( colmem[0] ) = val; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_col<eT>::operator=(const Base<eT,T1>& X) | | subview_col<eT>::operator=(const Base<eT,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); | | subview<eT>::operator=(X); | |
|
| | | | |
| access::rw(colmem) = subview<eT>::colptr(0); | | | |
| | | | |
| arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible | | | |
| dimensions" ); | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const Op<subview_col<eT>,op_htrans> | | const Op<subview_col<eT>,op_htrans> | |
| subview_col<eT>::t() const | | subview_col<eT>::t() const | |
| { | | { | |
| return Op<subview_col<eT>,op_htrans>(*this); | | return Op<subview_col<eT>,op_htrans>(*this); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 2322 | | skipping to change at line 2355 | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const Op<subview_col<eT>,op_strans> | | const Op<subview_col<eT>,op_strans> | |
| subview_col<eT>::st() const | | subview_col<eT>::st() const | |
| { | | { | |
| return Op<subview_col<eT>,op_strans>(*this); | | return Op<subview_col<eT>,op_strans>(*this); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | inline | |
| | | void | |
| | | subview_col<eT>::fill(const eT val) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arrayops::inplace_set( access::rwp(colmem), val, subview<eT>::n_rows ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | void | |
| | | subview_col<eT>::zeros() | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arrayops::fill_zeros( access::rwp(colmem), subview<eT>::n_rows ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | void | |
| | | subview_col<eT>::ones() | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arrayops::inplace_set( access::rwp(colmem), eT(1), subview<eT>::n_rows ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| arma_inline | | arma_inline | |
| eT | | eT | |
| subview_col<eT>::at_alt(const uword ii) const | | subview_col<eT>::at_alt(const uword ii) const | |
| { | | { | |
| const eT* colmem_aligned = colmem; | | const eT* colmem_aligned = colmem; | |
| memory::mark_as_aligned(colmem_aligned); | | memory::mark_as_aligned(colmem_aligned); | |
| | | | |
| return colmem_aligned[ii]; | | return colmem_aligned[ii]; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 2512 | | skipping to change at line 2575 | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_row<eT>::operator=(const subview<eT>& X) | | subview_row<eT>::operator=(const subview<eT>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); | | subview<eT>::operator=(X); | |
|
| arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible
dimensions" ); | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_row<eT>::operator=(const subview_row<eT>& X) | | subview_row<eT>::operator=(const subview_row<eT>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); // interprets 'subview_row' as 'subview' | | subview<eT>::operator=(X); // interprets 'subview_row' as 'subview' | |
|
| arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible | | } | |
| dimensions" ); | | | |
| | | template<typename eT> | |
| | | inline | |
| | | void | |
| | | subview_row<eT>::operator=(const eT val) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | subview<eT>::operator=(val); // interprets 'subview_row' as 'subview' | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_row<eT>::operator=(const Base<eT,T1>& X) | | subview_row<eT>::operator=(const Base<eT,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); | | subview<eT>::operator=(X); | |
|
| arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible
dimensions" ); | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const Op<subview_row<eT>,op_htrans> | | const Op<subview_row<eT>,op_htrans> | |
| subview_row<eT>::t() const | | subview_row<eT>::t() const | |
| { | | { | |
| return Op<subview_row<eT>,op_htrans>(*this); | | return Op<subview_row<eT>,op_htrans>(*this); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 12 change blocks. |
| 18 lines changed or deleted | | 87 lines changed or added | |
|