| Cube_meat.hpp | | Cube_meat.hpp | |
| | | | |
| skipping to change at line 1565 | | skipping to change at line 1565 | |
| //! linear element accessor (treats the cube as a vector); no bounds check | | //! linear element accessor (treats the cube as a vector); no bounds check | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| eT | | eT | |
| Cube<eT>::operator[] (const u32 i) const | | Cube<eT>::operator[] (const u32 i) const | |
| { | | { | |
| return mem[i]; | | return mem[i]; | |
| } | | } | |
| | | | |
|
| | | //! linear element accessor (treats the cube as a vector); no bounds check. | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | eT& | |
| | | Cube<eT>::at(const u32 i) | |
| | | { | |
| | | return access::rw(mem[i]); | |
| | | } | |
| | | | |
| | | //! linear element accessor (treats the cube as a vector); no bounds check | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | eT | |
| | | Cube<eT>::at(const u32 i) const | |
| | | { | |
| | | return mem[i]; | |
| | | } | |
| | | | |
| //! element accessor; bounds checking not done when ARMA_NO_DEBUG is define
d | | //! element accessor; bounds checking not done when ARMA_NO_DEBUG is define
d | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| eT& | | eT& | |
| Cube<eT>::operator() (const u32 in_row, const u32 in_col, const u32 in_slic
e) | | Cube<eT>::operator() (const u32 in_row, const u32 in_col, const u32 in_slic
e) | |
| { | | { | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| (in_row >= n_rows) || | | (in_row >= n_rows) || | |
| | | | |
| skipping to change at line 2064 | | skipping to change at line 2084 | |
| switch(type) | | switch(type) | |
| { | | { | |
| case raw_ascii: | | case raw_ascii: | |
| save_okay = diskio::save_raw_ascii(*this, name); | | save_okay = diskio::save_raw_ascii(*this, name); | |
| break; | | break; | |
| | | | |
| case arma_ascii: | | case arma_ascii: | |
| save_okay = diskio::save_arma_ascii(*this, name); | | save_okay = diskio::save_arma_ascii(*this, name); | |
| break; | | break; | |
| | | | |
|
| | | case raw_binary: | |
| | | save_okay = diskio::save_raw_binary(*this, name); | |
| | | break; | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| save_okay = diskio::save_arma_binary(*this, name); | | save_okay = diskio::save_arma_binary(*this, name); | |
| break; | | break; | |
| | | | |
| case ppm_binary: | | case ppm_binary: | |
| save_okay = diskio::save_ppm_binary(*this, name); | | save_okay = diskio::save_ppm_binary(*this, name); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_warn(print_status, "Cube::save(): unsupported file type"); | | arma_warn(print_status, "Cube::save(): unsupported file type"); | |
| | | | |
| skipping to change at line 2102 | | skipping to change at line 2126 | |
| switch(type) | | switch(type) | |
| { | | { | |
| case raw_ascii: | | case raw_ascii: | |
| save_okay = diskio::save_raw_ascii(*this, os); | | save_okay = diskio::save_raw_ascii(*this, os); | |
| break; | | break; | |
| | | | |
| case arma_ascii: | | case arma_ascii: | |
| save_okay = diskio::save_arma_ascii(*this, os); | | save_okay = diskio::save_arma_ascii(*this, os); | |
| break; | | break; | |
| | | | |
|
| | | case raw_binary: | |
| | | save_okay = diskio::save_raw_binary(*this, os); | |
| | | break; | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| save_okay = diskio::save_arma_binary(*this, os); | | save_okay = diskio::save_arma_binary(*this, os); | |
| break; | | break; | |
| | | | |
| case ppm_binary: | | case ppm_binary: | |
| save_okay = diskio::save_ppm_binary(*this, os); | | save_okay = diskio::save_ppm_binary(*this, os); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_warn(print_status, "Cube::save(): unsupported file type"); | | arma_warn(print_status, "Cube::save(): unsupported file type"); | |
| | | | |
| skipping to change at line 2145 | | skipping to change at line 2173 | |
| break; | | break; | |
| | | | |
| case raw_ascii: | | case raw_ascii: | |
| load_okay = diskio::load_raw_ascii(*this, name, err_msg); | | load_okay = diskio::load_raw_ascii(*this, name, err_msg); | |
| break; | | break; | |
| | | | |
| case arma_ascii: | | case arma_ascii: | |
| load_okay = diskio::load_arma_ascii(*this, name, err_msg); | | load_okay = diskio::load_arma_ascii(*this, name, err_msg); | |
| break; | | break; | |
| | | | |
|
| | | case raw_binary: | |
| | | load_okay = diskio::load_raw_binary(*this, name, err_msg); | |
| | | break; | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| load_okay = diskio::load_arma_binary(*this, name, err_msg); | | load_okay = diskio::load_arma_binary(*this, name, err_msg); | |
| break; | | break; | |
| | | | |
| case ppm_binary: | | case ppm_binary: | |
| load_okay = diskio::load_ppm_binary(*this, name, err_msg); | | load_okay = diskio::load_ppm_binary(*this, name, err_msg); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_warn(print_status, "Cube::load(): unsupported file type"); | | arma_warn(print_status, "Cube::load(): unsupported file type"); | |
| | | | |
| skipping to change at line 2203 | | skipping to change at line 2235 | |
| break; | | break; | |
| | | | |
| case raw_ascii: | | case raw_ascii: | |
| load_okay = diskio::load_raw_ascii(*this, is, err_msg); | | load_okay = diskio::load_raw_ascii(*this, is, err_msg); | |
| break; | | break; | |
| | | | |
| case arma_ascii: | | case arma_ascii: | |
| load_okay = diskio::load_arma_ascii(*this, is, err_msg); | | load_okay = diskio::load_arma_ascii(*this, is, err_msg); | |
| break; | | break; | |
| | | | |
|
| | | case raw_binary: | |
| | | load_okay = diskio::load_raw_binary(*this, is, err_msg); | |
| | | break; | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| load_okay = diskio::load_arma_binary(*this, is, err_msg); | | load_okay = diskio::load_arma_binary(*this, is, err_msg); | |
| break; | | break; | |
| | | | |
| case ppm_binary: | | case ppm_binary: | |
| load_okay = diskio::load_ppm_binary(*this, is, err_msg); | | load_okay = diskio::load_ppm_binary(*this, is, err_msg); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_warn(print_status, "Cube::load(): unsupported file type"); | | arma_warn(print_status, "Cube::load(): unsupported file type"); | |
| | | | |
End of changes. 5 change blocks. |
| 0 lines changed or deleted | | 36 lines changed or added | |
|
| Cube_proto.hpp | | Cube_proto.hpp | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 149 | |
| | | | |
| template<typename T1, typename T2, typename glue_type> inline
Cube(const mtGlueCube<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline
Cube(const mtGlueCube<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Cube&
operator=(const mtGlueCube<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Cube&
operator=(const mtGlueCube<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Cube&
operator+=(const mtGlueCube<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Cube&
operator+=(const mtGlueCube<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Cube&
operator-=(const mtGlueCube<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Cube&
operator-=(const mtGlueCube<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Cube&
operator%=(const mtGlueCube<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Cube&
operator%=(const mtGlueCube<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Cube&
operator/=(const mtGlueCube<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Cube&
operator/=(const mtGlueCube<eT, T1, T2, glue_type>& X); | |
| | | | |
| arma_inline arma_warn_unused eT& operator[] (const u32 i); | | arma_inline arma_warn_unused eT& operator[] (const u32 i); | |
| arma_inline arma_warn_unused eT operator[] (const u32 i) const; | | arma_inline arma_warn_unused eT operator[] (const u32 i) const; | |
|
| | | | |
| | | arma_inline arma_warn_unused eT& at(const u32 i); | |
| | | arma_inline arma_warn_unused eT at(const u32 i) const; | |
| | | | |
| arma_inline arma_warn_unused eT& operator() (const u32 i); | | arma_inline arma_warn_unused eT& operator() (const u32 i); | |
| arma_inline arma_warn_unused eT operator() (const u32 i) const; | | arma_inline arma_warn_unused eT operator() (const u32 i) const; | |
| | | | |
| arma_inline arma_warn_unused eT& at (const u32 in_row, const u32
in_col, const u32 in_slice); | | arma_inline arma_warn_unused eT& at (const u32 in_row, const u32
in_col, const u32 in_slice); | |
| arma_inline arma_warn_unused eT at (const u32 in_row, const u32
in_col, const u32 in_slice) const; | | arma_inline arma_warn_unused eT at (const u32 in_row, const u32
in_col, const u32 in_slice) const; | |
|
| | | | |
| arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u32
in_col, const u32 in_slice); | | arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u32
in_col, const u32 in_slice); | |
| arma_inline arma_warn_unused eT operator() (const u32 in_row, const u32
in_col, const u32 in_slice) const; | | arma_inline arma_warn_unused eT operator() (const u32 in_row, const u32
in_col, const u32 in_slice) const; | |
| | | | |
| arma_inline const Cube& operator++(); | | arma_inline const Cube& operator++(); | |
| arma_inline void operator++(int); | | arma_inline void operator++(int); | |
| | | | |
| arma_inline const Cube& operator--(); | | arma_inline const Cube& operator--(); | |
| arma_inline void operator--(int); | | arma_inline void operator--(int); | |
| | | | |
| arma_inline arma_warn_unused bool is_finite() const; | | arma_inline arma_warn_unused bool is_finite() const; | |
| arma_inline arma_warn_unused bool is_empty() const; | | arma_inline arma_warn_unused bool is_empty() const; | |
| | | | |
|
| | | // TODO: expand .in_range() to handle ranges specified by span | |
| arma_inline arma_warn_unused bool in_range(const u32 i) const; | | arma_inline arma_warn_unused bool in_range(const u32 i) const; | |
| arma_inline arma_warn_unused bool in_range(const u32 in_row, const u32 in
_col, const u32 in_slice) const; | | arma_inline arma_warn_unused bool in_range(const u32 in_row, const u32 in
_col, const u32 in_slice) const; | |
| | | | |
| arma_inline arma_warn_unused eT* memptr(); | | arma_inline arma_warn_unused eT* memptr(); | |
| arma_inline arma_warn_unused const eT* memptr() const; | | arma_inline arma_warn_unused const eT* memptr() const; | |
| | | | |
| arma_inline arma_warn_unused eT* slice_memptr(const u32 slice); | | arma_inline arma_warn_unused eT* slice_memptr(const u32 slice); | |
| arma_inline arma_warn_unused const eT* slice_memptr(const u32 slice) cons
t; | | arma_inline arma_warn_unused const eT* slice_memptr(const u32 slice) cons
t; | |
| | | | |
| arma_inline arma_warn_unused eT* slice_colptr(const u32 in_slice, c
onst u32 in_col); | | arma_inline arma_warn_unused eT* slice_colptr(const u32 in_slice, c
onst u32 in_col); | |
| | | | |
End of changes. 3 change blocks. |
| 0 lines changed or deleted | | 6 lines changed or added | |
|
| Mat_meat.hpp | | Mat_meat.hpp | |
| | | | |
| skipping to change at line 967 | | skipping to change at line 967 | |
| Mat<eT>::operator/=(const diagview<eT>& X) | | Mat<eT>::operator/=(const diagview<eT>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| diagview<eT>::div_inplace(*this, X); | | diagview<eT>::div_inplace(*this, X); | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | template<typename T1> | |
| | | inline | |
| | | Mat<eT>::Mat(const subview_elem1<eT,T1>& X) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem(0) | |
| | | , vec_state(0) | |
| | | , mem_state(0) | |
| | | //, mem(0) | |
| | | , mem(mem) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | this->operator=(X); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator=(const subview_elem1<eT,T1>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | subview_elem1<eT,T1>::extract(*this, X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator+=(const subview_elem1<eT,T1>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | subview_elem1<eT,T1>::plus_inplace(*this, X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator-=(const subview_elem1<eT,T1>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | subview_elem1<eT,T1>::minus_inplace(*this, X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator*=(const subview_elem1<eT,T1>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | glue_times::apply_inplace(*this, X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator%=(const subview_elem1<eT,T1>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | subview_elem1<eT,T1>::schur_inplace(*this, X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1> | |
| | | inline | |
| | | const Mat<eT>& | |
| | | Mat<eT>::operator/=(const subview_elem1<eT,T1>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | subview_elem1<eT,T1>::div_inplace(*this, X); | |
| | | | |
| | | return *this; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| inline | | inline | |
| mat_injector< Mat<eT> > | | mat_injector< Mat<eT> > | |
| Mat<eT>::operator<<(const eT val) | | Mat<eT>::operator<<(const eT val) | |
| { | | { | |
| return mat_injector< Mat<eT> >(*this, val); | | return mat_injector< Mat<eT> >(*this, val); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| mat_injector< Mat<eT> > | | mat_injector< Mat<eT> > | |
| | | | |
| skipping to change at line 990 | | skipping to change at line 1085 | |
| } | | } | |
| | | | |
| //! creation of subview (row vector) | | //! creation of subview (row vector) | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| subview_row<eT> | | subview_row<eT> | |
| Mat<eT>::row(const u32 row_num) | | Mat<eT>::row(const u32 row_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" ); | | arma_debug_check( row_num >= n_rows, "Mat::row(): out of bounds" ); | |
| | | | |
| return subview_row<eT>(*this, row_num); | | return subview_row<eT>(*this, row_num); | |
| } | | } | |
| | | | |
| //! creation of subview (row vector) | | //! creation of subview (row vector) | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const subview_row<eT> | | const subview_row<eT> | |
| Mat<eT>::row(const u32 row_num) const | | Mat<eT>::row(const u32 row_num) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_check( row_num >= n_rows, "Mat::row(): row out of bounds" ); | | arma_debug_check( row_num >= n_rows, "Mat::row(): out of bounds" ); | |
| | | | |
| | | return subview_row<eT>(*this, row_num); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview_row<eT> | |
| | | Mat<eT>::operator()(const u32 row_num, const span_helper) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check( (row_num >= n_rows), "Mat::operator(): row out of bound | |
| | | s" ); | |
| | | | |
| | | return subview_row<eT>(*this, row_num); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview_row<eT> | |
| | | Mat<eT>::operator()(const u32 row_num, const span_helper) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check( (row_num >= n_rows), "Mat::operator(): row out of bound | |
| | | s" ); | |
| | | | |
| return subview_row<eT>(*this, row_num); | | return subview_row<eT>(*this, row_num); | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview_row<eT> | |
| | | Mat<eT>::operator()(const u32 row_num, const span& col_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 a = col_span.a; | |
| | | const u32 b = col_span.b; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | (row_num >= n_rows) || (a > b) || (b >= n_cols), | |
| | | "Mat::operator(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview_row<eT>(*this, row_num, a, b); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview_row<eT> | |
| | | Mat<eT>::operator()(const u32 row_num, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 a = col_span.a; | |
| | | const u32 b = col_span.b; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | (row_num >= n_rows) || (a > b) || (b >= n_cols), | |
| | | "Mat::operator(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview_row<eT>(*this, row_num, a, b); | |
| | | } | |
| | | | |
| //! creation of subview (column vector) | | //! creation of subview (column vector) | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| subview_col<eT> | | subview_col<eT> | |
| Mat<eT>::col(const u32 col_num) | | Mat<eT>::col(const u32 col_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds"); | | arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds"); | |
| | | | |
| | | | |
| skipping to change at line 1034 | | skipping to change at line 1191 | |
| const subview_col<eT> | | const subview_col<eT> | |
| Mat<eT>::col(const u32 col_num) const | | Mat<eT>::col(const u32 col_num) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds"); | | arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds"); | |
| | | | |
| return subview_col<eT>(*this, col_num); | | return subview_col<eT>(*this, col_num); | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview_col<eT> | |
| | | Mat<eT>::operator()(const span_helper, const u32 col_num) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check( col_num >= n_cols, "Mat::operator(): column out of boun | |
| | | ds"); | |
| | | | |
| | | return subview_col<eT>(*this, col_num); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview_col<eT> | |
| | | Mat<eT>::operator()(const span_helper, const u32 col_num) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | arma_debug_check( col_num >= n_cols, "Mat::operator(): column out of boun | |
| | | ds"); | |
| | | | |
| | | return subview_col<eT>(*this, col_num); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview_col<eT> | |
| | | Mat<eT>::operator()(const span& row_span, const u32 col_num) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 a = row_span.a; | |
| | | const u32 b = row_span.b; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | (col_num >= n_cols) || (a > b) || (b >= n_rows), | |
| | | "Mat::operator(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview_col<eT>(*this, col_num, a, b); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview_col<eT> | |
| | | Mat<eT>::operator()(const span& row_span, const u32 col_num) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 a = row_span.a; | |
| | | const u32 b = row_span.b; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | (col_num >= n_cols) || (a > b) || (b >= n_rows), | |
| | | "Mat::operator(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview_col<eT>(*this, col_num, a, b); | |
| | | } | |
| | | | |
| //! create a Col object which uses memory from an existing matrix object. | | //! create a Col object which uses memory from an existing matrix object. | |
| //! this approach is currently not alias safe | | //! this approach is currently not alias safe | |
| //! and does not take into account that the parent matrix object could be d
eleted. | | //! and does not take into account that the parent matrix object could be d
eleted. | |
| //! if deleted memory is accessed by the created Col object, | | //! if deleted memory is accessed by the created Col object, | |
| //! it will cause memory corruption and/or a crash | | //! it will cause memory corruption and/or a crash | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| Col<eT> | | Col<eT> | |
| Mat<eT>::unsafe_col(const u32 col_num) | | Mat<eT>::unsafe_col(const u32 col_num) | |
| { | | { | |
| | | | |
| skipping to change at line 1216 | | skipping to change at line 1435 | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (
in_col2 >= n_cols), | | (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (
in_col2 >= n_cols), | |
| "Mat::submat(): indices out of bounds or incorrectly used" | | "Mat::submat(): indices out of bounds or incorrectly used" | |
| ); | | ); | |
| | | | |
| return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2); | | return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2); | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | arma_inline | |
| | | subview<eT> | |
| | | Mat<eT>::operator()(const span& row_span, const span& col_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return submat(row_span, col_span); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const subview<eT> | |
| | | Mat<eT>::operator()(const span& row_span, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return submat(row_span, col_span); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1> | |
| | | arma_inline | |
| | | subview_elem1<eT,T1> | |
| | | Mat<eT>::elem(const Base<u32,T1>& a) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return subview_elem1<eT,T1>(*this, a); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<typename T1> | |
| | | arma_inline | |
| | | const subview_elem1<eT,T1> | |
| | | Mat<eT>::elem(const Base<u32,T1>& a) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return subview_elem1<eT,T1>(*this, a); | |
| | | } | |
| | | | |
| | | // template<typename eT> | |
| | | // template<typename T1, typename T2> | |
| | | // arma_inline | |
| | | // subview_elem2<eT,T1,T2> | |
| | | // Mat<eT>::elem(const Base<u32,T1>& a, const Base<u32,T2>& b) | |
| | | // { | |
| | | // arma_extra_debug_sigprint(); | |
| | | // | |
| | | // return subview_elem2<eT,T1,T2>(*this, a, b); | |
| | | // } | |
| | | // | |
| | | // | |
| | | // | |
| | | // template<typename eT> | |
| | | // template<typename T1, typename T2> | |
| | | // arma_inline | |
| | | // const subview_elem2<eT,T1,T2> | |
| | | // Mat<eT>::elem(const Base<u32,T1>& a, const Base<u32,T2>& b) const | |
| | | // { | |
| | | // arma_extra_debug_sigprint(); | |
| | | // | |
| | | // return subview_elem2<eT,T1,T2>(*this, a, b); | |
| | | // } | |
| | | | |
| //! creation of diagview (diagonal) | | //! creation of diagview (diagonal) | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| diagview<eT> | | diagview<eT> | |
| Mat<eT>::diag(const s32 in_id) | | Mat<eT>::diag(const s32 in_id) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const u32 row_offset = (in_id < 0) ? -in_id : 0; | | const u32 row_offset = (in_id < 0) ? -in_id : 0; | |
| const u32 col_offset = (in_id > 0) ? in_id : 0; | | const u32 col_offset = (in_id > 0) ? in_id : 0; | |
| | | | |
| skipping to change at line 2314 | | skipping to change at line 2599 | |
| //! linear element accessor (treats the matrix as a vector); no bounds chec
k | | //! linear element accessor (treats the matrix as a vector); no bounds chec
k | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| eT | | eT | |
| Mat<eT>::operator[] (const u32 i) const | | Mat<eT>::operator[] (const u32 i) const | |
| { | | { | |
| return mem[i]; | | return mem[i]; | |
| } | | } | |
| | | | |
|
| | | //! linear element accessor (treats the matrix as a vector); no bounds chec | |
| | | k. | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | eT& | |
| | | Mat<eT>::at(const u32 i) | |
| | | { | |
| | | return access::rw(mem[i]); | |
| | | } | |
| | | | |
| | | //! linear element accessor (treats the matrix as a vector); no bounds chec | |
| | | k | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | eT | |
| | | Mat<eT>::at(const u32 i) const | |
| | | { | |
| | | return mem[i]; | |
| | | } | |
| | | | |
| //! element accessor; bounds checking not done when ARMA_NO_DEBUG is define
d | | //! element accessor; bounds checking not done when ARMA_NO_DEBUG is define
d | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| eT& | | eT& | |
| Mat<eT>::operator() (const u32 in_row, const u32 in_col) | | Mat<eT>::operator() (const u32 in_row, const u32 in_col) | |
| { | | { | |
| arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::opera
tor(): out of bounds"); | | arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::opera
tor(): out of bounds"); | |
| return access::rw(mem[in_row + in_col*n_rows]); | | return access::rw(mem[in_row + in_col*n_rows]); | |
| } | | } | |
| | | | |
| skipping to change at line 2468 | | skipping to change at line 2773 | |
| //! returns true if the given index is currently in range | | //! returns true if the given index is currently in range | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| bool | | bool | |
| Mat<eT>::in_range(const u32 i) const | | Mat<eT>::in_range(const u32 i) const | |
| { | | { | |
| return (i < n_elem); | | return (i < n_elem); | |
| } | | } | |
| | | | |
|
| | | //! returns true if the given start and end indices are currently in range | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | Mat<eT>::in_range(const span& x) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 a = x.a; | |
| | | const u32 b = x.b; | |
| | | | |
| | | return ( (a <= b) && (b < n_elem) ); | |
| | | } | |
| | | | |
| //! returns true if the given location is currently in range | | //! returns true if the given location is currently in range | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| bool | | bool | |
| Mat<eT>::in_range(const u32 in_row, const u32 in_col) const | | Mat<eT>::in_range(const u32 in_row, const u32 in_col) const | |
| { | | { | |
| return ( (in_row < n_rows) && (in_col < n_cols) ); | | return ( (in_row < n_rows) && (in_col < n_cols) ); | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | Mat<eT>::in_range(const span& row_span, const u32 in_col) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 in_row1 = row_span.a; | |
| | | const u32 in_row2 = row_span.b; | |
| | | | |
| | | return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols) | |
| | | ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | Mat<eT>::in_range(const span& row_span, const span_helper) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 in_row1 = row_span.a; | |
| | | const u32 in_row2 = row_span.b; | |
| | | | |
| | | return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (n_cols > 0) ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | Mat<eT>::in_range(const u32 in_row, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 in_col1 = col_span.a; | |
| | | const u32 in_col2 = col_span.b; | |
| | | | |
| | | return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols) | |
| | | ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | Mat<eT>::in_range(const span_helper, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 in_col1 = col_span.a; | |
| | | const u32 in_col2 = col_span.b; | |
| | | | |
| | | return ( (n_rows > 0) && (in_col1 <= in_col2) && (in_col2 < n_cols) ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | Mat<eT>::in_range(const span& row_span, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 in_row1 = row_span.a; | |
| | | const u32 in_row2 = row_span.b; | |
| | | | |
| | | const u32 in_col1 = col_span.a; | |
| | | const u32 in_col2 = col_span.b; | |
| | | | |
| | | return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col1 <= in_col | |
| | | 2) && (in_col2 < n_cols) ); | |
| | | } | |
| | | | |
| //! returns a pointer to array of eTs for a specified column; no bounds che
ck | | //! returns a pointer to array of eTs for a specified column; no bounds che
ck | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| eT* | | eT* | |
| Mat<eT>::colptr(const u32 in_col) | | Mat<eT>::colptr(const u32 in_col) | |
| { | | { | |
| return & access::rw(mem[in_col*n_rows]); | | return & access::rw(mem[in_col*n_rows]); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 2993 | | skipping to change at line 3386 | |
| switch(type) | | switch(type) | |
| { | | { | |
| case raw_ascii: | | case raw_ascii: | |
| save_okay = diskio::save_raw_ascii(*this, name); | | save_okay = diskio::save_raw_ascii(*this, name); | |
| break; | | break; | |
| | | | |
| case arma_ascii: | | case arma_ascii: | |
| save_okay = diskio::save_arma_ascii(*this, name); | | save_okay = diskio::save_arma_ascii(*this, name); | |
| break; | | break; | |
| | | | |
|
| | | case raw_binary: | |
| | | save_okay = diskio::save_raw_binary(*this, name); | |
| | | break; | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| save_okay = diskio::save_arma_binary(*this, name); | | save_okay = diskio::save_arma_binary(*this, name); | |
| break; | | break; | |
| | | | |
| case pgm_binary: | | case pgm_binary: | |
| save_okay = diskio::save_pgm_binary(*this, name); | | save_okay = diskio::save_pgm_binary(*this, name); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_warn(print_status, "Mat::save(): unsupported file type"); | | arma_warn(print_status, "Mat::save(): unsupported file type"); | |
| | | | |
| skipping to change at line 3031 | | skipping to change at line 3428 | |
| switch(type) | | switch(type) | |
| { | | { | |
| case raw_ascii: | | case raw_ascii: | |
| save_okay = diskio::save_raw_ascii(*this, os); | | save_okay = diskio::save_raw_ascii(*this, os); | |
| break; | | break; | |
| | | | |
| case arma_ascii: | | case arma_ascii: | |
| save_okay = diskio::save_arma_ascii(*this, os); | | save_okay = diskio::save_arma_ascii(*this, os); | |
| break; | | break; | |
| | | | |
|
| | | case raw_binary: | |
| | | save_okay = diskio::save_raw_binary(*this, os); | |
| | | break; | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| save_okay = diskio::save_arma_binary(*this, os); | | save_okay = diskio::save_arma_binary(*this, os); | |
| break; | | break; | |
| | | | |
| case pgm_binary: | | case pgm_binary: | |
| save_okay = diskio::save_pgm_binary(*this, os); | | save_okay = diskio::save_pgm_binary(*this, os); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_warn(print_status, "Mat::save(): unsupported file type"); | | arma_warn(print_status, "Mat::save(): unsupported file type"); | |
| | | | |
| skipping to change at line 3074 | | skipping to change at line 3475 | |
| break; | | break; | |
| | | | |
| case raw_ascii: | | case raw_ascii: | |
| load_okay = diskio::load_raw_ascii(*this, name, err_msg); | | load_okay = diskio::load_raw_ascii(*this, name, err_msg); | |
| break; | | break; | |
| | | | |
| case arma_ascii: | | case arma_ascii: | |
| load_okay = diskio::load_arma_ascii(*this, name, err_msg); | | load_okay = diskio::load_arma_ascii(*this, name, err_msg); | |
| break; | | break; | |
| | | | |
|
| | | case raw_binary: | |
| | | load_okay = diskio::load_raw_binary(*this, name, err_msg); | |
| | | break; | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| load_okay = diskio::load_arma_binary(*this, name, err_msg); | | load_okay = diskio::load_arma_binary(*this, name, err_msg); | |
| break; | | break; | |
| | | | |
| case pgm_binary: | | case pgm_binary: | |
| load_okay = diskio::load_pgm_binary(*this, name, err_msg); | | load_okay = diskio::load_pgm_binary(*this, name, err_msg); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_warn(print_status, "Mat::load(): unsupported file type"); | | arma_warn(print_status, "Mat::load(): unsupported file type"); | |
| | | | |
| skipping to change at line 3132 | | skipping to change at line 3537 | |
| break; | | break; | |
| | | | |
| case raw_ascii: | | case raw_ascii: | |
| load_okay = diskio::load_raw_ascii(*this, is, err_msg); | | load_okay = diskio::load_raw_ascii(*this, is, err_msg); | |
| break; | | break; | |
| | | | |
| case arma_ascii: | | case arma_ascii: | |
| load_okay = diskio::load_arma_ascii(*this, is, err_msg); | | load_okay = diskio::load_arma_ascii(*this, is, err_msg); | |
| break; | | break; | |
| | | | |
|
| | | case raw_binary: | |
| | | load_okay = diskio::load_raw_binary(*this, is, err_msg); | |
| | | break; | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| load_okay = diskio::load_arma_binary(*this, is, err_msg); | | load_okay = diskio::load_arma_binary(*this, is, err_msg); | |
| break; | | break; | |
| | | | |
| case pgm_binary: | | case pgm_binary: | |
| load_okay = diskio::load_pgm_binary(*this, is, err_msg); | | load_okay = diskio::load_pgm_binary(*this, is, err_msg); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_warn(print_status, "Mat::load(): unsupported file type"); | | arma_warn(print_status, "Mat::load(): unsupported file type"); | |
| | | | |
End of changes. 13 change blocks. |
| 2 lines changed or deleted | | 420 lines changed or added | |
|
| Mat_proto.hpp | | Mat_proto.hpp | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 105 | |
| | | | |
| //inline explicit Mat(const diagview<eT>& X); | | //inline explicit Mat(const diagview<eT>& X); | |
| inline Mat(const diagview<eT>& X); | | inline Mat(const diagview<eT>& X); | |
| inline const Mat& operator=(const diagview<eT>& X); | | inline const Mat& operator=(const diagview<eT>& X); | |
| inline const Mat& operator+=(const diagview<eT>& X); | | inline const Mat& operator+=(const diagview<eT>& X); | |
| inline const Mat& operator-=(const diagview<eT>& X); | | inline const Mat& operator-=(const diagview<eT>& X); | |
| inline const Mat& operator*=(const diagview<eT>& X); | | inline const Mat& operator*=(const diagview<eT>& X); | |
| inline const Mat& operator%=(const diagview<eT>& X); | | inline const Mat& operator%=(const diagview<eT>& X); | |
| inline const Mat& operator/=(const diagview<eT>& X); | | inline const Mat& operator/=(const diagview<eT>& X); | |
| | | | |
|
| | | template<typename T1> inline Mat(const subview_elem1<eT | |
| | | ,T1>& X); | |
| | | template<typename T1> inline const Mat& operator= (const subview_elem1<eT | |
| | | ,T1>& X); | |
| | | template<typename T1> inline const Mat& operator+=(const subview_elem1<eT | |
| | | ,T1>& X); | |
| | | template<typename T1> inline const Mat& operator-=(const subview_elem1<eT | |
| | | ,T1>& X); | |
| | | template<typename T1> inline const Mat& operator*=(const subview_elem1<eT | |
| | | ,T1>& X); | |
| | | template<typename T1> inline const Mat& operator%=(const subview_elem1<eT | |
| | | ,T1>& X); | |
| | | template<typename T1> inline const Mat& operator/=(const subview_elem1<eT | |
| | | ,T1>& X); | |
| | | | |
| inline mat_injector<Mat> operator<<(const eT val); | | inline mat_injector<Mat> operator<<(const eT val); | |
| inline mat_injector<Mat> operator<<(const injector_helper x); | | inline mat_injector<Mat> operator<<(const injector_helper x); | |
| | | | |
| arma_inline subview_row<eT> row(const u32 row_num); | | arma_inline subview_row<eT> row(const u32 row_num); | |
| arma_inline const subview_row<eT> row(const u32 row_num) const; | | arma_inline const subview_row<eT> row(const u32 row_num) const; | |
| | | | |
|
| | | arma_inline subview_row<eT> operator()(const u32 row_num, const spa | |
| | | n_helper); | |
| | | arma_inline const subview_row<eT> operator()(const u32 row_num, const spa | |
| | | n_helper) const; | |
| | | | |
| | | arma_inline subview_row<eT> operator()(const u32 row_num, const spa | |
| | | n& col_span); | |
| | | arma_inline const subview_row<eT> operator()(const u32 row_num, const spa | |
| | | n& col_span) const; | |
| | | | |
| arma_inline subview_col<eT> col(const u32 col_num); | | arma_inline subview_col<eT> col(const u32 col_num); | |
| arma_inline const subview_col<eT> col(const u32 col_num) const; | | arma_inline const subview_col<eT> col(const u32 col_num) const; | |
| | | | |
|
| | | arma_inline subview_col<eT> operator()(const span_helper, const | |
| | | u32 col_num); | |
| | | arma_inline const subview_col<eT> operator()(const span_helper, const | |
| | | u32 col_num) const; | |
| | | | |
| | | arma_inline subview_col<eT> operator()(const span& row_span, const | |
| | | u32 col_num); | |
| | | arma_inline const subview_col<eT> operator()(const span& row_span, const | |
| | | u32 col_num) const; | |
| | | | |
| inline Col<eT> unsafe_col(const u32 col_num); | | inline Col<eT> unsafe_col(const u32 col_num); | |
| inline const Col<eT> unsafe_col(const u32 col_num) const; | | inline const Col<eT> unsafe_col(const u32 col_num) const; | |
| | | | |
| arma_inline subview<eT> rows(const u32 in_row1, const u32 in_row2); | | arma_inline subview<eT> rows(const u32 in_row1, const u32 in_row2); | |
| arma_inline const subview<eT> rows(const u32 in_row1, const u32 in_row2)
const; | | arma_inline const subview<eT> rows(const u32 in_row1, const u32 in_row2)
const; | |
| | | | |
| arma_inline subview<eT> cols(const u32 in_col1, const u32 in_col2); | | arma_inline subview<eT> cols(const u32 in_col1, const u32 in_col2); | |
| arma_inline const subview<eT> cols(const u32 in_col1, const u32 in_col2)
const; | | arma_inline const subview<eT> cols(const u32 in_col1, const u32 in_col2)
const; | |
| | | | |
| arma_inline subview<eT> submat(const u32 in_row1, const u32 in_col1
, const u32 in_row2, const u32 in_col2); | | arma_inline subview<eT> submat(const u32 in_row1, const u32 in_col1
, const u32 in_row2, const u32 in_col2); | |
| arma_inline const subview<eT> submat(const u32 in_row1, const u32 in_col1
, const u32 in_row2, const u32 in_col2) const; | | arma_inline const subview<eT> submat(const u32 in_row1, const u32 in_col1
, const u32 in_row2, const u32 in_col2) const; | |
| | | | |
|
| arma_inline subview<eT> submat(const span& row_span, const span& co | | arma_inline subview<eT> submat (const span& row_span, const span | |
| l_span); | | & col_span); | |
| arma_inline const subview<eT> submat(const span& row_span, const span& co | | arma_inline const subview<eT> submat (const span& row_span, const span | |
| l_span) const; | | & col_span) const; | |
| | | | |
| | | arma_inline subview<eT> operator()(const span& row_span, const span | |
| | | & col_span); | |
| | | arma_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<u32,T1>& a); | |
| | | template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const B | |
| | | ase<u32,T1>& a) const; | |
| | | | |
| | | // template<typename T1, typename T2> arma_inline subview_elem2<eT, | |
| | | T1,T2> submat(const Base<u32,T1>& a, const Base<u32,T2>& b); | |
| | | // template<typename T1, typename T2> arma_inline const subview_elem2<eT, | |
| | | T1,T2> submat(const Base<u32,T1>& a, const Base<u32,T2>& b) const; | |
| | | | |
| arma_inline diagview<eT> diag(const s32 in_id = 0); | | arma_inline diagview<eT> diag(const s32 in_id = 0); | |
| arma_inline const diagview<eT> diag(const s32 in_id = 0) const; | | arma_inline const diagview<eT> diag(const s32 in_id = 0) const; | |
| | | | |
| inline void swap_rows(const u32 in_row1, const u32 in_row2); | | inline void swap_rows(const u32 in_row1, const u32 in_row2); | |
| inline void swap_cols(const u32 in_col1, const u32 in_col2); | | inline void swap_cols(const u32 in_col1, const u32 in_col2); | |
| | | | |
| inline void shed_row(const u32 row_num); | | inline void shed_row(const u32 row_num); | |
| inline void shed_col(const u32 col_num); | | inline void shed_col(const u32 col_num); | |
| | | | |
| | | | |
| skipping to change at line 200 | | skipping to change at line 229 | |
| template<typename T1, typename T2, typename glue_type> inline
Mat(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline
Mat(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator+=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator+=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator-=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator-=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator%=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator%=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Mat&
operator/=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Mat&
operator/=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | | |
| arma_inline arma_warn_unused eT& operator[] (const u32 i); | | arma_inline arma_warn_unused eT& operator[] (const u32 i); | |
| arma_inline arma_warn_unused eT operator[] (const u32 i) const; | | arma_inline arma_warn_unused eT operator[] (const u32 i) const; | |
|
| | | arma_inline arma_warn_unused eT& at (const u32 i); | |
| | | arma_inline arma_warn_unused eT at (const u32 i) const; | |
| arma_inline arma_warn_unused eT& operator() (const u32 i); | | arma_inline arma_warn_unused eT& operator() (const u32 i); | |
| arma_inline arma_warn_unused eT operator() (const u32 i) const; | | arma_inline arma_warn_unused eT operator() (const u32 i) const; | |
| | | | |
| arma_inline arma_warn_unused eT& at (const u32 in_row, const u32
in_col); | | arma_inline arma_warn_unused eT& at (const u32 in_row, const u32
in_col); | |
| arma_inline arma_warn_unused eT at (const u32 in_row, const u32
in_col) const; | | arma_inline arma_warn_unused eT at (const u32 in_row, const u32
in_col) const; | |
| arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u32
in_col); | | arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u32
in_col); | |
| arma_inline arma_warn_unused eT operator() (const u32 in_row, const u32
in_col) const; | | arma_inline arma_warn_unused eT operator() (const u32 in_row, const u32
in_col) const; | |
| | | | |
| arma_inline const Mat& operator++(); | | arma_inline const Mat& operator++(); | |
| arma_inline void operator++(int); | | arma_inline void operator++(int); | |
| | | | |
| arma_inline const Mat& operator--(); | | arma_inline const Mat& operator--(); | |
| arma_inline void operator--(int); | | arma_inline void operator--(int); | |
| | | | |
| arma_inline arma_warn_unused bool is_empty() const; | | arma_inline arma_warn_unused bool is_empty() const; | |
| arma_inline arma_warn_unused bool is_vec() const; | | arma_inline arma_warn_unused bool is_vec() const; | |
| arma_inline arma_warn_unused bool is_square() const; | | arma_inline arma_warn_unused bool is_square() const; | |
| inline arma_warn_unused bool is_finite() const; | | inline arma_warn_unused bool is_finite() const; | |
| | | | |
|
| arma_inline arma_warn_unused bool in_range(const u32 i) const; | | // TODO: test and add expanded .in_range() to user documentation | |
| arma_inline arma_warn_unused bool in_range(const u32 in_row, const u32 in | | arma_inline arma_warn_unused bool in_range(const u32 i) const; | |
| _col) const; | | arma_inline arma_warn_unused bool in_range(const span& x) const; | |
| | | | |
| | | arma_inline arma_warn_unused bool in_range(const u32 in_row, co | |
| | | nst u32 in_col ) const; | |
| | | arma_inline arma_warn_unused bool in_range(const span& row_span, co | |
| | | nst u32 in_col ) const; | |
| | | arma_inline arma_warn_unused bool in_range(const span& row_span, co | |
| | | nst span_helper junk ) const; | |
| | | arma_inline arma_warn_unused bool in_range(const u32 in_row, co | |
| | | nst span& col_span) const; | |
| | | arma_inline arma_warn_unused bool in_range(const span_helper junk, co | |
| | | nst span& col_span) const; | |
| | | arma_inline arma_warn_unused bool in_range(const span& row_span, co | |
| | | nst span& col_span) const; | |
| | | | |
| arma_inline arma_warn_unused eT* colptr(const u32 in_col); | | arma_inline arma_warn_unused eT* colptr(const u32 in_col); | |
| arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const; | | arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const; | |
| | | | |
| arma_inline arma_warn_unused eT* memptr(); | | arma_inline arma_warn_unused eT* memptr(); | |
| arma_inline arma_warn_unused const eT* memptr() const; | | arma_inline arma_warn_unused const eT* memptr() const; | |
| | | | |
| inline void print(const std::string extra_text = "") const; | | inline void print(const std::string extra_text = "") const; | |
| inline void print(std::ostream& user_stream, const std::string extra_text
= "") const; | | inline void print(std::ostream& user_stream, const std::string extra_text
= "") const; | |
| | | | |
| | | | |
End of changes. 6 change blocks. |
| 7 lines changed or deleted | | 72 lines changed or added | |
|
| Proxy.hpp | | Proxy.hpp | |
| | | | |
| skipping to change at line 54 | | skipping to change at line 54 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q.memptr(); } | | arma_inline ea_type get_ea() const { return Q.memptr(); | |
| | | } | |
| | | arma_inline bool is_alias(const Mat<eT>& X) const { return (&Q == &X); | |
| | | } | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Proxy< Col<eT> > | | class Proxy< Col<eT> > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Col<eT> stored_type; | | typedef Col<eT> stored_type; | |
| | | | |
| skipping to change at line 82 | | skipping to change at line 83 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q.memptr(); } | | arma_inline ea_type get_ea() const { return Q.memptr(); | |
| | | } | |
| | | arma_inline bool is_alias(const Mat<eT>& X) const { return (&Q == &X); | |
| | | } | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Proxy< Row<eT> > | | class Proxy< Row<eT> > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Row<eT> stored_type; | | typedef Row<eT> stored_type; | |
| | | | |
| skipping to change at line 110 | | skipping to change at line 112 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q.memptr(); } | | arma_inline ea_type get_ea() const { return Q.memptr(); | |
| | | } | |
| | | arma_inline bool is_alias(const Mat<eT>& X) const { return (&Q == &X); | |
| | | } | |
| }; | | }; | |
| | | | |
| template<typename T1, typename op_type> | | template<typename T1, typename op_type> | |
| class Proxy< Op<T1, op_type> > | | class Proxy< Op<T1, op_type> > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<elem_type> stored_type; | | typedef Mat<elem_type> stored_type; | |
| | | | |
| skipping to change at line 138 | | skipping to change at line 141 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q.memptr(); } | | arma_inline ea_type get_ea() const { return Q.memp | |
| | | tr(); } | |
| | | arma_inline bool is_alias(const Mat<elem_type>&) const { return false; | |
| | | } | |
| }; | | }; | |
| | | | |
| template<typename T1, typename T2, typename glue_type> | | template<typename T1, typename T2, typename glue_type> | |
| class Proxy< Glue<T1, T2, glue_type> > | | class Proxy< Glue<T1, T2, glue_type> > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef Mat<elem_type> stored_type; | | typedef Mat<elem_type> stored_type; | |
| | | | |
| skipping to change at line 166 | | skipping to change at line 170 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q.memptr(); } | | arma_inline ea_type get_ea() const { return Q.memp | |
| | | tr(); } | |
| | | arma_inline bool is_alias(const Mat<elem_type>&) const { return false; | |
| | | } | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Proxy< subview<eT> > | | class Proxy< subview<eT> > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef subview<eT> stored_type; | | typedef subview<eT> stored_type; | |
| | | | |
| skipping to change at line 194 | | skipping to change at line 199 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q; } | | arma_inline ea_type get_ea() const { return Q; | |
| | | } | |
| | | arma_inline bool is_alias(const Mat<eT>& X) const { return (&(Q.m) == | |
| | | &X); } | |
| | | }; | |
| | | | |
| | | template<typename eT, typename T1> | |
| | | class Proxy< subview_elem1<eT,T1> > | |
| | | { | |
| | | public: | |
| | | | |
| | | typedef eT elem_type; | |
| | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| | | typedef Mat<eT> stored_type; | |
| | | typedef const eT* ea_type; | |
| | | | |
| | | arma_aligned const Mat<eT> Q; | |
| | | | |
| | | inline explicit Proxy(const subview_elem1<eT,T1>& A) | |
| | | : Q(A) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | } | |
| | | | |
| | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| | | arma_inline elem_type operator[] (const u32 i) const { r | |
| | | eturn Q[i]; } | |
| | | arma_inline elem_type at (const u32 row, const u32 col) const { r | |
| | | eturn Q.at(row, col); } | |
| | | | |
| | | arma_inline ea_type get_ea() const { return Q.memptr(); } | |
| | | arma_inline bool is_alias(const Mat<eT>&) const { return false; } | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Proxy< diagview<eT> > | | class Proxy< diagview<eT> > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; | | typedef eT elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef diagview<eT> stored_type; | | typedef diagview<eT> stored_type; | |
| | | | |
| skipping to change at line 222 | | skipping to change at line 257 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q; } | | arma_inline ea_type get_ea() const { return Q; | |
| | | } | |
| | | arma_inline bool is_alias(const Mat<eT>& X) const { return (&(Q.m) == | |
| | | &X); } | |
| }; | | }; | |
| | | | |
| template<typename T1, typename eop_type> | | template<typename T1, typename eop_type> | |
| class Proxy< eOp<T1, eop_type > > | | class Proxy< eOp<T1, eop_type > > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef eOp<T1, eop_type> stored_type; | | typedef eOp<T1, eop_type> stored_type; | |
| | | | |
| skipping to change at line 250 | | skipping to change at line 286 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.get_n_rows(); } | | arma_inline u32 get_n_rows() const { return Q.get_n_rows(); } | |
| arma_inline u32 get_n_cols() const { return Q.get_n_cols(); } | | arma_inline u32 get_n_cols() const { return Q.get_n_cols(); } | |
| arma_inline u32 get_n_elem() const { return Q.get_n_elem(); } | | arma_inline u32 get_n_elem() const { return Q.get_n_elem(); } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q; } | | arma_inline ea_type get_ea() const { return Q; | |
| | | } | |
| | | arma_inline bool is_alias(const Mat<elem_type>& X) const { return Q.P. | |
| | | is_alias(X); } | |
| }; | | }; | |
| | | | |
| template<typename T1, typename T2, typename eglue_type> | | template<typename T1, typename T2, typename eglue_type> | |
| class Proxy< eGlue<T1, T2, eglue_type > > | | class Proxy< eGlue<T1, T2, eglue_type > > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef typename T1::elem_type elem_type; | | typedef typename T1::elem_type elem_type; | |
| typedef typename get_pod_type<elem_type>::result pod_type; | | typedef typename get_pod_type<elem_type>::result pod_type; | |
| typedef eGlue<T1, T2, eglue_type> stored_type; | | typedef eGlue<T1, T2, eglue_type> stored_type; | |
| | | | |
| skipping to change at line 278 | | skipping to change at line 315 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.get_n_rows(); } | | arma_inline u32 get_n_rows() const { return Q.get_n_rows(); } | |
| arma_inline u32 get_n_cols() const { return Q.get_n_cols(); } | | arma_inline u32 get_n_cols() const { return Q.get_n_cols(); } | |
| arma_inline u32 get_n_elem() const { return Q.get_n_elem(); } | | arma_inline u32 get_n_elem() const { return Q.get_n_elem(); } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q; } | | arma_inline ea_type get_ea() const { return Q; | |
| | | } | |
| | | arma_inline bool is_alias(const Mat<elem_type>& X) const { return (Q.P | |
| | | 1.is_alias(X) || Q.P2.is_alias(X)); } | |
| }; | | }; | |
| | | | |
| template<typename out_eT, typename T1, typename op_type> | | template<typename out_eT, typename T1, typename op_type> | |
| class Proxy< mtOp<out_eT, T1, op_type> > | | class Proxy< mtOp<out_eT, T1, op_type> > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef out_eT elem_type; | | typedef out_eT elem_type; | |
| typedef typename get_pod_type<out_eT>::result pod_type; | | typedef typename get_pod_type<out_eT>::result pod_type; | |
| typedef Mat<out_eT> stored_type; | | typedef Mat<out_eT> stored_type; | |
| | | | |
| skipping to change at line 306 | | skipping to change at line 344 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row,col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row,col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q.memptr(); } | | arma_inline ea_type get_ea() const { return Q.memptr( | |
| | | ); } | |
| | | arma_inline bool is_alias(const Mat<out_eT>&) const { return false; | |
| | | } | |
| }; | | }; | |
| | | | |
| template<typename out_eT, typename T1, typename T2, typename glue_type> | | template<typename out_eT, typename T1, typename T2, typename glue_type> | |
| class Proxy< mtGlue<out_eT, T1, T2, glue_type > > | | class Proxy< mtGlue<out_eT, T1, T2, glue_type > > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef out_eT elem_type; | | typedef out_eT elem_type; | |
| typedef typename get_pod_type<out_eT>::result pod_type; | | typedef typename get_pod_type<out_eT>::result pod_type; | |
| typedef Mat<out_eT> stored_type; | | typedef Mat<out_eT> stored_type; | |
| | | | |
| skipping to change at line 334 | | skipping to change at line 373 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline u32 get_n_rows() const { return Q.n_rows; } | | arma_inline u32 get_n_rows() const { return Q.n_rows; } | |
| arma_inline u32 get_n_cols() const { return Q.n_cols; } | | arma_inline u32 get_n_cols() const { return Q.n_cols; } | |
| arma_inline u32 get_n_elem() const { return Q.n_elem; } | | arma_inline u32 get_n_elem() const { return Q.n_elem; } | |
| | | | |
| arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | | arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; } | |
| arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row,col); } | | arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row,col); } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q.memptr(); } | | arma_inline ea_type get_ea() const { return Q.memptr( | |
| | | ); } | |
| | | arma_inline bool is_alias(const Mat<out_eT>&) const { return false; | |
| | | } | |
| }; | | }; | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 11 change blocks. |
| 11 lines changed or deleted | | 75 lines changed or added | |
|
| armadillo | | armadillo | |
| | | | |
| skipping to change at line 137 | | skipping to change at line 137 | |
| | | | |
| #include "armadillo_bits/Mat_proto.hpp" | | #include "armadillo_bits/Mat_proto.hpp" | |
| #include "armadillo_bits/Col_proto.hpp" | | #include "armadillo_bits/Col_proto.hpp" | |
| #include "armadillo_bits/Row_proto.hpp" | | #include "armadillo_bits/Row_proto.hpp" | |
| #include "armadillo_bits/Cube_proto.hpp" | | #include "armadillo_bits/Cube_proto.hpp" | |
| | | | |
| #include "armadillo_bits/typedef_fixed.hpp" | | #include "armadillo_bits/typedef_fixed.hpp" | |
| | | | |
| #include "armadillo_bits/field_proto.hpp" | | #include "armadillo_bits/field_proto.hpp" | |
| #include "armadillo_bits/subview_proto.hpp" | | #include "armadillo_bits/subview_proto.hpp" | |
|
| | | #include "armadillo_bits/subview_elem1_proto.hpp" | |
| #include "armadillo_bits/subview_field_proto.hpp" | | #include "armadillo_bits/subview_field_proto.hpp" | |
| #include "armadillo_bits/subview_cube_proto.hpp" | | #include "armadillo_bits/subview_cube_proto.hpp" | |
| #include "armadillo_bits/diagview_proto.hpp" | | #include "armadillo_bits/diagview_proto.hpp" | |
| | | | |
| #include "armadillo_bits/diskio_proto.hpp" | | #include "armadillo_bits/diskio_proto.hpp" | |
| #include "armadillo_bits/wall_clock_proto.hpp" | | #include "armadillo_bits/wall_clock_proto.hpp" | |
| #include "armadillo_bits/running_stat_proto.hpp" | | #include "armadillo_bits/running_stat_proto.hpp" | |
| #include "armadillo_bits/running_stat_vec_proto.hpp" | | #include "armadillo_bits/running_stat_vec_proto.hpp" | |
| | | | |
| #include "armadillo_bits/Op_proto.hpp" | | #include "armadillo_bits/Op_proto.hpp" | |
| | | | |
| skipping to change at line 196 | | skipping to change at line 197 | |
| #include "armadillo_bits/op_pinv_proto.hpp" | | #include "armadillo_bits/op_pinv_proto.hpp" | |
| #include "armadillo_bits/op_dotext_proto.hpp" | | #include "armadillo_bits/op_dotext_proto.hpp" | |
| #include "armadillo_bits/op_flip_proto.hpp" | | #include "armadillo_bits/op_flip_proto.hpp" | |
| #include "armadillo_bits/op_princomp_proto.hpp" | | #include "armadillo_bits/op_princomp_proto.hpp" | |
| #include "armadillo_bits/op_princomp_cov_proto.hpp" | | #include "armadillo_bits/op_princomp_cov_proto.hpp" | |
| #include "armadillo_bits/op_misc_proto.hpp" | | #include "armadillo_bits/op_misc_proto.hpp" | |
| #include "armadillo_bits/op_relational_proto.hpp" | | #include "armadillo_bits/op_relational_proto.hpp" | |
| #include "armadillo_bits/op_find_proto.hpp" | | #include "armadillo_bits/op_find_proto.hpp" | |
| #include "armadillo_bits/op_chol_proto.hpp" | | #include "armadillo_bits/op_chol_proto.hpp" | |
| #include "armadillo_bits/op_cx_scalar_proto.hpp" | | #include "armadillo_bits/op_cx_scalar_proto.hpp" | |
|
| | | #include "armadillo_bits/op_trimat_proto.hpp" | |
| | | #include "armadillo_bits/op_cumsum_proto.hpp" | |
| | | | |
| #include "armadillo_bits/glue_times_proto.hpp" | | #include "armadillo_bits/glue_times_proto.hpp" | |
| #include "armadillo_bits/glue_mixed_proto.hpp" | | #include "armadillo_bits/glue_mixed_proto.hpp" | |
| #include "armadillo_bits/glue_cov_proto.hpp" | | #include "armadillo_bits/glue_cov_proto.hpp" | |
| #include "armadillo_bits/glue_cor_proto.hpp" | | #include "armadillo_bits/glue_cor_proto.hpp" | |
| #include "armadillo_bits/glue_kron_proto.hpp" | | #include "armadillo_bits/glue_kron_proto.hpp" | |
| #include "armadillo_bits/glue_cross_proto.hpp" | | #include "armadillo_bits/glue_cross_proto.hpp" | |
| #include "armadillo_bits/glue_join_proto.hpp" | | #include "armadillo_bits/glue_join_proto.hpp" | |
| #include "armadillo_bits/glue_relational_proto.hpp" | | #include "armadillo_bits/glue_relational_proto.hpp" | |
| #include "armadillo_bits/glue_solve_proto.hpp" | | #include "armadillo_bits/glue_solve_proto.hpp" | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 303 | |
| #include "armadillo_bits/fn_inv.hpp" | | #include "armadillo_bits/fn_inv.hpp" | |
| #include "armadillo_bits/fn_trace.hpp" | | #include "armadillo_bits/fn_trace.hpp" | |
| #include "armadillo_bits/fn_trans.hpp" | | #include "armadillo_bits/fn_trans.hpp" | |
| #include "armadillo_bits/fn_det.hpp" | | #include "armadillo_bits/fn_det.hpp" | |
| #include "armadillo_bits/fn_log_det.hpp" | | #include "armadillo_bits/fn_log_det.hpp" | |
| #include "armadillo_bits/fn_eig.hpp" | | #include "armadillo_bits/fn_eig.hpp" | |
| #include "armadillo_bits/fn_lu.hpp" | | #include "armadillo_bits/fn_lu.hpp" | |
| #include "armadillo_bits/fn_zeros.hpp" | | #include "armadillo_bits/fn_zeros.hpp" | |
| #include "armadillo_bits/fn_ones.hpp" | | #include "armadillo_bits/fn_ones.hpp" | |
| #include "armadillo_bits/fn_misc.hpp" | | #include "armadillo_bits/fn_misc.hpp" | |
|
| | | #include "armadillo_bits/fn_elem.hpp" | |
| #include "armadillo_bits/fn_norm.hpp" | | #include "armadillo_bits/fn_norm.hpp" | |
| #include "armadillo_bits/fn_dot.hpp" | | #include "armadillo_bits/fn_dot.hpp" | |
| #include "armadillo_bits/fn_randu.hpp" | | #include "armadillo_bits/fn_randu.hpp" | |
| #include "armadillo_bits/fn_randn.hpp" | | #include "armadillo_bits/fn_randn.hpp" | |
| #include "armadillo_bits/fn_trig.hpp" | | #include "armadillo_bits/fn_trig.hpp" | |
| #include "armadillo_bits/fn_mean.hpp" | | #include "armadillo_bits/fn_mean.hpp" | |
| #include "armadillo_bits/fn_median.hpp" | | #include "armadillo_bits/fn_median.hpp" | |
| #include "armadillo_bits/fn_stddev.hpp" | | #include "armadillo_bits/fn_stddev.hpp" | |
| #include "armadillo_bits/fn_var.hpp" | | #include "armadillo_bits/fn_var.hpp" | |
| #include "armadillo_bits/fn_sort.hpp" | | #include "armadillo_bits/fn_sort.hpp" | |
| | | | |
| skipping to change at line 336 | | skipping to change at line 340 | |
| #include "armadillo_bits/fn_flip.hpp" | | #include "armadillo_bits/fn_flip.hpp" | |
| #include "armadillo_bits/fn_as_scalar.hpp" | | #include "armadillo_bits/fn_as_scalar.hpp" | |
| #include "armadillo_bits/fn_princomp.hpp" | | #include "armadillo_bits/fn_princomp.hpp" | |
| #include "armadillo_bits/fn_princomp_cov.hpp" | | #include "armadillo_bits/fn_princomp_cov.hpp" | |
| #include "armadillo_bits/fn_cross.hpp" | | #include "armadillo_bits/fn_cross.hpp" | |
| #include "armadillo_bits/fn_join.hpp" | | #include "armadillo_bits/fn_join.hpp" | |
| #include "armadillo_bits/fn_conv.hpp" | | #include "armadillo_bits/fn_conv.hpp" | |
| #include "armadillo_bits/fn_trunc_exp.hpp" | | #include "armadillo_bits/fn_trunc_exp.hpp" | |
| #include "armadillo_bits/fn_trunc_log.hpp" | | #include "armadillo_bits/fn_trunc_log.hpp" | |
| #include "armadillo_bits/fn_toeplitz.hpp" | | #include "armadillo_bits/fn_toeplitz.hpp" | |
|
| | | #include "armadillo_bits/fn_trimat.hpp" | |
| | | #include "armadillo_bits/fn_cumsum.hpp" | |
| | | | |
| // | | // | |
| // class meat | | // class meat | |
| | | | |
| #include "armadillo_bits/gemm.hpp" | | #include "armadillo_bits/gemm.hpp" | |
| #include "armadillo_bits/gemv.hpp" | | #include "armadillo_bits/gemv.hpp" | |
| #include "armadillo_bits/gemm_mixed.hpp" | | #include "armadillo_bits/gemm_mixed.hpp" | |
| | | | |
| #include "armadillo_bits/eop_core_meat.hpp" | | #include "armadillo_bits/eop_core_meat.hpp" | |
| #include "armadillo_bits/eglue_core_meat.hpp" | | #include "armadillo_bits/eglue_core_meat.hpp" | |
| | | | |
| skipping to change at line 358 | | skipping to change at line 364 | |
| #include "armadillo_bits/auxlib_meat.hpp" | | #include "armadillo_bits/auxlib_meat.hpp" | |
| | | | |
| #include "armadillo_bits/injector_meat.hpp" | | #include "armadillo_bits/injector_meat.hpp" | |
| | | | |
| #include "armadillo_bits/Mat_meat.hpp" | | #include "armadillo_bits/Mat_meat.hpp" | |
| #include "armadillo_bits/Col_meat.hpp" | | #include "armadillo_bits/Col_meat.hpp" | |
| #include "armadillo_bits/Row_meat.hpp" | | #include "armadillo_bits/Row_meat.hpp" | |
| #include "armadillo_bits/Cube_meat.hpp" | | #include "armadillo_bits/Cube_meat.hpp" | |
| #include "armadillo_bits/field_meat.hpp" | | #include "armadillo_bits/field_meat.hpp" | |
| #include "armadillo_bits/subview_meat.hpp" | | #include "armadillo_bits/subview_meat.hpp" | |
|
| | | #include "armadillo_bits/subview_elem1_meat.hpp" | |
| #include "armadillo_bits/subview_field_meat.hpp" | | #include "armadillo_bits/subview_field_meat.hpp" | |
| #include "armadillo_bits/subview_cube_meat.hpp" | | #include "armadillo_bits/subview_cube_meat.hpp" | |
| #include "armadillo_bits/diagview_meat.hpp" | | #include "armadillo_bits/diagview_meat.hpp" | |
| | | | |
| #include "armadillo_bits/diskio_meat.hpp" | | #include "armadillo_bits/diskio_meat.hpp" | |
| #include "armadillo_bits/wall_clock_meat.hpp" | | #include "armadillo_bits/wall_clock_meat.hpp" | |
| #include "armadillo_bits/running_stat_meat.hpp" | | #include "armadillo_bits/running_stat_meat.hpp" | |
| #include "armadillo_bits/running_stat_vec_meat.hpp" | | #include "armadillo_bits/running_stat_vec_meat.hpp" | |
| | | | |
| #include "armadillo_bits/op_diagmat_meat.hpp" | | #include "armadillo_bits/op_diagmat_meat.hpp" | |
| | | | |
| skipping to change at line 397 | | skipping to change at line 404 | |
| #include "armadillo_bits/op_pinv_meat.hpp" | | #include "armadillo_bits/op_pinv_meat.hpp" | |
| #include "armadillo_bits/op_dotext_meat.hpp" | | #include "armadillo_bits/op_dotext_meat.hpp" | |
| #include "armadillo_bits/op_flip_meat.hpp" | | #include "armadillo_bits/op_flip_meat.hpp" | |
| #include "armadillo_bits/op_princomp_meat.hpp" | | #include "armadillo_bits/op_princomp_meat.hpp" | |
| #include "armadillo_bits/op_princomp_cov_meat.hpp" | | #include "armadillo_bits/op_princomp_cov_meat.hpp" | |
| #include "armadillo_bits/op_misc_meat.hpp" | | #include "armadillo_bits/op_misc_meat.hpp" | |
| #include "armadillo_bits/op_relational_meat.hpp" | | #include "armadillo_bits/op_relational_meat.hpp" | |
| #include "armadillo_bits/op_find_meat.hpp" | | #include "armadillo_bits/op_find_meat.hpp" | |
| #include "armadillo_bits/op_chol_meat.hpp" | | #include "armadillo_bits/op_chol_meat.hpp" | |
| #include "armadillo_bits/op_cx_scalar_meat.hpp" | | #include "armadillo_bits/op_cx_scalar_meat.hpp" | |
|
| | | #include "armadillo_bits/op_trimat_meat.hpp" | |
| | | #include "armadillo_bits/op_cumsum_meat.hpp" | |
| | | | |
| #include "armadillo_bits/glue_times_meat.hpp" | | #include "armadillo_bits/glue_times_meat.hpp" | |
| #include "armadillo_bits/glue_mixed_meat.hpp" | | #include "armadillo_bits/glue_mixed_meat.hpp" | |
| #include "armadillo_bits/glue_cov_meat.hpp" | | #include "armadillo_bits/glue_cov_meat.hpp" | |
| #include "armadillo_bits/glue_cor_meat.hpp" | | #include "armadillo_bits/glue_cor_meat.hpp" | |
| #include "armadillo_bits/glue_kron_meat.hpp" | | #include "armadillo_bits/glue_kron_meat.hpp" | |
| #include "armadillo_bits/glue_cross_meat.hpp" | | #include "armadillo_bits/glue_cross_meat.hpp" | |
| #include "armadillo_bits/glue_join_meat.hpp" | | #include "armadillo_bits/glue_join_meat.hpp" | |
| #include "armadillo_bits/glue_relational_meat.hpp" | | #include "armadillo_bits/glue_relational_meat.hpp" | |
| #include "armadillo_bits/glue_solve_meat.hpp" | | #include "armadillo_bits/glue_solve_meat.hpp" | |
| | | | |
End of changes. 6 change blocks. |
| 0 lines changed or deleted | | 9 lines changed or added | |
|
| debug.hpp | | debug.hpp | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| // for any purpose. You can redistribute this file | | // for any purpose. You can redistribute this file | |
| // and/or modify it under the terms of the GNU | | // and/or modify it under the terms of the GNU | |
| // Lesser General Public License (LGPL) as published | | // Lesser General Public License (LGPL) as published | |
| // by the Free Software Foundation, either version 3 | | // by the Free Software Foundation, either version 3 | |
| // of the License or (at your option) any later version. | | // of the License or (at your option) any later version. | |
| // (see http://www.opensource.org/licenses for more info) | | // (see http://www.opensource.org/licenses for more info) | |
| | | | |
| //! \addtogroup debug | | //! \addtogroup debug | |
| //! @{ | | //! @{ | |
| | | | |
|
| | | template<typename T> | |
| | | inline | |
| | | std::ostream& | |
| | | arma_log_stream(std::ostream* user_stream) | |
| | | { | |
| | | static std::ostream* log_stream = &(std::cout); | |
| | | | |
| | | if(user_stream != NULL) | |
| | | { | |
| | | log_stream = user_stream; | |
| | | } | |
| | | | |
| | | return *log_stream; | |
| | | } | |
| | | | |
| | | // TODO: add to user documentation | |
| | | inline | |
| | | void | |
| | | set_log_stream(std::ostream& user_stream) | |
| | | { | |
| | | arma_log_stream<char>(&user_stream); | |
| | | } | |
| | | | |
| | | // TODO: add to user documentation | |
| | | inline | |
| | | std::ostream& | |
| | | get_log_stream() | |
| | | { | |
| | | return arma_log_stream<char>(NULL); | |
| | | } | |
| | | | |
| // | | // | |
| // arma_stop | | // arma_stop | |
| | | | |
|
| //! print a message to std::cout and/or throw a run-time error exception | | //! print a message to get_log_stream() and/or throw a run-time error excep
tion | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| arma_cold | | arma_cold | |
| arma_stop(const T1& x) | | arma_stop(const T1& x) | |
| { | | { | |
|
| std::cerr.flush(); | | get_log_stream().flush(); | |
| std::cout.flush(); | | | |
| | | | |
|
| std::cout << '\n'; | | get_log_stream() << '\n'; | |
| std::cout << "run-time error: " << x << '\n'; | | get_log_stream() << "run-time error: " << x << '\n'; | |
| std::cout << '\n'; | | get_log_stream() << '\n'; | |
| std::cout.flush(); | | get_log_stream().flush(); | |
| | | | |
| throw std::runtime_error(""); | | throw std::runtime_error(""); | |
| } | | } | |
| | | | |
| // | | // | |
| // arma_print | | // arma_print | |
| | | | |
| inline | | inline | |
| void | | void | |
| arma_cold | | arma_cold | |
| arma_print() | | arma_print() | |
| { | | { | |
|
| std::cout << std::endl; | | get_log_stream() << std::endl; | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| arma_cold | | arma_cold | |
| arma_print(const T1& x) | | arma_print(const T1& x) | |
| { | | { | |
|
| std::cout << x << std::endl; | | get_log_stream() << x << std::endl; | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| void | | void | |
| arma_cold | | arma_cold | |
| arma_print(const T1& x, const T2& y) | | arma_print(const T1& x, const T2& y) | |
| { | | { | |
|
| std::cout << x << y << std::endl; | | get_log_stream() << x << y << std::endl; | |
| } | | } | |
| | | | |
| template<typename T1, typename T2, typename T3> | | template<typename T1, typename T2, typename T3> | |
| inline | | inline | |
| void | | void | |
| arma_cold | | arma_cold | |
| arma_print(const T1& x, const T2& y, const T3& z) | | arma_print(const T1& x, const T2& y, const T3& z) | |
| { | | { | |
|
| std::cout << x << y << z << std::endl; | | get_log_stream() << x << y << z << std::endl; | |
| } | | } | |
| | | | |
| // | | // | |
| // arma_sigprint | | // arma_sigprint | |
| | | | |
|
| //! print a message on cout, with a preceding @ character. | | //! print a message the the log stream with a preceding @ character. | |
| | | //! by default the log stream is cout. | |
| //! used for printing the signature of a function | | //! used for printing the signature of a function | |
| //! (see the arma_extra_debug_sigprint macro) | | //! (see the arma_extra_debug_sigprint macro) | |
| inline | | inline | |
| void | | void | |
| arma_sigprint(const char* x) | | arma_sigprint(const char* x) | |
| { | | { | |
|
| std::cout << "@ " << x; | | get_log_stream() << "@ " << x; | |
| } | | } | |
| | | | |
| // | | // | |
| // arma_bktprint | | // arma_bktprint | |
| | | | |
| inline | | inline | |
| void | | void | |
| arma_bktprint() | | arma_bktprint() | |
| { | | { | |
|
| std::cout << std::endl; | | get_log_stream() << std::endl; | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| arma_bktprint(const T1& x) | | arma_bktprint(const T1& x) | |
| { | | { | |
|
| std::cout << " [" << x << ']' << std::endl; | | get_log_stream() << " [" << x << ']' << std::endl; | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| void | | void | |
| arma_bktprint(const T1& x, const T2& y) | | arma_bktprint(const T1& x, const T2& y) | |
| { | | { | |
|
| std::cout << " [" << x << y << ']' << std::endl; | | get_log_stream() << " [" << x << y << ']' << std::endl; | |
| } | | } | |
| | | | |
| // | | // | |
| // arma_thisprint | | // arma_thisprint | |
| | | | |
| inline | | inline | |
| void | | void | |
| arma_thisprint(void* this_ptr) | | arma_thisprint(void* this_ptr) | |
| { | | { | |
|
| std::cout << " [this = " << this_ptr << ']' << std::endl; | | get_log_stream() << " [this = " << this_ptr << ']' << std::endl; | |
| } | | } | |
| | | | |
| // | | // | |
| // arma_warn | | // arma_warn | |
| | | | |
| //! if state is true, print a message on cout | | //! if state is true, print a message on cout | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| arma_hot | | arma_hot | |
| | | | |
| skipping to change at line 671 | | skipping to change at line 702 | |
| class arma_first_extra_debug_message | | class arma_first_extra_debug_message | |
| { | | { | |
| public: | | public: | |
| | | | |
| inline | | inline | |
| arma_cold | | arma_cold | |
| arma_first_extra_debug_message() | | arma_first_extra_debug_message() | |
| { | | { | |
| const char* nickname = ARMA_VERSION_NAME; | | const char* nickname = ARMA_VERSION_NAME; | |
| | | | |
|
| std::cout << "@ ---" << '\n'; | | get_log_stream() << "@ ---" << '\n'; | |
| std::cout << "@ Armadillo " | | get_log_stream() << "@ Armadillo " | |
| << arma_version::major << '.' << arma_version::minor << '
.' << arma_version::patch | | << arma_version::major << '.' << arma_version::minor << '
.' << arma_version::patch | |
| << " (" << nickname << ")\n"; | | << " (" << nickname << ")\n"; | |
| | | | |
|
| std::cout << "@ arma_config::atlas = " << arma_config::atlas | | get_log_stream() << "@ arma_config::atlas = " << arma_config:: | |
| << '\n'; | | atlas << '\n'; | |
| std::cout << "@ arma_config::lapack = " << arma_config::lapack | | get_log_stream() << "@ arma_config::lapack = " << arma_config:: | |
| << '\n'; | | lapack << '\n'; | |
| std::cout << "@ arma_config::blas = " << arma_config::blas | | get_log_stream() << "@ arma_config::blas = " << arma_config:: | |
| << '\n'; | | blas << '\n'; | |
| std::cout << "@ arma_config::boost = " << arma_config::boost | | get_log_stream() << "@ arma_config::boost = " << arma_config:: | |
| << '\n'; | | boost << '\n'; | |
| std::cout << "@ arma_config::boost_date = " << arma_config::boost_d | | get_log_stream() << "@ arma_config::boost_date = " << arma_config:: | |
| ate << '\n'; | | boost_date << '\n'; | |
| std::cout << "@ arma_config::good_comp = " << arma_config::good_co | | get_log_stream() << "@ arma_config::good_comp = " << arma_config:: | |
| mp << '\n'; | | good_comp << '\n'; | |
| std::cout << "@ arma_config::extra_code = " << arma_config::extra_c | | get_log_stream() << "@ arma_config::extra_code = " << arma_config:: | |
| ode << '\n'; | | extra_code << '\n'; | |
| std::cout << "@ sizeof(void*) = " << sizeof(void*) << '\n'; | | get_log_stream() << "@ sizeof(void*) = " << sizeof(void*) << | |
| std::cout << "@ sizeof(int) = " << sizeof(int) << '\n'; | | '\n'; | |
| std::cout << "@ sizeof(long) = " << sizeof(long) << '\n'; | | get_log_stream() << "@ sizeof(int) = " << sizeof(int) << | |
| std::cout << "@ sizeof(blas_int) = " << sizeof(blas_int) << '\n'; | | '\n'; | |
| std::cout << "@ ---" << std::endl; | | get_log_stream() << "@ sizeof(long) = " << sizeof(long) << | |
| | | '\n'; | |
| | | get_log_stream() << "@ sizeof(blas_int) = " << sizeof(blas_int) << | |
| | | '\n'; | |
| | | get_log_stream() << "@ ---" << std::endl; | |
| } | | } | |
| | | | |
| }; | | }; | |
| | | | |
| static arma_first_extra_debug_message arma_first_extra_debug_message_ru
n; | | static arma_first_extra_debug_message arma_first_extra_debug_message_ru
n; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 16 change blocks. |
| 38 lines changed or deleted | | 73 lines changed or added | |
|
| diskio_meat.hpp | | diskio_meat.hpp | |
| | | | |
| skipping to change at line 298 | | skipping to change at line 298 | |
| return std::string("ARMA_CUB_BIN_FC016"); | | return std::string("ARMA_CUB_BIN_FC016"); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return std::string(); | | return std::string(); | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| inline | | inline | |
|
| | | bool | |
| | | diskio::is_raw_binary(std::istream& f) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | f.clear(); | |
| | | const std::fstream::pos_type pos1 = f.tellg(); | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(0, ios::end); | |
| | | | |
| | | f.clear(); | |
| | | const std::fstream::pos_type pos2 = f.tellg(); | |
| | | | |
| | | const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos1); | |
| | | | |
| | | podarray<unsigned char> data(N); | |
| | | | |
| | | unsigned char* ptr = data.memptr(); | |
| | | | |
| | | f.clear(); | |
| | | f.read(reinterpret_cast<char*>(ptr), N); | |
| | | | |
| | | bool has_non_text_val = false; | |
| | | | |
| | | if(f.good() == true) | |
| | | { | |
| | | for(u32 i=0; i<N; ++i) | |
| | | { | |
| | | const unsigned char val = ptr[i]; | |
| | | | |
| | | // the range checking can be made more elaborate | |
| | | if( (val <= 8) || (val >= 123) ) | |
| | | { | |
| | | has_non_text_val = true; | |
| | | break; | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos1); | |
| | | | |
| | | return has_non_text_val; | |
| | | } | |
| | | | |
| | | inline | |
| char | | char | |
| diskio::conv_to_hex_char(const u8 x) | | diskio::conv_to_hex_char(const u8 x) | |
| { | | { | |
| char out; | | char out; | |
| | | | |
| switch(x) | | switch(x) | |
| { | | { | |
| case 0: out = '0'; break; | | case 0: out = '0'; break; | |
| case 1: out = '1'; break; | | case 1: out = '1'; break; | |
| case 2: out = '2'; break; | | case 2: out = '2'; break; | |
| | | | |
| skipping to change at line 403 | | skipping to change at line 453 | |
| { | | { | |
| out[x_size + extra_size + i] = tmp[i]; | | out[x_size + extra_size + i] = tmp[i]; | |
| } | | } | |
| | | | |
| return out; | | return out; | |
| } | | } | |
| | | | |
| //! Safely rename a file. | | //! Safely rename a file. | |
| //! Before renaming, test if we can write to the final file. | | //! Before renaming, test if we can write to the final file. | |
| //! This should prevent: | | //! This should prevent: | |
|
| //! (i) overwriting files that have been write protected, | | //! (i) overwriting files that are write protected, | |
| //! (ii) overwriting directories. | | //! (ii) overwriting directories. | |
| inline | | inline | |
| bool | | bool | |
| diskio::safe_rename(const std::string& old_name, const std::string& new_nam
e) | | diskio::safe_rename(const std::string& old_name, const std::string& new_nam
e) | |
| { | | { | |
| std::fstream f(new_name.c_str(), std::fstream::out | std::fstream::app); | | std::fstream f(new_name.c_str(), std::fstream::out | std::fstream::app); | |
| f.put(' '); | | f.put(' '); | |
| | | | |
| bool save_okay = f.good(); | | bool save_okay = f.good(); | |
| f.close(); | | f.close(); | |
| | | | |
| skipping to change at line 498 | | skipping to change at line 548 | |
| | | | |
| f << x.at(row,col); | | f << x.at(row,col); | |
| } | | } | |
| | | | |
| f.put('\n'); | | f.put('\n'); | |
| } | | } | |
| | | | |
| return f.good(); | | return f.good(); | |
| } | | } | |
| | | | |
|
| | | //! Save a matrix as raw binary (no header) | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | diskio::save_raw_binary(const Mat<eT>& x, const std::string& final_name) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const std::string tmp_name = diskio::gen_tmp_name(final_name); | |
| | | | |
| | | std::ofstream f(tmp_name.c_str(), std::fstream::binary); | |
| | | | |
| | | bool save_okay = f.is_open(); | |
| | | | |
| | | if(save_okay == true) | |
| | | { | |
| | | save_okay = diskio::save_raw_binary(x, f); | |
| | | | |
| | | f.flush(); | |
| | | f.close(); | |
| | | | |
| | | if(save_okay == true) | |
| | | { | |
| | | save_okay = diskio::safe_rename(tmp_name, final_name); | |
| | | } | |
| | | } | |
| | | | |
| | | return save_okay; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | diskio::save_raw_binary(const Mat<eT>& x, std::ostream& f) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | f.write(reinterpret_cast<const char*>(x.mem), x.n_elem*sizeof(eT)); | |
| | | | |
| | | return f.good(); | |
| | | } | |
| | | | |
| //! Save a matrix in text format (human readable), | | //! Save a matrix in text format (human readable), | |
| //! with a header that indicates the matrix type as well as its dimensions | | //! with a header that indicates the matrix type as well as its dimensions | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::save_arma_ascii(const Mat<eT>& x, const std::string& final_name) | | diskio::save_arma_ascii(const Mat<eT>& x, const std::string& final_name) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const std::string tmp_name = diskio::gen_tmp_name(final_name); | | const std::string tmp_name = diskio::gen_tmp_name(final_name); | |
| | | | |
| skipping to change at line 827 | | skipping to change at line 919 | |
| } | | } | |
| | | | |
| if(f.good() == false) | | if(f.good() == false) | |
| { | | { | |
| load_okay = false; | | load_okay = false; | |
| } | | } | |
| | | | |
| return load_okay; | | return load_okay; | |
| } | | } | |
| | | | |
|
| | | //! Load a matrix in binary format (no header); | |
| | | //! the matrix is assumed to have one column | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | diskio::load_raw_binary(Mat<eT>& x, const std::string& name, std::string& e | |
| | | rr_msg) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | std::ifstream f; | |
| | | f.open(name.c_str(), std::fstream::binary); | |
| | | | |
| | | bool load_okay = f.is_open(); | |
| | | | |
| | | if(load_okay == true) | |
| | | { | |
| | | load_okay = diskio::load_raw_binary(x, f, err_msg); | |
| | | f.close(); | |
| | | } | |
| | | | |
| | | return load_okay; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | diskio::load_raw_binary(Mat<eT>& x, std::istream& f, std::string& err_msg) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | arma_ignore(err_msg); | |
| | | | |
| | | f.clear(); | |
| | | const std::streampos pos1 = f.tellg(); | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(0, ios::end); | |
| | | | |
| | | f.clear(); | |
| | | const std::streampos pos2 = f.tellg(); | |
| | | | |
| | | const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0; | |
| | | | |
| | | f.clear(); | |
| | | //f.seekg(0, ios::beg); | |
| | | f.seekg(pos1); | |
| | | | |
| | | x.set_size(N / sizeof(eT), 1); | |
| | | | |
| | | f.clear(); | |
| | | f.read( reinterpret_cast<char *>(x.memptr()), N); | |
| | | | |
| | | return f.good(); | |
| | | } | |
| | | | |
| //! Load a matrix in text format (human readable), | | //! Load a matrix in text format (human readable), | |
| //! with a header that indicates the matrix type as well as its dimensions | | //! with a header that indicates the matrix type as well as its dimensions | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_arma_ascii(Mat<eT>& x, const std::string& name, std::string& e
rr_msg) | | diskio::load_arma_ascii(Mat<eT>& x, const std::string& name, std::string& e
rr_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| std::ifstream f(name.c_str()); | | std::ifstream f(name.c_str()); | |
| | | | |
| skipping to change at line 1182 | | skipping to change at line 1328 | |
| { | | { | |
| return load_arma_binary(x, f, err_msg); | | return load_arma_binary(x, f, err_msg); | |
| } | | } | |
| else | | else | |
| if(P5 == header.substr(0,P5.length())) | | if(P5 == header.substr(0,P5.length())) | |
| { | | { | |
| return load_pgm_binary(x, f, err_msg); | | return load_pgm_binary(x, f, err_msg); | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| return load_raw_ascii(x, f, err_msg); | | if(is_raw_binary(f) == true) | |
| | | { | |
| | | return load_raw_binary(x, f, err_msg); | |
| | | } | |
| | | else | |
| | | { | |
| | | return load_raw_ascii(x, f, err_msg); | |
| | | } | |
| } | | } | |
| } | | } | |
| | | | |
| // cubes | | // cubes | |
| | | | |
| //! Save a cube as raw text (no header, human readable). | | //! Save a cube as raw text (no header, human readable). | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::save_raw_ascii(const Cube<eT>& x, const std::string& final_name) | | diskio::save_raw_ascii(const Cube<eT>& x, const std::string& final_name) | |
| | | | |
| skipping to change at line 1260 | | skipping to change at line 1413 | |
| f << x.at(row,col,slice); | | f << x.at(row,col,slice); | |
| } | | } | |
| | | | |
| f.put('\n'); | | f.put('\n'); | |
| } | | } | |
| } | | } | |
| | | | |
| return f.good(); | | return f.good(); | |
| } | | } | |
| | | | |
|
| | | //! Save a cube as raw binary (no header) | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | diskio::save_raw_binary(const Cube<eT>& x, const std::string& final_name) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const std::string tmp_name = diskio::gen_tmp_name(final_name); | |
| | | | |
| | | std::ofstream f(tmp_name.c_str(), std::fstream::binary); | |
| | | | |
| | | bool save_okay = f.is_open(); | |
| | | | |
| | | if(save_okay == true) | |
| | | { | |
| | | save_okay = diskio::save_raw_binary(x, f); | |
| | | | |
| | | f.flush(); | |
| | | f.close(); | |
| | | | |
| | | if(save_okay == true) | |
| | | { | |
| | | save_okay = diskio::safe_rename(tmp_name, final_name); | |
| | | } | |
| | | } | |
| | | | |
| | | return save_okay; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | diskio::save_raw_binary(const Cube<eT>& x, std::ostream& f) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | f.write(reinterpret_cast<const char*>(x.mem), x.n_elem*sizeof(eT)); | |
| | | | |
| | | return f.good(); | |
| | | } | |
| | | | |
| //! Save a cube in text format (human readable), | | //! Save a cube in text format (human readable), | |
| //! with a header that indicates the cube type as well as its dimensions | | //! with a header that indicates the cube type as well as its dimensions | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::save_arma_ascii(const Cube<eT>& x, const std::string& final_name) | | diskio::save_arma_ascii(const Cube<eT>& x, const std::string& final_name) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const std::string tmp_name = diskio::gen_tmp_name(final_name); | | const std::string tmp_name = diskio::gen_tmp_name(final_name); | |
| | | | |
| skipping to change at line 1443 | | skipping to change at line 1638 | |
| // make sure the loaded matrix was not empty | | // make sure the loaded matrix was not empty | |
| if(x.n_slices > 0) | | if(x.n_slices > 0) | |
| { | | { | |
| x.slice(0) = tmp; | | x.slice(0) = tmp; | |
| } | | } | |
| } | | } | |
| | | | |
| return load_okay; | | return load_okay; | |
| } | | } | |
| | | | |
|
| | | //! Load a cube in binary format (no header); | |
| | | //! the cube is assumed to have one slice with one column | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | diskio::load_raw_binary(Cube<eT>& x, const std::string& name, std::string& | |
| | | err_msg) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | std::ifstream f; | |
| | | f.open(name.c_str(), std::fstream::binary); | |
| | | | |
| | | bool load_okay = f.is_open(); | |
| | | | |
| | | if(load_okay == true) | |
| | | { | |
| | | load_okay = diskio::load_raw_binary(x, f, err_msg); | |
| | | f.close(); | |
| | | } | |
| | | | |
| | | return load_okay; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | diskio::load_raw_binary(Cube<eT>& x, std::istream& f, std::string& err_msg) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | arma_ignore(err_msg); | |
| | | | |
| | | f.clear(); | |
| | | const std::streampos pos1 = f.tellg(); | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(0, ios::end); | |
| | | | |
| | | f.clear(); | |
| | | const std::streampos pos2 = f.tellg(); | |
| | | | |
| | | const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0; | |
| | | | |
| | | f.clear(); | |
| | | //f.seekg(0, ios::beg); | |
| | | f.seekg(pos1); | |
| | | | |
| | | x.set_size(N / sizeof(eT), 1, 1); | |
| | | | |
| | | f.clear(); | |
| | | f.read( reinterpret_cast<char *>(x.memptr()), N); | |
| | | | |
| | | return f.good(); | |
| | | } | |
| | | | |
| //! Load a cube in text format (human readable), | | //! Load a cube in text format (human readable), | |
| //! with a header that indicates the cube type as well as its dimensions | | //! with a header that indicates the cube type as well as its dimensions | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_arma_ascii(Cube<eT>& x, const std::string& name, std::string&
err_msg) | | diskio::load_arma_ascii(Cube<eT>& x, const std::string& name, std::string&
err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| std::ifstream f(name.c_str()); | | std::ifstream f(name.c_str()); | |
| | | | |
| skipping to change at line 1635 | | skipping to change at line 1884 | |
| { | | { | |
| return load_arma_binary(x, f, err_msg); | | return load_arma_binary(x, f, err_msg); | |
| } | | } | |
| else | | else | |
| if(P6 == header.substr(0, P6.length())) | | if(P6 == header.substr(0, P6.length())) | |
| { | | { | |
| return load_ppm_binary(x, f, err_msg); | | return load_ppm_binary(x, f, err_msg); | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| return load_raw_ascii(x, f, err_msg); | | if(is_raw_binary(f) == true) | |
| | | { | |
| | | return load_raw_binary(x, f, err_msg); | |
| | | } | |
| | | else | |
| | | { | |
| | | return load_raw_ascii(x, f, err_msg); | |
| | | } | |
| } | | } | |
| } | | } | |
| | | | |
| // fields | | // fields | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| bool | | bool | |
| diskio::save_arma_binary(const field<T1>& x, const std::string& final_name) | | diskio::save_arma_binary(const field<T1>& x, const std::string& final_name) | |
| { | | { | |
| | | | |
End of changes. 8 change blocks. |
| 3 lines changed or deleted | | 261 lines changed or added | |
|
| diskio_proto.hpp | | diskio_proto.hpp | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| || is_complex_double<eT>::value | | || is_complex_double<eT>::value | |
| ); | | ); | |
| }; | | }; | |
| | | | |
| template<typename eT> inline static std::string gen_txt_header(const Mat<
eT>& x); | | template<typename eT> inline static std::string gen_txt_header(const Mat<
eT>& x); | |
| template<typename eT> inline static std::string gen_bin_header(const Mat<
eT>& x); | | template<typename eT> inline static std::string gen_bin_header(const Mat<
eT>& x); | |
| | | | |
| template<typename eT> inline static std::string gen_txt_header(const Cube
<eT>& x); | | template<typename eT> inline static std::string gen_txt_header(const Cube
<eT>& x); | |
| template<typename eT> inline static std::string gen_bin_header(const Cube
<eT>& x); | | template<typename eT> inline static std::string gen_bin_header(const Cube
<eT>& x); | |
| | | | |
|
| | | inline static bool is_raw_binary(std::istream& f); | |
| | | | |
| inline static char conv_to_hex_char(const u8 x); | | inline static char conv_to_hex_char(const u8 x); | |
| inline static void conv_to_hex(char* out, const u8 x); | | inline static void conv_to_hex(char* out, const u8 x); | |
| | | | |
| inline static std::string gen_tmp_name(const std::string& x); | | inline static std::string gen_tmp_name(const std::string& x); | |
| | | | |
| inline static bool safe_rename(const std::string& old_name, const std::st
ring& new_name); | | inline static bool safe_rename(const std::string& old_name, const std::st
ring& new_name); | |
| | | | |
| // | | // | |
| // matrix saving | | // matrix saving | |
| | | | |
| template<typename eT> inline static bool save_raw_ascii (const Mat<eT>&
x, const std::string& final_name); | | template<typename eT> inline static bool save_raw_ascii (const Mat<eT>&
x, const std::string& final_name); | |
|
| | | template<typename eT> inline static bool save_raw_binary (const Mat<eT>&
x, const std::string& final_name); | |
| template<typename eT> inline static bool save_arma_ascii (const Mat<eT>&
x, const std::string& final_name); | | template<typename eT> inline static bool save_arma_ascii (const Mat<eT>&
x, const std::string& final_name); | |
| template<typename eT> inline static bool save_arma_binary(const Mat<eT>&
x, const std::string& final_name); | | template<typename eT> inline static bool save_arma_binary(const Mat<eT>&
x, const std::string& final_name); | |
| template<typename eT> inline static bool save_pgm_binary (const Mat<eT>&
x, const std::string& final_name); | | template<typename eT> inline static bool save_pgm_binary (const Mat<eT>&
x, const std::string& final_name); | |
| template<typename T> inline static bool save_pgm_binary (const Mat< std:
:complex<T> >& x, const std::string& final_name); | | template<typename T> inline static bool save_pgm_binary (const Mat< std:
:complex<T> >& x, const std::string& final_name); | |
| | | | |
| template<typename eT> inline static bool save_raw_ascii (const Mat<eT>&
x, std::ostream& f); | | template<typename eT> inline static bool save_raw_ascii (const Mat<eT>&
x, std::ostream& f); | |
|
| | | template<typename eT> inline static bool save_raw_binary (const Mat<eT>&
x, std::ostream& f); | |
| template<typename eT> inline static bool save_arma_ascii (const Mat<eT>&
x, std::ostream& f); | | template<typename eT> inline static bool save_arma_ascii (const Mat<eT>&
x, std::ostream& f); | |
| template<typename eT> inline static bool save_arma_binary(const Mat<eT>&
x, std::ostream& f); | | template<typename eT> inline static bool save_arma_binary(const Mat<eT>&
x, std::ostream& f); | |
| template<typename eT> inline static bool save_pgm_binary (const Mat<eT>&
x, std::ostream& f); | | template<typename eT> inline static bool save_pgm_binary (const Mat<eT>&
x, std::ostream& f); | |
| template<typename T> inline static bool save_pgm_binary (const Mat< std:
:complex<T> >& x, std::ostream& f); | | template<typename T> inline static bool save_pgm_binary (const Mat< std:
:complex<T> >& x, std::ostream& f); | |
| | | | |
| // | | // | |
| // matrix loading | | // matrix loading | |
| | | | |
| template<typename eT> inline static bool load_raw_ascii (Mat<eT>&
x, const std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_raw_ascii (Mat<eT>&
x, const std::string& name, std::string& err_msg); | |
|
| | | template<typename eT> inline static bool load_raw_binary (Mat<eT>&
x, const std::string& name, std::string& err_msg); | |
| template<typename eT> inline static bool load_arma_ascii (Mat<eT>&
x, const std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_arma_ascii (Mat<eT>&
x, const std::string& name, std::string& err_msg); | |
| template<typename eT> inline static bool load_arma_binary(Mat<eT>&
x, const std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_arma_binary(Mat<eT>&
x, const std::string& name, std::string& err_msg); | |
| template<typename eT> inline static bool load_pgm_binary (Mat<eT>&
x, const std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_pgm_binary (Mat<eT>&
x, const std::string& name, std::string& err_msg); | |
| template<typename T> inline static bool load_pgm_binary (Mat< std::compl
ex<T> >& x, const std::string& name, std::string& err_msg); | | template<typename T> inline static bool load_pgm_binary (Mat< std::compl
ex<T> >& x, const std::string& name, std::string& err_msg); | |
| template<typename eT> inline static bool load_auto_detect(Mat<eT>&
x, const std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_auto_detect(Mat<eT>&
x, const std::string& name, std::string& err_msg); | |
| | | | |
| template<typename eT> inline static bool load_raw_ascii (Mat<eT>&
x, std::istream& f, std::string& err_msg); | | template<typename eT> inline static bool load_raw_ascii (Mat<eT>&
x, std::istream& f, std::string& err_msg); | |
|
| | | template<typename eT> inline static bool load_raw_binary (Mat<eT>&
x, std::istream& f, std::string& err_msg); | |
| template<typename eT> inline static bool load_arma_ascii (Mat<eT>&
x, std::istream& f, std::string& err_msg); | | template<typename eT> inline static bool load_arma_ascii (Mat<eT>&
x, std::istream& f, std::string& err_msg); | |
| template<typename eT> inline static bool load_arma_binary(Mat<eT>&
x, std::istream& f, std::string& err_msg); | | template<typename eT> inline static bool load_arma_binary(Mat<eT>&
x, std::istream& f, std::string& err_msg); | |
| template<typename eT> inline static bool load_pgm_binary (Mat<eT>&
x, std::istream& is, std::string& err_msg); | | template<typename eT> inline static bool load_pgm_binary (Mat<eT>&
x, std::istream& is, std::string& err_msg); | |
| template<typename T> inline static bool load_pgm_binary (Mat< std::compl
ex<T> >& x, std::istream& is, std::string& err_msg); | | template<typename T> inline static bool load_pgm_binary (Mat< std::compl
ex<T> >& x, std::istream& is, std::string& err_msg); | |
| template<typename eT> inline static bool load_auto_detect(Mat<eT>&
x, std::istream& f, std::string& err_msg); | | template<typename eT> inline static bool load_auto_detect(Mat<eT>&
x, std::istream& f, std::string& err_msg); | |
| | | | |
| inline static void pnm_skip_comments(std::istream& f); | | inline static void pnm_skip_comments(std::istream& f); | |
| | | | |
| // | | // | |
| // cube saving | | // cube saving | |
| | | | |
| template<typename eT> inline static bool save_raw_ascii (const Cube<eT>&
x, const std::string& name); | | template<typename eT> inline static bool save_raw_ascii (const Cube<eT>&
x, const std::string& name); | |
|
| | | template<typename eT> inline static bool save_raw_binary (const Cube<eT>&
x, const std::string& name); | |
| template<typename eT> inline static bool save_arma_ascii (const Cube<eT>&
x, const std::string& name); | | template<typename eT> inline static bool save_arma_ascii (const Cube<eT>&
x, const std::string& name); | |
| template<typename eT> inline static bool save_arma_binary(const Cube<eT>&
x, const std::string& name); | | template<typename eT> inline static bool save_arma_binary(const Cube<eT>&
x, const std::string& name); | |
| | | | |
| template<typename eT> inline static bool save_raw_ascii (const Cube<eT>&
x, std::ostream& f); | | template<typename eT> inline static bool save_raw_ascii (const Cube<eT>&
x, std::ostream& f); | |
|
| | | template<typename eT> inline static bool save_raw_binary (const Cube<eT>&
x, std::ostream& f); | |
| template<typename eT> inline static bool save_arma_ascii (const Cube<eT>&
x, std::ostream& f); | | template<typename eT> inline static bool save_arma_ascii (const Cube<eT>&
x, std::ostream& f); | |
| template<typename eT> inline static bool save_arma_binary(const Cube<eT>&
x, std::ostream& f); | | template<typename eT> inline static bool save_arma_binary(const Cube<eT>&
x, std::ostream& f); | |
| | | | |
| // | | // | |
| // cube loading | | // cube loading | |
| | | | |
| template<typename eT> inline static bool load_raw_ascii (Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_raw_ascii (Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | |
|
| | | template<typename eT> inline static bool load_raw_binary (Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | |
| template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | |
| template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | |
| template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | | template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, co
nst std::string& name, std::string& err_msg); | |
| | | | |
| template<typename eT> inline static bool load_raw_ascii (Cube<eT>& x, st
d::istream& f, std::string& err_msg); | | template<typename eT> inline static bool load_raw_ascii (Cube<eT>& x, st
d::istream& f, std::string& err_msg); | |
|
| | | template<typename eT> inline static bool load_raw_binary (Cube<eT>& x, st
d::istream& f, std::string& err_msg); | |
| template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, st
d::istream& f, std::string& err_msg); | | template<typename eT> inline static bool load_arma_ascii (Cube<eT>& x, st
d::istream& f, std::string& err_msg); | |
| template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, st
d::istream& f, std::string& err_msg); | | template<typename eT> inline static bool load_arma_binary(Cube<eT>& x, st
d::istream& f, std::string& err_msg); | |
| template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, st
d::istream& f, std::string& err_msg); | | template<typename eT> inline static bool load_auto_detect(Cube<eT>& x, st
d::istream& f, std::string& err_msg); | |
| | | | |
| // | | // | |
| // field saving and loading | | // field saving and loading | |
| | | | |
| template<typename T1> inline static bool save_arma_binary(const field<T1>
& x, const std::string& name); | | template<typename T1> inline static bool save_arma_binary(const field<T1>
& x, const std::string& name); | |
| template<typename T1> inline static bool save_arma_binary(const field<T1>
& x, std::ostream& f); | | template<typename T1> inline static bool save_arma_binary(const field<T1>
& x, std::ostream& f); | |
| | | | |
| | | | |
End of changes. 9 change blocks. |
| 0 lines changed or deleted | | 10 lines changed or added | |
|
| fn_misc.hpp | | fn_misc.hpp | |
| | | | |
| skipping to change at line 82 | | skipping to change at line 82 | |
| } | | } | |
| | | | |
| inline | | inline | |
| mat | | mat | |
| linspace(const double start, const double end, const u32 num) | | linspace(const double start, const double end, const u32 num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| return linspace<mat>(start, end, num); | | return linspace<mat>(start, end, num); | |
| } | | } | |
| | | | |
|
| template<typename eT, typename T1> | | | |
| inline | | | |
| const mtOp<u32, T1, op_find> | | | |
| find(const Base<eT,T1>& X, const u32 k = 0, const char* direction = "first" | | | |
| ) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| const char sig = direction[0]; | | | |
| | | | |
| arma_debug_check( (sig != 'f' && sig != 'F' && sig != 'l' && sig != 'L'), | | | |
| "find(): 3rd input argument must be \"first\" or \"last\"" ); | | | |
| | | | |
| const u32 type = (sig == 'f' || sig == 'F') ? 0 : 1; | | | |
| | | | |
| return mtOp<u32, T1, op_find>(X.get_ref(), k, type); | | | |
| } | | | |
| | | | |
| // | | | |
| // real | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const T1& | | | |
| real(const Base<typename T1::pod_type, T1>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return X.get_ref(); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const T1& | | | |
| real(const BaseCube<typename T1::pod_type, T1>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return X.get_ref(); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const mtOp<typename T1::pod_type, T1, op_real> | | | |
| real(const Base<std::complex<typename T1::pod_type>, T1>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return mtOp<typename T1::pod_type, T1, op_real>( X.get_ref() ); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const mtOpCube<typename T1::pod_type, T1, op_real> | | | |
| real(const BaseCube<std::complex<typename T1::pod_type>, T1>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return mtOpCube<typename T1::pod_type, T1, op_real>( X.get_ref() ); | | | |
| } | | | |
| | | | |
| // | | | |
| // imag | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const eOp<Mat<typename T1::pod_type>, eop_zeros> | | | |
| imag(const Base<typename T1::pod_type,T1>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| const Proxy<T1> A(X.get_ref()); | | | |
| | | | |
| return eOp<Mat<typename T1::pod_type>, eop_zeros>(A.get_n_rows(), A.get_n | | | |
| _cols()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const eOpCube<Cube<typename T1::pod_type>, eop_zeros> | | | |
| imag(const BaseCube<typename T1::pod_type,T1>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| const ProxyCube<T1> A(X.get_ref()); | | | |
| | | | |
| return eOpCube<Cube<typename T1::pod_type>, eop_zeros>(A.get_n_rows(), A. | | | |
| get_n_cols(), A.get_n_slices()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const mtOp<typename T1::pod_type, T1, op_imag> | | | |
| imag(const Base<std::complex<typename T1::pod_type>, T1>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return mtOp<typename T1::pod_type, T1, op_imag>( X.get_ref() ); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const mtOpCube<typename T1::pod_type, T1, op_imag> | | | |
| imag(const BaseCube<std::complex<typename T1::pod_type>,T1>& X) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return mtOpCube<typename T1::pod_type, T1, op_imag>( X.get_ref() ); | | | |
| } | | | |
| | | | |
| // | | // | |
| // log_add | | // log_add | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename arma_float_only<eT>::result | | typename arma_float_only<eT>::result | |
| log_add(eT log_a, eT log_b) | | log_add(eT log_a, eT log_b) | |
| { | | { | |
| if(log_a < log_b) | | if(log_a < log_b) | |
| { | | { | |
| | | | |
| skipping to change at line 217 | | skipping to change at line 111 | |
| else | | else | |
| { | | { | |
| #if defined(ARMA_HAVE_LOG1P) | | #if defined(ARMA_HAVE_LOG1P) | |
| return (log_a + log1p(std::exp(negdelta))); | | return (log_a + log1p(std::exp(negdelta))); | |
| #else | | #else | |
| return (log_a + std::log(1.0 + std::exp(negdelta))); | | return (log_a + std::log(1.0 + std::exp(negdelta))); | |
| #endif | | #endif | |
| } | | } | |
| } | | } | |
| | | | |
|
| // | | | |
| // log | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_log> | | | |
| log(const Base<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_log>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_log> | | | |
| log(const BaseCube<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_log>(A.get_ref()); | | | |
| } | | | |
| | | | |
| // | | | |
| // log2 | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_log2> | | | |
| log2(const Base<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_log2>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_log2> | | | |
| log2(const BaseCube<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_log2>(A.get_ref()); | | | |
| } | | | |
| | | | |
| // | | | |
| // log10 | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_log10> | | | |
| log10(const Base<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_log10>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_log10> | | | |
| log10(const BaseCube<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_log10>(A.get_ref()); | | | |
| } | | | |
| | | | |
| // | | | |
| // exp | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_exp> | | | |
| exp(const Base<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_exp>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_exp> | | | |
| exp(const BaseCube<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_exp>(A.get_ref()); | | | |
| } | | | |
| | | | |
| // exp2 | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_exp2> | | | |
| exp2(const Base<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_exp2>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_exp2> | | | |
| exp2(const BaseCube<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_exp2>(A.get_ref()); | | | |
| } | | | |
| | | | |
| // exp10 | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_exp10> | | | |
| exp10(const Base<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_exp10>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_exp10> | | | |
| exp10(const BaseCube<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_exp10>(A.get_ref()); | | | |
| } | | | |
| | | | |
| // | | | |
| // abs | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_abs> | | | |
| abs(const Base<typename T1::elem_type,T1>& X, const typename arma_not_cx<ty | | | |
| pename T1::elem_type>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_ignore(junk); | | | |
| | | | |
| return eOp<T1, eop_abs>(X.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_abs> | | | |
| abs(const BaseCube<typename T1::elem_type,T1>& X, const typename arma_not_c | | | |
| x<typename T1::elem_type>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_ignore(junk); | | | |
| | | | |
| return eOpCube<T1, eop_abs>(X.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const mtOp<typename T1::pod_type, T1, op_abs> | | | |
| abs(const Base<std::complex<typename T1::pod_type>, T1>& X, const typename | | | |
| arma_cx_only<typename T1::elem_type>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_ignore(junk); | | | |
| | | | |
| return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const mtOpCube<typename T1::pod_type, T1, op_abs> | | | |
| abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const typen | | | |
| ame arma_cx_only<typename T1::elem_type>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_ignore(junk); | | | |
| | | | |
| return mtOpCube<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | | | |
| } | | | |
| | | | |
| // | | | |
| // fabs | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_abs> | | | |
| fabs(const Base<typename T1::pod_type,T1>& X, const typename arma_not_cx<ty | | | |
| pename T1::elem_type>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_ignore(junk); | | | |
| | | | |
| return eOp<T1, eop_abs>(X.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_abs> | | | |
| fabs(const BaseCube<typename T1::pod_type,T1>& X, const typename arma_not_c | | | |
| x<typename T1::elem_type>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_ignore(junk); | | | |
| | | | |
| return eOpCube<T1, eop_abs>(X.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| inline | | | |
| const mtOp<typename T1::pod_type, T1, op_abs> | | | |
| fabs(const Base<std::complex<typename T1::pod_type>, T1>& X, const typename | | | |
| arma_cx_only<typename T1::elem_type>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_ignore(junk); | | | |
| | | | |
| return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const mtOpCube<typename T1::pod_type, T1, op_abs> | | | |
| fabs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const type | | | |
| name arma_cx_only<typename T1::elem_type>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_ignore(junk); | | | |
| | | | |
| return abs(X); | | | |
| } | | | |
| | | | |
| // | | | |
| // square | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_square> | | | |
| square(const Base<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_square>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_square> | | | |
| square(const BaseCube<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_square>(A.get_ref()); | | | |
| } | | | |
| | | | |
| // | | | |
| // sqrt | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_sqrt> | | | |
| sqrt(const Base<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_sqrt>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_sqrt> | | | |
| sqrt(const BaseCube<typename T1::elem_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_sqrt>(A.get_ref()); | | | |
| } | | | |
| | | | |
| // | | | |
| // conj | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const T1& | | | |
| conj(const Base<typename T1::pod_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return A.get_ref(); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const T1& | | | |
| conj(const BaseCube<typename T1::pod_type,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return A.get_ref(); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_conj> | | | |
| conj(const Base<std::complex<typename T1::pod_type>,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_conj>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_conj> | | | |
| conj(const BaseCube<std::complex<typename T1::pod_type>,T1>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_conj>(A.get_ref()); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const T1& | | | |
| conj(const eOp<T1, eop_conj>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return A.m; | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const T1& | | | |
| conj(const eOpCube<T1, eop_conj>& A) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return A.m; | | | |
| } | | | |
| | | | |
| // TODO: this needs a more elaborate template restriction mechanism to work | | | |
| properly, | | | |
| // i.e. an overloaded version of thus function should do nothing if t | | | |
| he input type is non-complex | | | |
| // | | | |
| // //! the conjugate of the transpose of a complex matrix is the same as th | | | |
| e hermitian transpose | | | |
| // template<typename T1> | | | |
| // arma_inline | | | |
| // const Op<T1, op_htrans> | | | |
| // conj(const Op<T1, op_trans>& A) | | | |
| // { | | | |
| // arma_extra_debug_sigprint(); | | | |
| // | | | |
| // return Op<T1, op_htrans>(A.m); | | | |
| // } | | | |
| | | | |
| // pow | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_pow> | | | |
| pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type | | | |
| exponent) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOp<T1, eop_pow>(A.get_ref(), exponent); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_pow> | | | |
| pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_t | | | |
| ype exponent) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| return eOpCube<T1, eop_pow>(A.get_ref(), exponent); | | | |
| } | | | |
| | | | |
| // pow, specialised handling (non-complex exponent for complex matrices) | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOp<T1, eop_pow> | | | |
| pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type: | | | |
| :value_type exponent) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| typedef typename T1::elem_type eT; | | | |
| | | | |
| return eOp<T1, eop_pow>(A.get_ref(), eT(exponent)); | | | |
| } | | | |
| | | | |
| template<typename T1> | | | |
| arma_inline | | | |
| const eOpCube<T1, eop_pow> | | | |
| pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_t | | | |
| ype::value_type exponent) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| typedef typename T1::elem_type eT; | | | |
| | | | |
| return eOpCube<T1, eop_pow>(A.get_ref(), eT(exponent)); | | | |
| } | | | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 2 change blocks. |
| 534 lines changed or deleted | | 0 lines changed or added | |
|
| lapack_proto.hpp | | lapack_proto.hpp | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| //! @{ | | //! @{ | |
| | | | |
| extern "C" | | extern "C" | |
| { | | { | |
| // LU factorisation | | // LU factorisation | |
| void arma_fortran(sgetrf)(blas_int* m, blas_int* n, float* a, blas_int
* lda, blas_int* ipiv, blas_int* info); | | void arma_fortran(sgetrf)(blas_int* m, blas_int* n, float* a, blas_int
* lda, blas_int* ipiv, blas_int* info); | |
| void arma_fortran(dgetrf)(blas_int* m, blas_int* n, double* a, blas_int
* lda, blas_int* ipiv, blas_int* info); | | void arma_fortran(dgetrf)(blas_int* m, blas_int* n, double* a, blas_int
* lda, blas_int* ipiv, blas_int* info); | |
| void arma_fortran(cgetrf)(blas_int* m, blas_int* n, void* a, blas_int
* lda, blas_int* ipiv, blas_int* info); | | void arma_fortran(cgetrf)(blas_int* m, blas_int* n, void* a, blas_int
* lda, blas_int* ipiv, blas_int* info); | |
| void arma_fortran(zgetrf)(blas_int* m, blas_int* n, void* a, blas_int
* lda, blas_int* ipiv, blas_int* info); | | void arma_fortran(zgetrf)(blas_int* m, blas_int* n, void* a, blas_int
* lda, blas_int* ipiv, blas_int* info); | |
| | | | |
|
| // matrix inversion | | // matrix inversion (using LU factorisation result) | |
| void arma_fortran(sgetri)(blas_int* n, float* a, blas_int* lda, blas_i
nt* ipiv, float* work, blas_int* lwork, blas_int* info); | | void arma_fortran(sgetri)(blas_int* n, float* a, blas_int* lda, blas_i
nt* ipiv, float* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(dgetri)(blas_int* n, double* a, blas_int* lda, blas_i
nt* ipiv, double* work, blas_int* lwork, blas_int* info); | | void arma_fortran(dgetri)(blas_int* n, double* a, blas_int* lda, blas_i
nt* ipiv, double* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(cgetri)(blas_int* n, void* a, blas_int* lda, blas_i
nt* ipiv, void* work, blas_int* lwork, blas_int* info); | | void arma_fortran(cgetri)(blas_int* n, void* a, blas_int* lda, blas_i
nt* ipiv, void* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(zgetri)(blas_int* n, void* a, blas_int* lda, blas_i
nt* ipiv, void* work, blas_int* lwork, blas_int* info); | | void arma_fortran(zgetri)(blas_int* n, void* a, blas_int* lda, blas_i
nt* ipiv, void* work, blas_int* lwork, blas_int* info); | |
| | | | |
|
| | | // matrix inversion (triangular matrices) | |
| | | void arma_fortran(strtri)(char* uplo, char* diag, blas_int* n, float* | |
| | | a, blas_int* lda, blas_int* info); | |
| | | void arma_fortran(dtrtri)(char* uplo, char* diag, blas_int* n, double* | |
| | | a, blas_int* lda, blas_int* info); | |
| | | void arma_fortran(ctrtri)(char* uplo, char* diag, blas_int* n, void* | |
| | | a, blas_int* lda, blas_int* info); | |
| | | void arma_fortran(ztrtri)(char* uplo, char* diag, blas_int* n, void* | |
| | | a, blas_int* lda, blas_int* info); | |
| | | | |
| // eigenvector decomposition of symmetric real matrices | | // eigenvector decomposition of symmetric real matrices | |
| void arma_fortran(ssyev)(char* jobz, char* uplo, blas_int* n, float* a
, blas_int* lda, float* w, float* work, blas_int* lwork, blas_int* info); | | void arma_fortran(ssyev)(char* jobz, char* uplo, blas_int* n, float* a
, blas_int* lda, float* w, float* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(dsyev)(char* jobz, char* uplo, blas_int* n, double* a
, blas_int* lda, double* w, double* work, blas_int* lwork, blas_int* info); | | void arma_fortran(dsyev)(char* jobz, char* uplo, blas_int* n, double* a
, blas_int* lda, double* w, double* work, blas_int* lwork, blas_int* info); | |
| | | | |
| // eigenvector decomposition of hermitian matrices (complex) | | // eigenvector decomposition of hermitian matrices (complex) | |
| void arma_fortran(cheev)(char* jobz, char* uplo, blas_int* n, void* a
, blas_int* lda, float* w, void* work, blas_int* lwork, float* rwork, b
las_int* info); | | void arma_fortran(cheev)(char* jobz, char* uplo, blas_int* n, void* a
, blas_int* lda, float* w, void* work, blas_int* lwork, float* rwork, b
las_int* info); | |
| void arma_fortran(zheev)(char* jobz, char* uplo, blas_int* n, void* a
, blas_int* lda, double* w, void* work, blas_int* lwork, double* rwork, b
las_int* info); | | void arma_fortran(zheev)(char* jobz, char* uplo, blas_int* n, void* a
, blas_int* lda, double* w, void* work, blas_int* lwork, double* rwork, b
las_int* info); | |
| | | | |
| // eigenvector decomposition of general real matrices | | // eigenvector decomposition of general real matrices | |
| void arma_fortran(sgeev)(char* jobvl, char* jobvr, blas_int* n, float*
a, blas_int* lda, float* wr, float* wi, float* vl, blas_int* ldvl, flo
at* vr, blas_int* ldvr, float* work, blas_int* lwork, blas_int* info); | | void arma_fortran(sgeev)(char* jobvl, char* jobvr, blas_int* n, float*
a, blas_int* lda, float* wr, float* wi, float* vl, blas_int* ldvl, flo
at* vr, blas_int* ldvr, float* work, blas_int* lwork, blas_int* info); | |
| | | | |
| skipping to change at line 92 | | skipping to change at line 98 | |
| void arma_fortran(dgesv)(blas_int* n, blas_int* nrhs, double* a, blas_i
nt* lda, blas_int* ipiv, double* b, blas_int* ldb, blas_int* info); | | void arma_fortran(dgesv)(blas_int* n, blas_int* nrhs, double* a, blas_i
nt* lda, blas_int* ipiv, double* b, blas_int* ldb, blas_int* info); | |
| void arma_fortran(cgesv)(blas_int* n, blas_int* nrhs, void* a, blas_i
nt* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | | void arma_fortran(cgesv)(blas_int* n, blas_int* nrhs, void* a, blas_i
nt* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | |
| void arma_fortran(zgesv)(blas_int* n, blas_int* nrhs, void* a, blas_i
nt* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | | void arma_fortran(zgesv)(blas_int* n, blas_int* nrhs, void* a, blas_i
nt* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | |
| | | | |
| // solve over/underdetermined system of linear equations | | // solve over/underdetermined system of linear equations | |
| void arma_fortran(sgels)(char* trans, blas_int* m, blas_int* n, blas_in
t* nrhs, float* a, blas_int* lda, float* b, blas_int* ldb, float* work,
blas_int* lwork, blas_int* info); | | void arma_fortran(sgels)(char* trans, blas_int* m, blas_int* n, blas_in
t* nrhs, float* a, blas_int* lda, float* b, blas_int* ldb, float* work,
blas_int* lwork, blas_int* info); | |
| void arma_fortran(dgels)(char* trans, blas_int* m, blas_int* n, blas_in
t* nrhs, double* a, blas_int* lda, double* b, blas_int* ldb, double* work,
blas_int* lwork, blas_int* info); | | void arma_fortran(dgels)(char* trans, blas_int* m, blas_int* n, blas_in
t* nrhs, double* a, blas_int* lda, double* b, blas_int* ldb, double* work,
blas_int* lwork, blas_int* info); | |
| void arma_fortran(cgels)(char* trans, blas_int* m, blas_int* n, blas_in
t* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* work,
blas_int* lwork, blas_int* info); | | void arma_fortran(cgels)(char* trans, blas_int* m, blas_int* n, blas_in
t* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* work,
blas_int* lwork, blas_int* info); | |
| void arma_fortran(zgels)(char* trans, blas_int* m, blas_int* n, blas_in
t* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* work,
blas_int* lwork, blas_int* info); | | void arma_fortran(zgels)(char* trans, blas_int* m, blas_int* n, blas_in
t* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* work,
blas_int* lwork, blas_int* info); | |
| | | | |
|
| | | // solve a triangular system of linear equations | |
| | | void arma_fortran(strtrs)(char* uplo, char* trans, char* diag, blas_int | |
| | | * n, blas_int* nrhs, const float* a, blas_int* lda, float* b, blas_int* l | |
| | | db, blas_int* info); | |
| | | void arma_fortran(dtrtrs)(char* uplo, char* trans, char* diag, blas_int | |
| | | * n, blas_int* nrhs, const double* a, blas_int* lda, double* b, blas_int* l | |
| | | db, blas_int* info); | |
| | | void arma_fortran(ctrtrs)(char* uplo, char* trans, char* diag, blas_int | |
| | | * n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_int* l | |
| | | db, blas_int* info); | |
| | | void arma_fortran(ztrtrs)(char* uplo, char* trans, char* diag, blas_int | |
| | | * n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_int* l | |
| | | db, blas_int* info); | |
| | | | |
| // void arma_fortran(dgeqp3)(blas_int* m, blas_int* n, double* a, blas_
int* lda, blas_int* jpvt, double* tau, double* work, blas_int* lwork, blas_
int* info); | | // void arma_fortran(dgeqp3)(blas_int* m, blas_int* n, double* a, blas_
int* lda, blas_int* jpvt, double* tau, double* work, blas_int* lwork, blas_
int* info); | |
| // void arma_fortran(dormqr)(char* side, char* trans, blas_int* m, blas
_int* n, blas_int* k, double* a, blas_int* lda, double* tau, double* c, bla
s_int* ldc, double* work, blas_int* lwork, blas_int* info); | | // void arma_fortran(dormqr)(char* side, char* trans, blas_int* m, blas
_int* n, blas_int* k, double* a, blas_int* lda, double* tau, double* c, bla
s_int* ldc, double* work, blas_int* lwork, blas_int* info); | |
| // void arma_fortran(dposv)(char* uplo, blas_int* n, blas_int* nrhs, d
ouble* a, blas_int* lda, double* b, blas_int* ldb, blas_int* info); | | // void arma_fortran(dposv)(char* uplo, blas_int* n, blas_int* nrhs, d
ouble* a, blas_int* lda, double* b, blas_int* ldb, blas_int* info); | |
|
| // void arma_fortran(dtrtrs)(char* uplo, char* trans, char* diag, blas_
int* n, blas_int* nrhs, double* a, blas_int* lda, double* b, blas_int* ldb,
blas_int* info); | | | |
| // void arma_fortran(dgees)(char* jobvs, char* sort, blas_int* select,
blas_int* n, double* a, blas_int* lda, blas_int* sdim, double* wr, double*
wi, double* vs, blas_int* ldvs, double* work, blas_int* lwork, blas_int* b
work, blas_int* info); | | // void arma_fortran(dgees)(char* jobvs, char* sort, blas_int* select,
blas_int* n, double* a, blas_int* lda, blas_int* sdim, double* wr, double*
wi, double* vs, blas_int* ldvs, double* work, blas_int* lwork, blas_int* b
work, blas_int* info); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| getrf(blas_int* m, blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, bla
s_int* info) | | getrf(blas_int* m, blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, bla
s_int* info) | |
| { | | { | |
| arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| | | | |
| skipping to change at line 166 | | skipping to change at line 177 | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
| arma_fortran(zgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); | | arma_fortran(zgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
|
| | | trtri(char* uplo, char* diag, blas_int* n, eT* a, blas_int* lda, blas_int | |
| | | * info) | |
| | | { | |
| | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| | | if(is_float<eT>::value == true) | |
| | | { | |
| | | typedef float T; | |
| | | arma_fortran(strtri)(uplo, diag, n, (T*)a, lda, info); | |
| | | } | |
| | | else | |
| | | if(is_double<eT>::value == true) | |
| | | { | |
| | | typedef double T; | |
| | | arma_fortran(dtrtri)(uplo, diag, n, (T*)a, lda, info); | |
| | | } | |
| | | else | |
| | | if(is_supported_complex_float<eT>::value == true) | |
| | | { | |
| | | typedef std::complex<float> T; | |
| | | arma_fortran(ctrtri)(uplo, diag, n, (T*)a, lda, info); | |
| | | } | |
| | | else | |
| | | if(is_supported_complex_double<eT>::value == true) | |
| | | { | |
| | | typedef std::complex<double> T; | |
| | | arma_fortran(ztrtri)(uplo, diag, n, (T*)a, lda, info); | |
| | | } | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | void | |
| syev(char* jobz, char* uplo, blas_int* n, eT* a, blas_int* lda, eT* w, e
T* work, blas_int* lwork, blas_int* info) | | syev(char* jobz, char* uplo, blas_int* n, eT* a, blas_int* lda, eT* w, e
T* work, blas_int* lwork, blas_int* info) | |
| { | | { | |
| arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
| arma_fortran(ssyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork
, info); | | arma_fortran(ssyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork
, info); | |
| } | | } | |
| else | | else | |
| | | | |
| skipping to change at line 499 | | skipping to change at line 542 | |
| arma_fortran(cgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)wo
rk, lwork, info); | | arma_fortran(cgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)wo
rk, lwork, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
| arma_fortran(zgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)wo
rk, lwork, info); | | arma_fortran(zgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)wo
rk, lwork, info); | |
| } | | } | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | inline | |
| | | void | |
| | | trtrs(char* uplo, char* trans, char* diag, blas_int* n, blas_int* nrhs, c | |
| | | onst eT* a, blas_int* lda, eT* b, blas_int* ldb, blas_int* info) | |
| | | { | |
| | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| | | if(is_float<eT>::value == true) | |
| | | { | |
| | | typedef float T; | |
| | | arma_fortran(strtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, l | |
| | | db, info); | |
| | | } | |
| | | else | |
| | | if(is_double<eT>::value == true) | |
| | | { | |
| | | typedef double T; | |
| | | arma_fortran(dtrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, l | |
| | | db, info); | |
| | | } | |
| | | else | |
| | | if(is_supported_complex_float<eT>::value == true) | |
| | | { | |
| | | typedef std::complex<float> T; | |
| | | arma_fortran(ctrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, l | |
| | | db, info); | |
| | | } | |
| | | else | |
| | | if(is_supported_complex_double<eT>::value == true) | |
| | | { | |
| | | typedef std::complex<double> T; | |
| | | arma_fortran(ztrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, l | |
| | | db, info); | |
| | | } | |
| | | } | |
| | | | |
| //! @} | | //! @} | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 2 lines changed or deleted | | 95 lines changed or added | |
|
| op_find_meat.hpp | | op_find_meat.hpp | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| inline | | inline | |
| u32 | | u32 | |
| op_find::helper | | op_find::helper | |
| ( | | ( | |
| Mat<u32>& indices, | | Mat<u32>& indices, | |
| const Base<typename T1::elem_type, T1>& X | | const Base<typename T1::elem_type, T1>& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | typedef typename Proxy<T1>::ea_type ea_type; | |
| | | | |
|
| const Proxy<T1> P(X.get_ref()); | | const Proxy<T1> A(X.get_ref()); | |
| | | | |
|
| const u32 n_elem = P.get_n_elem(); | | ea_type PA = A.get_ea(); | |
| | | const u32 n_elem = A.get_n_elem(); | |
| | | | |
| indices.set_size(n_elem, 1); | | indices.set_size(n_elem, 1); | |
| | | | |
| u32* indices_mem = indices.memptr(); | | u32* indices_mem = indices.memptr(); | |
| u32 n_nz = 0; | | u32 n_nz = 0; | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | for(u32 i=0; i<n_elem; ++i) | |
| { | | { | |
|
| if(P[i] != eT(0)) | | if(PA[i] != eT(0)) | |
| { | | { | |
| indices_mem[n_nz] = i; | | indices_mem[n_nz] = i; | |
| ++n_nz; | | ++n_nz; | |
| } | | } | |
| } | | } | |
| | | | |
| return n_nz; | | return n_nz; | |
| } | | } | |
| | | | |
| template<typename T1, typename op_type> | | template<typename T1, typename op_type> | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 65 | |
| u32 | | u32 | |
| op_find::helper | | op_find::helper | |
| ( | | ( | |
| Mat<u32>& indices, | | Mat<u32>& indices, | |
| const mtOp<u32, T1, op_type>& X, | | const mtOp<u32, T1, op_type>& X, | |
| const typename arma_op_rel_only<op_type>::result junk1, | | const typename arma_op_rel_only<op_type>::result junk1, | |
| const typename arma_not_cx<typename T1::elem_type>::result junk2 | | const typename arma_not_cx<typename T1::elem_type>::result junk2 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | | |
| arma_ignore(junk1); | | arma_ignore(junk1); | |
| arma_ignore(junk2); | | arma_ignore(junk2); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | typedef typename Proxy<T1>::ea_type ea_type; | |
| | | | |
| const eT val = X.aux; | | const eT val = X.aux; | |
| | | | |
|
| const Proxy<T1> P(X.m); | | const Proxy<T1> A(X.m); | |
| | | | |
|
| const u32 n_elem = P.get_n_elem(); | | ea_type PA = A.get_ea(); | |
| | | const u32 n_elem = A.get_n_elem(); | |
| | | | |
| indices.set_size(n_elem, 1); | | indices.set_size(n_elem, 1); | |
| | | | |
| u32* indices_mem = indices.memptr(); | | u32* indices_mem = indices.memptr(); | |
| u32 n_nz = 0; | | u32 n_nz = 0; | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | for(u32 i=0; i<n_elem; ++i) | |
| { | | { | |
|
| const eT tmp = P[i]; | | const eT tmp = PA[i]; | |
| | | | |
| bool not_zero; | | bool not_zero; | |
| | | | |
| if(is_same_type<op_type, op_rel_lt_pre >::value == true) { not_
zero = (val < tmp); } | | if(is_same_type<op_type, op_rel_lt_pre >::value == true) { not_
zero = (val < tmp); } | |
| else if(is_same_type<op_type, op_rel_lt_post >::value == true) { not_
zero = (tmp < val); } | | else if(is_same_type<op_type, op_rel_lt_post >::value == true) { not_
zero = (tmp < val); } | |
| else if(is_same_type<op_type, op_rel_gt_pre >::value == true) { not_
zero = (val > tmp); } | | else if(is_same_type<op_type, op_rel_gt_pre >::value == true) { not_
zero = (val > tmp); } | |
| else if(is_same_type<op_type, op_rel_gt_post >::value == true) { not_
zero = (tmp > val); } | | else if(is_same_type<op_type, op_rel_gt_post >::value == true) { not_
zero = (tmp > val); } | |
| else if(is_same_type<op_type, op_rel_lteq_pre >::value == true) { not_
zero = (val <= tmp); } | | else if(is_same_type<op_type, op_rel_lteq_pre >::value == true) { not_
zero = (val <= tmp); } | |
| else if(is_same_type<op_type, op_rel_lteq_post>::value == true) { not_
zero = (tmp <= val); } | | else if(is_same_type<op_type, op_rel_lteq_post>::value == true) { not_
zero = (tmp <= val); } | |
| else if(is_same_type<op_type, op_rel_gteq_pre >::value == true) { not_
zero = (val >= tmp); } | | else if(is_same_type<op_type, op_rel_gteq_pre >::value == true) { not_
zero = (val >= tmp); } | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 118 | |
| return n_nz; | | return n_nz; | |
| } | | } | |
| | | | |
| template<typename T1, typename op_type> | | template<typename T1, typename op_type> | |
| inline | | inline | |
| u32 | | u32 | |
| op_find::helper | | op_find::helper | |
| ( | | ( | |
| Mat<u32>& indices, | | Mat<u32>& indices, | |
| const mtOp<u32, T1, op_type>& X, | | const mtOp<u32, T1, op_type>& X, | |
|
| const typename arma_op_rel_only<op_type>::result junk1, | | const typename arma_op_rel_only<op_type>::result junk1, | |
| const typename arma_cx_only<typename T1::elem_type>::result junk2 | | const typename arma_cx_only<typename T1::elem_type>::result junk2 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | arma_ignore(junk1); | |
| | | arma_ignore(junk2); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | typedef typename Proxy<T1>::ea_type ea_type; | |
| | | | |
| const eT val = X.aux; | | const eT val = X.aux; | |
| | | | |
|
| const Proxy<T1> P(X.m); | | const Proxy<T1> A(X.m); | |
| | | | |
|
| const u32 n_elem = P.get_n_elem(); | | ea_type PA = A.get_ea(); | |
| | | const u32 n_elem = A.get_n_elem(); | |
| | | | |
| indices.set_size(n_elem, 1); | | indices.set_size(n_elem, 1); | |
| | | | |
| u32* indices_mem = indices.memptr(); | | u32* indices_mem = indices.memptr(); | |
| u32 n_nz = 0; | | u32 n_nz = 0; | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | for(u32 i=0; i<n_elem; ++i) | |
| { | | { | |
|
| const eT tmp = P[i]; | | const eT tmp = PA[i]; | |
| | | | |
| bool not_zero; | | bool not_zero; | |
| | | | |
| if(is_same_type<op_type, op_rel_eq >::value == true) { not_zero
= (tmp == val); } | | if(is_same_type<op_type, op_rel_eq >::value == true) { not_zero
= (tmp == val); } | |
| else if(is_same_type<op_type, op_rel_noteq>::value == true) { not_zero
= (tmp != val); } | | else if(is_same_type<op_type, op_rel_noteq>::value == true) { not_zero
= (tmp != val); } | |
| else not_zero = false; | | else not_zero = false; | |
| | | | |
| if(not_zero == true) | | if(not_zero == true) | |
| { | | { | |
| indices_mem[n_nz] = i; | | indices_mem[n_nz] = i; | |
| | | | |
| skipping to change at line 167 | | skipping to change at line 174 | |
| op_find::helper | | op_find::helper | |
| ( | | ( | |
| Mat<u32>& indices, | | Mat<u32>& indices, | |
| const mtGlue<u32, T1, T2, glue_type>& X, | | const mtGlue<u32, T1, T2, glue_type>& X, | |
| const typename arma_glue_rel_only<glue_type>::result junk1, | | const typename arma_glue_rel_only<glue_type>::result junk1, | |
| const typename arma_not_cx<typename T1::elem_type>::result junk2, | | const typename arma_not_cx<typename T1::elem_type>::result junk2, | |
| const typename arma_not_cx<typename T2::elem_type>::result junk3 | | const typename arma_not_cx<typename T2::elem_type>::result junk3 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | | |
| arma_ignore(junk1); | | arma_ignore(junk1); | |
| arma_ignore(junk2); | | arma_ignore(junk2); | |
| arma_ignore(junk3); | | arma_ignore(junk3); | |
| | | | |
| typedef typename T1::elem_type eT1; | | typedef typename T1::elem_type eT1; | |
| typedef typename T2::elem_type eT2; | | typedef typename T2::elem_type eT2; | |
| | | | |
|
| | | typedef typename Proxy<T1>::ea_type ea_type1; | |
| | | typedef typename Proxy<T2>::ea_type ea_type2; | |
| | | | |
| const Proxy<T1> A(X.A); | | const Proxy<T1> A(X.A); | |
| const Proxy<T2> B(X.B); | | const Proxy<T2> B(X.B); | |
| | | | |
| arma_debug_assert_same_size(A, B, "relational operator"); | | arma_debug_assert_same_size(A, B, "relational operator"); | |
| | | | |
|
| const u32 n_elem = A.get_n_elem(); | | ea_type1 PA = A.get_ea(); | |
| | | ea_type2 PB = B.get_ea(); | |
| | | const u32 n_elem = B.get_n_elem(); | |
| | | | |
| indices.set_size(n_elem, 1); | | indices.set_size(n_elem, 1); | |
| | | | |
| u32* indices_mem = indices.memptr(); | | u32* indices_mem = indices.memptr(); | |
| u32 n_nz = 0; | | u32 n_nz = 0; | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | for(u32 i=0; i<n_elem; ++i) | |
| { | | { | |
|
| const eT1 tmp1 = A[i]; | | const eT1 tmp1 = PA[i]; | |
| const eT1 tmp2 = B[i]; | | const eT2 tmp2 = PB[i]; | |
| | | | |
| bool not_zero; | | bool not_zero; | |
| | | | |
| if(is_same_type<glue_type, glue_rel_lt >::value == true) { not
_zero = (tmp1 < tmp2); } | | if(is_same_type<glue_type, glue_rel_lt >::value == true) { not
_zero = (tmp1 < tmp2); } | |
| else if(is_same_type<glue_type, glue_rel_gt >::value == true) { not
_zero = (tmp1 > tmp2); } | | else if(is_same_type<glue_type, glue_rel_gt >::value == true) { not
_zero = (tmp1 > tmp2); } | |
| else if(is_same_type<glue_type, glue_rel_lteq >::value == true) { not
_zero = (tmp1 <= tmp2); } | | else if(is_same_type<glue_type, glue_rel_lteq >::value == true) { not
_zero = (tmp1 <= tmp2); } | |
| else if(is_same_type<glue_type, glue_rel_gteq >::value == true) { not
_zero = (tmp1 >= tmp2); } | | else if(is_same_type<glue_type, glue_rel_gteq >::value == true) { not
_zero = (tmp1 >= tmp2); } | |
| else if(is_same_type<glue_type, glue_rel_eq >::value == true) { not
_zero = (tmp1 == tmp2); } | | else if(is_same_type<glue_type, glue_rel_eq >::value == true) { not
_zero = (tmp1 == tmp2); } | |
| else if(is_same_type<glue_type, glue_rel_noteq >::value == true) { not
_zero = (tmp1 != tmp2); } | | else if(is_same_type<glue_type, glue_rel_noteq >::value == true) { not
_zero = (tmp1 != tmp2); } | |
| else not_zero = false; | | else not_zero = false; | |
| | | | |
| skipping to change at line 225 | | skipping to change at line 236 | |
| op_find::helper | | op_find::helper | |
| ( | | ( | |
| Mat<u32>& indices, | | Mat<u32>& indices, | |
| const mtGlue<u32, T1, T2, glue_type>& X, | | const mtGlue<u32, T1, T2, glue_type>& X, | |
| const typename arma_glue_rel_only<glue_type>::result junk1, | | const typename arma_glue_rel_only<glue_type>::result junk1, | |
| const typename arma_cx_only<typename T1::elem_type>::result junk2, | | const typename arma_cx_only<typename T1::elem_type>::result junk2, | |
| const typename arma_cx_only<typename T2::elem_type>::result junk3 | | const typename arma_cx_only<typename T2::elem_type>::result junk3 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | | |
| arma_ignore(junk1); | | arma_ignore(junk1); | |
| arma_ignore(junk2); | | arma_ignore(junk2); | |
| arma_ignore(junk3); | | arma_ignore(junk3); | |
| | | | |
|
| | | typedef typename Proxy<T1>::ea_type ea_type1; | |
| | | typedef typename Proxy<T2>::ea_type ea_type2; | |
| | | | |
| const Proxy<T1> A(X.A); | | const Proxy<T1> A(X.A); | |
| const Proxy<T2> B(X.B); | | const Proxy<T2> B(X.B); | |
| | | | |
| arma_debug_assert_same_size(A, B, "relational operator"); | | arma_debug_assert_same_size(A, B, "relational operator"); | |
| | | | |
|
| const u32 n_elem = A.get_n_elem(); | | ea_type1 PA = A.get_ea(); | |
| | | ea_type2 PB = B.get_ea(); | |
| | | const u32 n_elem = B.get_n_elem(); | |
| | | | |
| indices.set_size(n_elem, 1); | | indices.set_size(n_elem, 1); | |
| | | | |
| u32* indices_mem = indices.memptr(); | | u32* indices_mem = indices.memptr(); | |
| u32 n_nz = 0; | | u32 n_nz = 0; | |
| | | | |
| for(u32 i=0; i<n_elem; ++i) | | for(u32 i=0; i<n_elem; ++i) | |
| { | | { | |
| bool not_zero; | | bool not_zero; | |
| | | | |
|
| if(is_same_type<glue_type, glue_rel_eq >::value == true) { not | | if(is_same_type<glue_type, glue_rel_eq >::value == true) { not | |
| _zero = (A[i] == B[i]); } | | _zero = (PA[i] == PB[i]); } | |
| else if(is_same_type<glue_type, glue_rel_noteq >::value == true) { not | | else if(is_same_type<glue_type, glue_rel_noteq >::value == true) { not | |
| _zero = (A[i] != B[i]); } | | _zero = (PA[i] != PB[i]); } | |
| else not_zero = false; | | else not_zero = false; | |
| | | | |
| if(not_zero == true) | | if(not_zero == true) | |
| { | | { | |
| indices_mem[n_nz] = i; | | indices_mem[n_nz] = i; | |
| ++n_nz; | | ++n_nz; | |
| } | | } | |
| } | | } | |
| | | | |
| return n_nz; | | return n_nz; | |
| | | | |
End of changes. 23 change blocks. |
| 24 lines changed or deleted | | 39 lines changed or added | |
|
| subview_cube_meat.hpp | | subview_cube_meat.hpp | |
| | | | |
| skipping to change at line 502 | | skipping to change at line 502 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "copy into subcube"); | | arma_debug_assert_same_size(t, x, "copy into subcube"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | const u32 t_aux_slice1 = t.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| syslib::copy_elem( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); | | syslib:copy_elem( t.slice_colptr(t_aux_slice1, col), x.colptr(col), t_n
_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::operator+= (const Base<eT,T1>& in) | | subview_cube<eT>::operator+= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "cube addition"); | | arma_debug_assert_same_size(t, x, "cube addition"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | const u32 t_aux_slice1 = t.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_plus( t.slice_colptr(0, col), x.colptr(col), t_n_rows
); | | arrayops::inplace_plus( t.slice_colptr(t_aux_slice1, col), x.colptr(col
), t_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::operator-= (const Base<eT,T1>& in) | | subview_cube<eT>::operator-= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "cube subtraction"); | | arma_debug_assert_same_size(t, x, "cube subtraction"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | const u32 t_aux_slice1 = t.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_minus( t.slice_colptr(0, col), x.colptr(col), t_n_row
s ); | | arrayops::inplace_minus( t.slice_colptr(t_aux_slice1, col), x.colptr(co
l), t_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::operator%= (const Base<eT,T1>& in) | | subview_cube<eT>::operator%= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "cube schur product"); | | arma_debug_assert_same_size(t, x, "cube schur product"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | const u32 t_aux_slice1 = t.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_mul( t.slice_colptr(0, col), x.colptr(col), t_n_rows
); | | arrayops::inplace_mul( t.slice_colptr(t_aux_slice1, col), x.colptr(col)
, t_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::operator/= (const Base<eT,T1>& in) | | subview_cube<eT>::operator/= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "element-wise cube division"); | | arma_debug_assert_same_size(t, x, "element-wise cube division"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | const u32 t_aux_slice1 = t.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_div( t.slice_colptr(0, col), x.colptr(col), t_n_rows
); | | arrayops::inplace_div( t.slice_colptr(t_aux_slice1, col), x.colptr(col)
, t_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::fill(const eT val) | | subview_cube<eT>::fill(const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | | |
| skipping to change at line 882 | | skipping to change at line 887 | |
| //! mat X = Y.subcube(...) | | //! mat X = Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::extract(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::extract(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( (in.n_slices != 1), "subview_cube::extract(): given sub
cube doesn't have exactly one slice" ); | | arma_debug_check( (in.n_slices != 1), "subview_cube::extract(): given sub
cube doesn't have exactly one slice" ); | |
| | | | |
|
| const u32 n_rows = in.n_rows; | | const u32 n_rows = in.n_rows; | |
| const u32 n_cols = in.n_cols; | | const u32 n_cols = in.n_cols; | |
| | | const u32 aux_slice1 = in.aux_slice1; | |
| | | | |
| out.set_size(n_rows, n_cols); | | out.set_size(n_rows, n_cols); | |
| | | | |
| for(u32 col = 0; col < n_cols; ++col) | | for(u32 col = 0; col < n_cols; ++col) | |
| { | | { | |
|
| syslib::copy_elem( out.colptr(col), in.slice_colptr(0, col), n_rows ); | | syslib::copy_elem( out.colptr(col), in.slice_colptr(aux_slice1, col), n
_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! cube X += Y.subcube(...) | | //! cube X += Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::plus_inplace(Cube<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::plus_inplace(Cube<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 995 | | skipping to change at line 1001 | |
| //! mat X += Y.subcube(...) | | //! mat X += Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::plus_inplace(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::plus_inplace(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_assert_same_size(out, in, "matrix addition"); | | arma_debug_assert_same_size(out, in, "matrix addition"); | |
| | | | |
|
| const u32 in_n_rows = in.n_rows; | | const u32 in_n_rows = in.n_rows; | |
| const u32 in_n_cols = in.n_cols; | | const u32 in_n_cols = in.n_cols; | |
| | | const u32 in_aux_slice1 = in.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < in_n_cols; ++col) | | for(u32 col = 0; col < in_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_plus( out.colptr(col), in.slice_colptr(0, col), in_n_
rows ); | | arrayops::inplace_plus( out.colptr(col), in.slice_colptr(in_aux_slice1,
col), in_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! mat X -= Y.subcube(...) | | //! mat X -= Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::minus_inplace(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::minus_inplace(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_assert_same_size(out, in, "matrix subtraction"); | | arma_debug_assert_same_size(out, in, "matrix subtraction"); | |
| | | | |
|
| const u32 in_n_rows = in.n_rows; | | const u32 in_n_rows = in.n_rows; | |
| const u32 in_n_cols = in.n_cols; | | const u32 in_n_cols = in.n_cols; | |
| | | const u32 in_aux_slice1 = in.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < in_n_cols; ++col) | | for(u32 col = 0; col < in_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_minus( out.colptr(col), in.slice_colptr(0, col), in_n
_rows ); | | arrayops::inplace_minus( out.colptr(col), in.slice_colptr(in_aux_slice1
, col), in_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! mat X %= Y.subcube(...) | | //! mat X %= Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::schur_inplace(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::schur_inplace(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_assert_same_size(out, in, "matrix schur product"); | | arma_debug_assert_same_size(out, in, "matrix schur product"); | |
| | | | |
|
| const u32 in_n_rows = in.n_rows; | | const u32 in_n_rows = in.n_rows; | |
| const u32 in_n_cols = in.n_cols; | | const u32 in_n_cols = in.n_cols; | |
| | | const u32 in_aux_slice1 = in.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < in_n_cols; ++col) | | for(u32 col = 0; col < in_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_mul( out.colptr(col), in.slice_colptr(0, col), in_n_r
ows ); | | arrayops::inplace_mul( out.colptr(col), in.slice_colptr(in_aux_slice1,
col), in_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! mat X /= Y.subcube(...) | | //! mat X /= Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::div_inplace(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::div_inplace(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_assert_same_size(out, in, "matrix element-wise division"); | | arma_debug_assert_same_size(out, in, "matrix element-wise division"); | |
| | | | |
|
| const u32 in_n_rows = in.n_rows; | | const u32 in_n_rows = in.n_rows; | |
| const u32 in_n_cols = in.n_cols; | | const u32 in_n_cols = in.n_cols; | |
| | | const u32 in_aux_slice1 = in.aux_slice1; | |
| | | | |
| for(u32 col = 0; col < in_n_cols; ++col) | | for(u32 col = 0; col < in_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_div( out.colptr(col), in.slice_colptr(0, col), in_n_r
ows ); | | arrayops::inplace_div( out.colptr(col), in.slice_colptr(in_aux_slice1,
col), in_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 20 change blocks. |
| 30 lines changed or deleted | | 40 lines changed or added | |
|
| subview_meat.hpp | | subview_meat.hpp | |
| | | | |
| skipping to change at line 161 | | skipping to change at line 161 | |
| { | | { | |
| for(u32 col=0; col<local_n_cols; ++col) | | for(u32 col=0; col<local_n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_div( colptr(col), val, local_n_rows ); | | arrayops::inplace_div( colptr(col), val, local_n_rows ); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
|
| arma_inline | | inline | |
| void | | void | |
| subview<eT>::operator= (const Base<eT,T1>& in) | | subview<eT>::operator= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const unwrap<T1> tmp(in.get_ref()); | | const Proxy<T1> P(in.get_ref()); | |
| const Mat<eT>& x = tmp.M; | | | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "insert into submatrix"); | | | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
|
| if(t_n_rows == 1) | | arma_debug_assert_same_size(t, P, "insert into submatrix"); | |
| | | | |
| | | const bool alias = P.is_alias(t.m); | |
| | | | |
| | | arma_extra_debug_warn(alias, "aliasing detected"); | |
| | | | |
| | | if( (alias == true) || (is_Mat<typename Proxy<T1>::stored_type>::value == | |
| | | true) ) | |
| { | | { | |
|
| const eT* x_mem = x.memptr(); | | const unwrap_check<typename Proxy<T1>::stored_type> tmp(P.Q, t.m); | |
| | | const Mat<eT>& x = tmp.M; | |
| | | | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| | | { | |
| | | const eT* x_mem = x.memptr(); | |
| | | | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) = x_mem[col]; | |
| | | } | |
| | | } | |
| | | else | |
| { | | { | |
|
| at(0,col) = x_mem[col]; | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | syslib::copy_elem( t.colptr(col), x.colptr(col), t_n_rows ); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| { | | { | |
|
| syslib::copy_elem( t.colptr(col), x.colptr(col), t_n_rows ); | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) = P[col]; | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | eT* t_col_data = t.colptr(col); | |
| | | | |
| | | u32 i,j; | |
| | | for(i=0, j=1; j<t_n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp1 = P.at(i,col); | |
| | | const eT tmp2 = P.at(j,col); | |
| | | | |
| | | t_col_data[i] = tmp1; | |
| | | t_col_data[j] = tmp2; | |
| | | } | |
| | | | |
| | | if(i < t_n_rows) | |
| | | { | |
| | | t_col_data[i] = P.at(i,col); | |
| | | } | |
| | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::operator+= (const Base<eT,T1>& in) | | subview<eT>::operator+= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const unwrap<T1> tmp(in.get_ref()); | | const Proxy<T1> P(in.get_ref()); | |
| const Mat<eT>& x = tmp.M; | | | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "matrix addition"); | | | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
|
| if(t_n_rows == 1) | | arma_debug_assert_same_size(t, P, "addition"); | |
| | | | |
| | | const bool alias = P.is_alias(t.m); | |
| | | | |
| | | arma_extra_debug_warn(alias, "aliasing detected"); | |
| | | | |
| | | if( (alias == true) || (is_Mat<typename Proxy<T1>::stored_type>::value == | |
| | | true) ) | |
| { | | { | |
|
| const eT* x_mem = x.memptr(); | | const unwrap_check<typename Proxy<T1>::stored_type> tmp(P.Q, t.m); | |
| | | const Mat<eT>& x = tmp.M; | |
| | | | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| | | { | |
| | | const eT* x_mem = x.memptr(); | |
| | | | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) += x_mem[col]; | |
| | | } | |
| | | } | |
| | | else | |
| { | | { | |
|
| at(0,col) += x_mem[col]; | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | arrayops::inplace_plus( t.colptr(col), x.colptr(col), t_n_rows ); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| { | | { | |
|
| arrayops::inplace_plus( t.colptr(col), x.colptr(col), t_n_rows ); | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) += P[col]; | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | eT* t_col_data = t.colptr(col); | |
| | | | |
| | | u32 i,j; | |
| | | for(i=0, j=1; j<t_n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT val1 = P.at(i,col); | |
| | | const eT val2 = P.at(j,col); | |
| | | | |
| | | t_col_data[i] += val1; | |
| | | t_col_data[j] += val2; | |
| | | } | |
| | | | |
| | | if(i < t_n_rows) | |
| | | { | |
| | | t_col_data[i] += P.at(i,col); | |
| | | } | |
| | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::operator-= (const Base<eT,T1>& in) | | subview<eT>::operator-= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const unwrap<T1> tmp(in.get_ref()); | | const Proxy<T1> P(in.get_ref()); | |
| const Mat<eT>& x = tmp.M; | | | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "matrix subtraction"); | | | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
|
| if(t_n_rows == 1) | | arma_debug_assert_same_size(t, P, "subtraction"); | |
| | | | |
| | | const bool alias = P.is_alias(t.m); | |
| | | | |
| | | if( (alias == true) || (is_Mat<typename Proxy<T1>::stored_type>::value == | |
| | | true) ) | |
| { | | { | |
|
| const eT* x_mem = x.memptr(); | | const unwrap_check<typename Proxy<T1>::stored_type> tmp(P.Q, t.m); | |
| | | const Mat<eT>& x = tmp.M; | |
| | | | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| | | { | |
| | | const eT* x_mem = x.memptr(); | |
| | | | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) -= x_mem[col]; | |
| | | } | |
| | | } | |
| | | else | |
| { | | { | |
|
| at(0,col) -= x_mem[col]; | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | arrayops::inplace_minus( t.colptr(col), x.colptr(col), t_n_rows ); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| { | | { | |
|
| arrayops::inplace_minus( t.colptr(col), x.colptr(col), t_n_rows ); | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) -= P[col]; | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | eT* t_col_data = t.colptr(col); | |
| | | | |
| | | u32 i,j; | |
| | | for(i=0, j=1; j<t_n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT val1 = P.at(i,col); | |
| | | const eT val2 = P.at(j,col); | |
| | | | |
| | | t_col_data[i] -= val1; | |
| | | t_col_data[j] -= val2; | |
| | | } | |
| | | | |
| | | if(i < t_n_rows) | |
| | | { | |
| | | t_col_data[i] -= P.at(i,col); | |
| | | } | |
| | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::operator%= (const Base<eT,T1>& in) | | subview<eT>::operator%= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const unwrap<T1> tmp(in.get_ref()); | | const Proxy<T1> P(in.get_ref()); | |
| const Mat<eT>& x = tmp.M; | | | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "matrix schur product"); | | | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
|
| if(t_n_rows == 1) | | arma_debug_assert_same_size(t, P, "element-wise multiplication"); | |
| | | | |
| | | const bool alias = P.is_alias(t.m); | |
| | | | |
| | | arma_extra_debug_warn(alias, "aliasing detected"); | |
| | | | |
| | | if( (alias == true) || (is_Mat<typename Proxy<T1>::stored_type>::value == | |
| | | true) ) | |
| { | | { | |
|
| const eT* x_mem = x.memptr(); | | const unwrap_check<typename Proxy<T1>::stored_type> tmp(P.Q, t.m); | |
| | | const Mat<eT>& x = tmp.M; | |
| | | | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| | | { | |
| | | const eT* x_mem = x.memptr(); | |
| | | | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) *= x_mem[col]; | |
| | | } | |
| | | } | |
| | | else | |
| { | | { | |
|
| at(0,col) *= x_mem[col]; | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | arrayops::inplace_mul( t.colptr(col), x.colptr(col), t_n_rows ); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| { | | { | |
|
| arrayops::inplace_mul( t.colptr(col), x.colptr(col), t_n_rows ); | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) *= P[col]; | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | eT* t_col_data = t.colptr(col); | |
| | | | |
| | | u32 i,j; | |
| | | for(i=0, j=1; j<t_n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT val1 = P.at(i,col); | |
| | | const eT val2 = P.at(j,col); | |
| | | | |
| | | t_col_data[i] *= val1; | |
| | | t_col_data[j] *= val2; | |
| | | } | |
| | | | |
| | | if(i < t_n_rows) | |
| | | { | |
| | | t_col_data[i] *= P.at(i,col); | |
| | | } | |
| | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::operator/= (const Base<eT,T1>& in) | | subview<eT>::operator/= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const unwrap<T1> tmp(in.get_ref()); | | const Proxy<T1> P(in.get_ref()); | |
| const Mat<eT>& x = tmp.M; | | | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "element-wise matrix division"); | | | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
|
| if(t_n_rows == 1) | | arma_debug_assert_same_size(t, P, "element-wise division"); | |
| | | | |
| | | const bool alias = P.is_alias(t.m); | |
| | | | |
| | | arma_extra_debug_warn(alias, "aliasing detected"); | |
| | | | |
| | | if( (alias == true) || (is_Mat<typename Proxy<T1>::stored_type>::value == | |
| | | true) ) | |
| { | | { | |
|
| const eT* x_mem = x.memptr(); | | const unwrap_check<typename Proxy<T1>::stored_type> tmp(P.Q, t.m); | |
| | | const Mat<eT>& x = tmp.M; | |
| | | | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| | | { | |
| | | const eT* x_mem = x.memptr(); | |
| | | | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) /= x_mem[col]; | |
| | | } | |
| | | } | |
| | | else | |
| { | | { | |
|
| at(0,col) /= x_mem[col]; | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | arrayops::inplace_div( t.colptr(col), x.colptr(col), t_n_rows ); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(u32 col=0; col<t_n_cols; ++col) | | if(t_n_rows == 1) | |
| { | | { | |
|
| arrayops::inplace_div( t.colptr(col), x.colptr(col), t_n_rows ); | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | at(0,col) /= P[col]; | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(u32 col=0; col<t_n_cols; ++col) | |
| | | { | |
| | | eT* t_col_data = t.colptr(col); | |
| | | | |
| | | u32 i,j; | |
| | | for(i=0, j=1; j<t_n_rows; i+=2, j+=2) | |
| | | { | |
| | | const eT val1 = P.at(i,col); | |
| | | const eT val2 = P.at(j,col); | |
| | | | |
| | | t_col_data[i] /= val1; | |
| | | t_col_data[j] /= val2; | |
| | | } | |
| | | | |
| | | if(i < t_n_rows) | |
| | | { | |
| | | t_col_data[i] /= P.at(i,col); | |
| | | } | |
| | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| //! x.submat(...) = y.submat(...) | | //! x.submat(...) = y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::operator= (const subview<eT>& x_in) | | subview<eT>::operator= (const subview<eT>& x_in) | |
| { | | { | |
| | | | |
| skipping to change at line 397 | | skipping to change at line 600 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const bool overlap = check_overlap(x_in); | | const bool overlap = check_overlap(x_in); | |
| | | | |
| Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; | | Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; | |
| const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux
_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; | | const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux
_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; | |
| const subview<eT>& x = overlap ? (*tmp_subview) : x_in; | | const subview<eT>& x = overlap ? (*tmp_subview) : x_in; | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "matrix addition"); | | arma_debug_assert_same_size(t, x, "addition"); | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| for(u32 col=0; col<t_n_cols; ++col) | | for(u32 col=0; col<t_n_cols; ++col) | |
| { | | { | |
| t.at(0,col) += x.at(0,col); | | t.at(0,col) += x.at(0,col); | |
| } | | } | |
| | | | |
| skipping to change at line 439 | | skipping to change at line 642 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const bool overlap = check_overlap(x_in); | | const bool overlap = check_overlap(x_in); | |
| | | | |
| Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; | | Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; | |
| const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux
_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; | | const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux
_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; | |
| const subview<eT>& x = overlap ? (*tmp_subview) : x_in; | | const subview<eT>& x = overlap ? (*tmp_subview) : x_in; | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "matrix subtraction"); | | arma_debug_assert_same_size(t, x, "subtraction"); | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| for(u32 col=0; col<t_n_cols; ++col) | | for(u32 col=0; col<t_n_cols; ++col) | |
| { | | { | |
| t.at(0,col) -= x.at(0,col); | | t.at(0,col) -= x.at(0,col); | |
| } | | } | |
| | | | |
| skipping to change at line 482 | | skipping to change at line 685 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const bool overlap = check_overlap(x_in); | | const bool overlap = check_overlap(x_in); | |
| | | | |
| Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; | | Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; | |
| const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux
_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; | | const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux
_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; | |
| const subview<eT>& x = overlap ? (*tmp_subview) : x_in; | | const subview<eT>& x = overlap ? (*tmp_subview) : x_in; | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "matrix schur product"); | | arma_debug_assert_same_size(t, x, "element-wise multiplication"); | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| for(u32 col=0; col<t_n_cols; ++col) | | for(u32 col=0; col<t_n_cols; ++col) | |
| { | | { | |
| t.at(0,col) *= x.at(0,col); | | t.at(0,col) *= x.at(0,col); | |
| } | | } | |
| | | | |
| skipping to change at line 525 | | skipping to change at line 728 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const bool overlap = check_overlap(x_in); | | const bool overlap = check_overlap(x_in); | |
| | | | |
| Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; | | Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; | |
| const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux
_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; | | const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux
_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; | |
| const subview<eT>& x = overlap ? (*tmp_subview) : x_in; | | const subview<eT>& x = overlap ? (*tmp_subview) : x_in; | |
| | | | |
| subview<eT>& t = *this; | | subview<eT>& t = *this; | |
| | | | |
|
| arma_debug_assert_same_size(t, x, "element-wise matrix division"); | | arma_debug_assert_same_size(t, x, "element-wise division"); | |
| | | | |
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| | | | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| for(u32 col=0; col<t_n_cols; ++col) | | for(u32 col=0; col<t_n_cols; ++col) | |
| { | | { | |
| t.at(0,col) /= x.at(0,col); | | t.at(0,col) /= x.at(0,col); | |
| } | | } | |
| | | | |
| skipping to change at line 812 | | skipping to change at line 1015 | |
| } | | } | |
| | | | |
| //! X += Y.submat(...) | | //! X += Y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::plus_inplace(Mat<eT>& out, const subview<eT>& in) | | subview<eT>::plus_inplace(Mat<eT>& out, const subview<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_assert_same_size(out, in, "matrix addition"); | | arma_debug_assert_same_size(out, in, "addition"); | |
| | | | |
| const u32 n_rows = out.n_rows; | | const u32 n_rows = out.n_rows; | |
| const u32 n_cols = out.n_cols; | | const u32 n_cols = out.n_cols; | |
| | | | |
| if(n_rows == 1) | | if(n_rows == 1) | |
| { | | { | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| for(u32 col=0; col<n_cols; ++col) | | for(u32 col=0; col<n_cols; ++col) | |
| { | | { | |
| | | | |
| skipping to change at line 843 | | skipping to change at line 1046 | |
| } | | } | |
| | | | |
| //! X -= Y.submat(...) | | //! X -= Y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::minus_inplace(Mat<eT>& out, const subview<eT>& in) | | subview<eT>::minus_inplace(Mat<eT>& out, const subview<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_assert_same_size(out, in, "matrix subtraction"); | | arma_debug_assert_same_size(out, in, "subtraction"); | |
| | | | |
| const u32 n_rows = out.n_rows; | | const u32 n_rows = out.n_rows; | |
| const u32 n_cols = out.n_cols; | | const u32 n_cols = out.n_cols; | |
| | | | |
| if(n_rows == 1) | | if(n_rows == 1) | |
| { | | { | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| for(u32 col=0; col<n_cols; ++col) | | for(u32 col=0; col<n_cols; ++col) | |
| { | | { | |
| | | | |
| skipping to change at line 874 | | skipping to change at line 1077 | |
| } | | } | |
| | | | |
| //! X %= Y.submat(...) | | //! X %= Y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::schur_inplace(Mat<eT>& out, const subview<eT>& in) | | subview<eT>::schur_inplace(Mat<eT>& out, const subview<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_assert_same_size(out, in, "matrix schur product"); | | arma_debug_assert_same_size(out, in, "element-wise multiplication"); | |
| | | | |
| const u32 n_rows = out.n_rows; | | const u32 n_rows = out.n_rows; | |
| const u32 n_cols = out.n_cols; | | const u32 n_cols = out.n_cols; | |
| | | | |
| if(n_rows == 1) | | if(n_rows == 1) | |
| { | | { | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| for(u32 col=0; col<n_cols; ++col) | | for(u32 col=0; col<n_cols; ++col) | |
| { | | { | |
| | | | |
| skipping to change at line 905 | | skipping to change at line 1108 | |
| } | | } | |
| | | | |
| //! X /= Y.submat(...) | | //! X /= Y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::div_inplace(Mat<eT>& out, const subview<eT>& in) | | subview<eT>::div_inplace(Mat<eT>& out, const subview<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_assert_same_size(out, in, "element-wise matrix division"); | | arma_debug_assert_same_size(out, in, "element-wise division"); | |
| | | | |
| const u32 n_rows = out.n_rows; | | const u32 n_rows = out.n_rows; | |
| const u32 n_cols = out.n_cols; | | const u32 n_cols = out.n_cols; | |
| | | | |
| if(n_rows == 1) | | if(n_rows == 1) | |
| { | | { | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| for(u32 col=0; col<n_cols; ++col) | | for(u32 col=0; col<n_cols; ++col) | |
| { | | { | |
| | | | |
End of changes. 49 change blocks. |
| 59 lines changed or deleted | | 267 lines changed or added | |
|