| Col_proto.hpp | | Col_proto.hpp | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 67 | |
| inline const Col& operator*=(const subview<eT>& X); | | inline const Col& operator*=(const subview<eT>& X); | |
| | | | |
| inline Col(const subview_cube<eT>& X); | | inline Col(const subview_cube<eT>& X); | |
| inline const Col& operator=(const subview_cube<eT>& X); | | inline const Col& operator=(const subview_cube<eT>& X); | |
| inline const Col& operator*=(const subview_cube<eT>& X); | | inline const Col& operator*=(const subview_cube<eT>& X); | |
| | | | |
| inline Col(const diagview<eT>& X); | | inline Col(const diagview<eT>& X); | |
| inline const Col& operator=(const diagview<eT>& X); | | inline const Col& operator=(const diagview<eT>& X); | |
| inline const Col& operator*=(const diagview<eT>& X); | | inline const Col& operator*=(const diagview<eT>& X); | |
| | | | |
|
| | | inline mat_injector<Col> operator<<(const eT val); | |
| | | | |
| arma_inline eT& row(const u32 row_num); | | arma_inline eT& row(const u32 row_num); | |
| arma_inline eT row(const u32 row_num) const; | | arma_inline eT row(const u32 row_num) const; | |
| | | | |
| arma_inline subview_col<eT> rows(const u32 in_row1, const u32 in_ro
w2); | | arma_inline subview_col<eT> rows(const u32 in_row1, const u32 in_ro
w2); | |
| arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_ro
w2) const; | | arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_ro
w2) const; | |
| | | | |
| template<typename T1, typename op_type> inline Col(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline Col(cons
t Op<T1, op_type>& X); | |
| template<typename T1, typename op_type> inline const Col& operator=(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline const Col& operator=(cons
t Op<T1, op_type>& X); | |
| template<typename T1, typename op_type> inline const Col& operator*=(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline const Col& operator*=(cons
t Op<T1, op_type>& X); | |
| | | | |
| | | | |
| skipping to change at line 99 | | skipping to change at line 101 | |
| template<typename T1, typename T2, typename eglue_type> inline
Col(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline
Col(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Col&
operator=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Col&
operator=(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Col&
operator*=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Col&
operator*=(const eGlue<T1, T2, eglue_type>& X); | |
| | | | |
| template<typename T1, typename T2, typename glue_type> inline
Col(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline
Col(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Col&
operator=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Col&
operator=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Col&
operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Col&
operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | | |
| inline void set_size(const u32 n_elem); | | inline void set_size(const u32 n_elem); | |
| inline void set_size(const u32 n_rows, const u32 n_cols); | | inline void set_size(const u32 n_rows, const u32 n_cols); | |
|
| | | inline void reshape(const u32 n_rows, const u32 n_cols, const u32 dim =
0); | |
| | | | |
| template<typename eT2> | | template<typename eT2> | |
| inline void copy_size(const Mat<eT2>& m); | | inline void copy_size(const Mat<eT2>& m); | |
| | | | |
| inline void zeros(); | | inline void zeros(); | |
| inline void zeros(const u32 n_elem); | | inline void zeros(const u32 n_elem); | |
| inline void zeros(const u32 n_rows, const u32 n_cols); | | inline void zeros(const u32 n_rows, const u32 n_cols); | |
| | | | |
| inline void ones(); | | inline void ones(); | |
| inline void ones(const u32 n_elem); | | inline void ones(const u32 n_elem); | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 3 lines changed or added | |
|
| Mat_proto.hpp | | Mat_proto.hpp | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 97 | |
| | | | |
| //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); | |
| | | | |
|
| | | inline mat_injector<Mat> operator<<(const eT val); | |
| | | 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_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<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); | |
| | | | |
| skipping to change at line 211 | | skipping to change at line 214 | |
| inline void raw_print(const std::string extra_text = "") const; | | inline void raw_print(const std::string extra_text = "") const; | |
| inline void raw_print(std::ostream& user_stream, const std::string extra_
text = "") const; | | inline void raw_print(std::ostream& user_stream, const std::string extra_
text = "") const; | |
| | | | |
| inline void raw_print_trans(const std::string extra_text = "") const; | | inline void raw_print_trans(const std::string extra_text = "") const; | |
| inline void raw_print_trans(std::ostream& user_stream, const std::string
extra_text = "") const; | | inline void raw_print_trans(std::ostream& user_stream, const std::string
extra_text = "") const; | |
| | | | |
| template<typename eT2> | | template<typename eT2> | |
| inline void copy_size(const Mat<eT2>& m); | | inline void copy_size(const Mat<eT2>& m); | |
| | | | |
| inline void set_size(const u32 in_rows, const u32 in_cols); | | inline void set_size(const u32 in_rows, const u32 in_cols); | |
|
| | | inline void reshape(const u32 in_rows, const u32 in_cols, const u32 dim
= 0); | |
| | | | |
| arma_hot inline void fill(const eT val); | | arma_hot inline void fill(const eT val); | |
| | | | |
| inline void zeros(); | | inline void zeros(); | |
| inline void zeros(const u32 in_rows, const u32 in_cols); | | inline void zeros(const u32 in_rows, const u32 in_cols); | |
| | | | |
| inline void ones(); | | inline void ones(); | |
| inline void ones(const u32 in_rows, const u32 in_cols); | | inline void ones(const u32 in_rows, const u32 in_cols); | |
| | | | |
| inline void reset(); | | inline void reset(); | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 4 lines changed or added | |
|
| Row_proto.hpp | | Row_proto.hpp | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 68 | |
| inline const Row& operator*=(const subview<eT>& X); | | inline const Row& operator*=(const subview<eT>& X); | |
| | | | |
| inline Row(const subview_cube<eT>& X); | | inline Row(const subview_cube<eT>& X); | |
| inline const Row& operator=(const subview_cube<eT>& X); | | inline const Row& operator=(const subview_cube<eT>& X); | |
| inline const Row& operator*=(const subview_cube<eT>& X); | | inline const Row& operator*=(const subview_cube<eT>& X); | |
| | | | |
| inline explicit Row(const diagview<eT>& X); | | inline explicit Row(const diagview<eT>& X); | |
| inline const Row& operator=(const diagview<eT>& X); | | inline const Row& operator=(const diagview<eT>& X); | |
| inline const Row& operator*=(const diagview<eT>& X); | | inline const Row& operator*=(const diagview<eT>& X); | |
| | | | |
|
| | | inline mat_injector<Row> operator<<(const eT val); | |
| | | | |
| arma_inline eT& col(const u32 col_num); | | arma_inline eT& col(const u32 col_num); | |
| arma_inline eT col(const u32 col_num) const; | | arma_inline eT col(const u32 col_num) const; | |
| | | | |
| arma_inline subview_row<eT> cols(const u32 in_col1, const u32 in_co
l2); | | arma_inline subview_row<eT> cols(const u32 in_col1, const u32 in_co
l2); | |
| arma_inline const subview_row<eT> cols(const u32 in_col1, const u32 in_co
l2) const; | | arma_inline const subview_row<eT> cols(const u32 in_col1, const u32 in_co
l2) const; | |
| | | | |
| template<typename T1, typename op_type> inline Row(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline Row(cons
t Op<T1, op_type>& X); | |
| template<typename T1, typename op_type> inline const Row& operator=(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline const Row& operator=(cons
t Op<T1, op_type>& X); | |
| template<typename T1, typename op_type> inline const Row& operator*=(cons
t Op<T1, op_type>& X); | | template<typename T1, typename op_type> inline const Row& operator*=(cons
t Op<T1, op_type>& X); | |
| | | | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 102 | |
| template<typename T1, typename T2, typename eglue_type> inline
Row(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline
Row(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Row&
operator=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Row&
operator=(const eGlue<T1, T2, eglue_type>& X); | |
| template<typename T1, typename T2, typename eglue_type> inline const Row&
operator*=(const eGlue<T1, T2, eglue_type>& X); | | template<typename T1, typename T2, typename eglue_type> inline const Row&
operator*=(const eGlue<T1, T2, eglue_type>& X); | |
| | | | |
| template<typename T1, typename T2, typename glue_type> inline
Row(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline
Row(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Row&
operator=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Row&
operator=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| template<typename T1, typename T2, typename glue_type> inline const Row&
operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | | template<typename T1, typename T2, typename glue_type> inline const Row&
operator*=(const mtGlue<eT, T1, T2, glue_type>& X); | |
| | | | |
| inline void set_size(const u32 N); | | inline void set_size(const u32 N); | |
| inline void set_size(const u32 n_rows, const u32 n_cols); | | inline void set_size(const u32 n_rows, const u32 n_cols); | |
|
| | | inline void reshape(const u32 n_rows, const u32 n_cols, const u32 dim =
0); | |
| | | | |
| template<typename eT2> | | template<typename eT2> | |
| inline void copy_size(const Mat<eT2>& m); | | inline void copy_size(const Mat<eT2>& m); | |
| | | | |
| inline void zeros(); | | inline void zeros(); | |
| inline void zeros(const u32 N); | | inline void zeros(const u32 N); | |
| inline void zeros(const u32 n_rows, const u32 n_cols); | | inline void zeros(const u32 n_rows, const u32 n_cols); | |
| | | | |
| inline void ones(); | | inline void ones(); | |
| inline void ones(const u32 N); | | inline void ones(const u32 N); | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 3 lines changed or added | |
|
| armadillo | | armadillo | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| // for any purpose. You can redistribute this file | | // for any purpose. You can redistribute this file | |
| // and/or modify it under the terms of the GNU | | // and/or modify it under the terms of the GNU | |
| // Lesser General Public License (LGPL) as published | | // Lesser General Public License (LGPL) as published | |
| // by the Free Software Foundation, either version 3 | | // by the Free Software Foundation, either version 3 | |
| // of the License or (at your option) any later version. | | // of the License or (at your option) any later version. | |
| // (see http://www.opensource.org/licenses for more info) | | // (see http://www.opensource.org/licenses for more info) | |
| | | | |
| #ifndef ARMA_INCLUDES | | #ifndef ARMA_INCLUDES | |
| #define ARMA_INCLUDES | | #define ARMA_INCLUDES | |
| | | | |
|
| #include "armadillo_bits/config.hpp" | | | |
| #include "armadillo_bits/compiler_setup.hpp" | | | |
| | | | |
| #include <cstdlib> | | #include <cstdlib> | |
| #include <cstring> | | #include <cstring> | |
| #include <climits> | | #include <climits> | |
| #include <cmath> | | #include <cmath> | |
| | | | |
| #include <iostream> | | #include <iostream> | |
| #include <fstream> | | #include <fstream> | |
| #include <sstream> | | #include <sstream> | |
| #include <stdexcept> | | #include <stdexcept> | |
| #include <limits> | | #include <limits> | |
| #include <algorithm> | | #include <algorithm> | |
| #include <complex> | | #include <complex> | |
| #include <vector> | | #include <vector> | |
| | | | |
|
| | | #include "armadillo_bits/config.hpp" | |
| | | #include "armadillo_bits/compiler_setup.hpp" | |
| | | | |
| #if defined(ARMA_HAVE_GETTIMEOFDAY) | | #if defined(ARMA_HAVE_GETTIMEOFDAY) | |
| #include <sys/time.h> | | #include <sys/time.h> | |
| #undef ARMA_USE_BOOST_DATE | | #undef ARMA_USE_BOOST_DATE | |
| #endif | | #endif | |
| | | | |
| #if defined(ARMA_USE_BOOST_DATE) | | #if defined(ARMA_USE_BOOST_DATE) | |
| #include <boost/date_time/posix_time/posix_time.hpp> | | #include <boost/date_time/posix_time/posix_time.hpp> | |
| #endif | | #endif | |
| | | | |
| #if defined(ARMA_HAVE_STD_TR1) | | #if defined(ARMA_HAVE_STD_TR1) | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 129 | |
| #include "armadillo_bits/podarray_proto.hpp" | | #include "armadillo_bits/podarray_proto.hpp" | |
| | | | |
| #include "armadillo_bits/blas_proto.hpp" | | #include "armadillo_bits/blas_proto.hpp" | |
| #include "armadillo_bits/lapack_proto.hpp" | | #include "armadillo_bits/lapack_proto.hpp" | |
| #include "armadillo_bits/atlas_proto.hpp" | | #include "armadillo_bits/atlas_proto.hpp" | |
| #include "armadillo_bits/auxlib_proto.hpp" | | #include "armadillo_bits/auxlib_proto.hpp" | |
| | | | |
| #include "armadillo_bits/Base.hpp" | | #include "armadillo_bits/Base.hpp" | |
| #include "armadillo_bits/BaseCube.hpp" | | #include "armadillo_bits/BaseCube.hpp" | |
| | | | |
|
| | | #include "armadillo_bits/injector_proto.hpp" | |
| | | | |
| #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/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_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" | |
| | | | |
| skipping to change at line 354 | | skipping to change at line 356 | |
| | | | |
| #include "armadillo_bits/eop_core_meat.hpp" | | #include "armadillo_bits/eop_core_meat.hpp" | |
| #include "armadillo_bits/eop_cube_core_meat.hpp" | | #include "armadillo_bits/eop_cube_core_meat.hpp" | |
| | | | |
| #include "armadillo_bits/eglue_core_meat.hpp" | | #include "armadillo_bits/eglue_core_meat.hpp" | |
| #include "armadillo_bits/eglue_cube_core_meat.hpp" | | #include "armadillo_bits/eglue_cube_core_meat.hpp" | |
| | | | |
| #include "armadillo_bits/podarray_meat.hpp" | | #include "armadillo_bits/podarray_meat.hpp" | |
| #include "armadillo_bits/auxlib_meat.hpp" | | #include "armadillo_bits/auxlib_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_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" | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 7 lines changed or added | |
|
| eop_aux.hpp | | eop_aux.hpp | |
| | | | |
| skipping to change at line 114 | | skipping to change at line 114 | |
| | | | |
| }; | | }; | |
| | | | |
| //! use of the SFINAE approach to work around compiler limitations | | //! use of the SFINAE approach to work around compiler limitations | |
| //! http://en.wikipedia.org/wiki/SFINAE | | //! http://en.wikipedia.org/wiki/SFINAE | |
| | | | |
| class eop_aux | | class eop_aux | |
| { | | { | |
| public: | | public: | |
| | | | |
|
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result acos (const eT& x) { return std::acos(double(x)); } | | :result acos (const eT x) { return eT( std::acos(double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result asin (const eT& x) { return std::asin(double(x)); } | | :result asin (const eT x) { return eT( std::asin(double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result atan (const eT& x) { return std::atan(double(x)); } | | :result atan (const eT x) { return eT( std::atan(double(x)) ); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_float_only<eT>::re | | template<typename eT> arma_inline static typename arma_float_only<eT>::re | |
| sult acos (const eT& x) { return std::acos(x); } | | sult acos (const eT x) { return std::acos(x); } | |
| template<typename eT> arma_inline static typename arma_float_only<eT>::re | | template<typename eT> arma_inline static typename arma_float_only<eT>::re | |
| sult asin (const eT& x) { return std::asin(x); } | | sult asin (const eT x) { return std::asin(x); } | |
| template<typename eT> arma_inline static typename arma_float_only<eT>::re | | template<typename eT> arma_inline static typename arma_float_only<eT>::re | |
| sult atan (const eT& x) { return std::atan(x); } | | sult atan (const eT x) { return std::atan(x); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | | template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | |
| t acos (const eT& x) { return arma_acos(x); } | | t acos (const eT x) { return arma_acos(x); } | |
| template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | | template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | |
| t asin (const eT& x) { return arma_asin(x); } | | t asin (const eT x) { return arma_asin(x); } | |
| template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | | template<typename eT> arma_inline static typename arma_cx_only<eT>::resul | |
| t atan (const eT& x) { return arma_atan(x); } | | t atan (const eT x) { return arma_atan(x); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result acosh (const eT& x) { return arma_acosh(double(x)); } | | :result acosh (const eT x) { return eT( arma_acosh(double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result asinh (const eT& x) { return arma_asinh(double(x)); } | | :result asinh (const eT x) { return eT( arma_asinh(double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result atanh (const eT& x) { return arma_atanh(double(x)); } | | :result atanh (const eT x) { return eT( arma_atanh(double(x)) ); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result acosh (const eT& x) { return arma_acosh(x); } | | T>::result acosh (const eT x) { return arma_acosh(x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result asinh (const eT& x) { return arma_asinh(x); } | | T>::result asinh (const eT x) { return arma_asinh(x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result atanh (const eT& x) { return arma_atanh(x); } | | T>::result atanh (const eT x) { return arma_atanh(x); } | |
| | | | |
| template<typename eT> arma_inline static eT conj(const eT& | | template<typename eT> arma_inline static typename arma_not_cx<eT>::result | |
| x) { return x; } | | conj(const eT x) { return x; } | |
| template<typename T> arma_inline static std::complex<T> conj(const std:: | | template<typename T> arma_inline static std::complex<T> | |
| complex<T>& x) { return std::conj(x); } | | conj(const std::complex<T> x) { return std::conj(x); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result sqrt (const eT& x) { return std::sqrt (double(x)); } | | :result sqrt (const eT x) { return eT( std::sqrt (double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result log10 (const eT& x) { return std::log10(double(x)); } | | :result log10 (const eT x) { return eT( std::log10(double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result log (const eT& x) { return std::log (double(x)); } | | :result log (const eT x) { return eT( std::log (double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result exp (const eT& x) { return std::exp (double(x)); } | | :result exp (const eT x) { return eT( std::exp (double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result cos (const eT& x) { return std::cos (double(x)); } | | :result cos (const eT x) { return eT( std::cos (double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result sin (const eT& x) { return std::sin (double(x)); } | | :result sin (const eT x) { return eT( std::sin (double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result tan (const eT& x) { return std::tan (double(x)); } | | :result tan (const eT x) { return eT( std::tan (double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result cosh (const eT& x) { return std::cosh (double(x)); } | | :result cosh (const eT x) { return eT( std::cosh (double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result sinh (const eT& x) { return std::sinh (double(x)); } | | :result sinh (const eT x) { return eT( std::sinh (double(x)) ); } | |
| template<typename eT> arma_inline static typename arma_integral_only<eT>: | | template<typename eT> arma_inline static typename arma_integral_only<eT>: | |
| :result tanh (const eT& x) { return std::tanh (double(x)); } | | :result tanh (const eT x) { return eT( std::tanh (double(x)) ); } | |
| | | | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result sqrt (const eT& x) { return std::sqrt (x); } | | T>::result sqrt (const eT x) { return std::sqrt (x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result log10 (const eT& x) { return std::log10(x); } | | T>::result log10 (const eT x) { return std::log10(x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result log (const eT& x) { return std::log (x); } | | T>::result log (const eT x) { return std::log (x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result exp (const eT& x) { return std::exp (x); } | | T>::result exp (const eT x) { return std::exp (x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result cos (const eT& x) { return std::cos (x); } | | T>::result cos (const eT x) { return std::cos (x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result sin (const eT& x) { return std::sin (x); } | | T>::result sin (const eT x) { return std::sin (x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result tan (const eT& x) { return std::tan (x); } | | T>::result tan (const eT x) { return std::tan (x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result cosh (const eT& x) { return std::cosh (x); } | | T>::result cosh (const eT x) { return std::cosh (x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result sinh (const eT& x) { return std::sinh (x); } | | T>::result sinh (const eT x) { return std::sinh (x); } | |
| template<typename eT> arma_inline static typename arma_float_or_cx_only<e | | template<typename eT> arma_inline static typename arma_float_or_cx_only<e | |
| T>::result tanh (const eT& x) { return std::tanh (x); } | | T>::result tanh (const eT x) { return std::tanh (x); } | |
| | | | |
| | | template<typename eT> arma_inline static typename arma_unsigned_integral_ | |
| | | only<eT>::result neg (const eT x) { return x; } | |
| | | template<typename eT> arma_inline static typename arma_signed_only<eT>::r | |
| | | esult neg (const eT x) { return -x; } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
| static | | static | |
| typename arma_float_or_cx_only<T1>::result | | typename arma_float_or_cx_only<T1>::result | |
| pow(const T1 base, const T2 exponent) | | pow(const T1 base, const T2 exponent) | |
| { | | { | |
| return std::pow(base, exponent); | | return std::pow(base, exponent); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 199 | | skipping to change at line 202 | |
| typename arma_integral_only<T1>::result | | typename arma_integral_only<T1>::result | |
| pow_int(const T1 base, const int exponent) | | pow_int(const T1 base, const int exponent) | |
| { | | { | |
| return T1( std::pow( double(base), exponent) ); | | return T1( std::pow( double(base), exponent) ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| static | | static | |
| typename arma_integral_only<eT>::result | | typename arma_integral_only<eT>::result | |
|
| direct_eps(const eT& x) | | direct_eps(const eT x) | |
| { | | { | |
| return eT(0); | | return eT(0); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| static | | static | |
| typename arma_float_only<eT>::result | | typename arma_float_only<eT>::result | |
|
| direct_eps(const eT& x) | | direct_eps(const eT x) | |
| { | | { | |
| //arma_extra_debug_sigprint(); | | //arma_extra_debug_sigprint(); | |
| | | | |
| // acording to IEEE Standard for Floating-Point Arithmetic (IEEE 754) | | // acording to IEEE Standard for Floating-Point Arithmetic (IEEE 754) | |
| // the mantissa length for double is 53 bits = std::numeric_limits<doub
le>::digits | | // the mantissa length for double is 53 bits = std::numeric_limits<doub
le>::digits | |
| // the mantissa length for float is 24 bits = std::numeric_limits<floa
t >::digits | | // the mantissa length for float is 24 bits = std::numeric_limits<floa
t >::digits | |
| | | | |
| //return std::pow( std::numeric_limits<eT>::radix, (std::floor(std::log
10(std::abs(x))/std::log10(std::numeric_limits<eT>::radix))-(std::numeric_l
imits<eT>::digits-1)) ); | | //return std::pow( std::numeric_limits<eT>::radix, (std::floor(std::log
10(std::abs(x))/std::log10(std::numeric_limits<eT>::radix))-(std::numeric_l
imits<eT>::digits-1)) ); | |
| | | | |
| const eT radix_eT = eT(std::numeric_limits<eT>::radix); | | const eT radix_eT = eT(std::numeric_limits<eT>::radix); | |
| const eT digits_m1_eT = eT(std::numeric_limits<eT>::digits - 1); | | const eT digits_m1_eT = eT(std::numeric_limits<eT>::digits - 1); | |
| | | | |
| // return std::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/std
::log10(radix_eT)) - digits_m1_eT) ); | | // return std::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/std
::log10(radix_eT)) - digits_m1_eT) ); | |
| return eop_aux::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/st
d::log10(radix_eT)) - digits_m1_eT) ); | | return eop_aux::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/st
d::log10(radix_eT)) - digits_m1_eT) ); | |
| } | | } | |
| | | | |
| template<typename T> | | template<typename T> | |
| inline | | inline | |
| static | | static | |
| typename arma_float_only<T>::result | | typename arma_float_only<T>::result | |
|
| direct_eps(const std::complex<T>& x) | | direct_eps(const std::complex<T> x) | |
| { | | { | |
| //arma_extra_debug_sigprint(); | | //arma_extra_debug_sigprint(); | |
| | | | |
| //return std::pow( std::numeric_limits<T>::radix, (std::floor(std::log1
0(std::abs(x))/std::log10(std::numeric_limits<T>::radix))-(std::numeric_lim
its<T>::digits-1)) ); | | //return std::pow( std::numeric_limits<T>::radix, (std::floor(std::log1
0(std::abs(x))/std::log10(std::numeric_limits<T>::radix))-(std::numeric_lim
its<T>::digits-1)) ); | |
| | | | |
| const T radix_T = T(std::numeric_limits<T>::radix); | | const T radix_T = T(std::numeric_limits<T>::radix); | |
| const T digits_m1_T = T(std::numeric_limits<T>::digits - 1); | | const T digits_m1_T = T(std::numeric_limits<T>::digits - 1); | |
| | | | |
| return std::pow( radix_T, T(std::floor(std::log10(std::abs(x))/std::log
10(radix_T)) - digits_m1_T) ); | | return std::pow( radix_T, T(std::floor(std::log10(std::abs(x))/std::log
10(radix_T)) - digits_m1_T) ); | |
| } | | } | |
| | | | |
| //! work around a bug in GCC 4.4 | | //! work around a bug in GCC 4.4 | |
| template<typename eT> arma_inline static | | template<typename eT> arma_inline static | |
|
| typename arma_unsigned_integral_only<eT>::result arma_abs(const eT& x)
{ return x; } | | typename arma_unsigned_integral_only<eT>::result arma_abs(const eT x)
{ return x; } | |
| | | | |
| template<typename eT> arma_inline static | | template<typename eT> arma_inline static | |
|
| typename arma_signed_integral_only<eT>::result arma_abs(const eT& x)
{ return std::abs(x); } | | typename arma_signed_integral_only<eT>::result arma_abs(const eT x)
{ return std::abs(x); } | |
| | | | |
| template<typename eT> arma_inline static | | template<typename eT> arma_inline static | |
|
| typename arma_float_only<eT>::result arma_abs(const eT& x)
{ return std::abs(x); } | | typename arma_float_only<eT>::result arma_abs(const eT x)
{ return std::abs(x); } | |
| | | | |
| template<typename T> arma_inline static | | template<typename T> arma_inline static | |
|
| typename arma_float_only<T>::result arma_abs(const std::comp
lex<T>& x) { return std::abs(x); } | | typename arma_float_only<T>::result arma_abs(const std::comp
lex<T> x) { return std::abs(x); } | |
| | | | |
| template<typename eT, typename eop_type> | | template<typename eT, typename eop_type> | |
| arma_inline | | arma_inline | |
| static | | static | |
| eT | | eT | |
| generate() | | generate() | |
| { | | { | |
| if(is_same_type<eop_type, eop_randu >::value == true) { re
turn eT(eop_aux_randu<eT>()); } | | if(is_same_type<eop_type, eop_randu >::value == true) { re
turn eT(eop_aux_randu<eT>()); } | |
| else if(is_same_type<eop_type, eop_randn >::value == true) { re
turn eT(eop_aux_randn<eT>()); } | | else if(is_same_type<eop_type, eop_randn >::value == true) { re
turn eT(eop_aux_randn<eT>()); } | |
| else if(is_same_type<eop_type, eop_zeros >::value == true) { re
turn eT(0); } | | else if(is_same_type<eop_type, eop_zeros >::value == true) { re
turn eT(0); } | |
| | | | |
End of changes. 8 change blocks. |
| 88 lines changed or deleted | | 93 lines changed or added | |
|
| eop_core_meat.hpp | | eop_core_meat.hpp | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| template<typename T1> | | template<typename T1> | |
| arma_hot | | arma_hot | |
| arma_inline | | arma_inline | |
| typename T1::elem_type | | typename T1::elem_type | |
| eop_core<eop_type>::process(const eOp<T1, eop_type>& x, const typename T1::
elem_type val) | | eop_core<eop_type>::process(const eOp<T1, eop_type>& x, const typename T1::
elem_type val) | |
| { | | { | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| // the optimiser will keep only one return statement | | // the optimiser will keep only one return statement | |
| | | | |
|
| if(is_same_type<eop_type, eop_neg >::value == true) { r | | if(is_same_type<eop_type, eop_scalar_plus >::value == true) { r | |
| eturn -val; } | | eturn val + x.aux; } | |
| else if(is_same_type<eop_type, eop_scalar_plus >::value == true) { r | | | |
| eturn val + x.aux; } | | | |
| else if(is_same_type<eop_type, eop_scalar_minus_pre >::value == true) { r
eturn x.aux - val; } | | else if(is_same_type<eop_type, eop_scalar_minus_pre >::value == true) { r
eturn x.aux - val; } | |
| else if(is_same_type<eop_type, eop_scalar_minus_post>::value == true) { r
eturn val - x.aux; } | | else if(is_same_type<eop_type, eop_scalar_minus_post>::value == true) { r
eturn val - x.aux; } | |
| else if(is_same_type<eop_type, eop_scalar_times >::value == true) { r
eturn val * x.aux; } | | else if(is_same_type<eop_type, eop_scalar_times >::value == true) { r
eturn val * x.aux; } | |
| else if(is_same_type<eop_type, eop_scalar_div_pre >::value == true) { r
eturn x.aux / val; } | | else if(is_same_type<eop_type, eop_scalar_div_pre >::value == true) { r
eturn x.aux / val; } | |
| else if(is_same_type<eop_type, eop_scalar_div_post >::value == true) { r
eturn val / x.aux; } | | else if(is_same_type<eop_type, eop_scalar_div_post >::value == true) { r
eturn val / x.aux; } | |
| else if(is_same_type<eop_type, eop_square >::value == true) { r
eturn val*val; } | | else if(is_same_type<eop_type, eop_square >::value == true) { r
eturn val*val; } | |
|
| | | else if(is_same_type<eop_type, eop_neg >::value == true) { r
eturn eop_aux::neg(val); } | |
| else if(is_same_type<eop_type, eop_sqrt >::value == true) { r
eturn eop_aux::sqrt(val); } | | else if(is_same_type<eop_type, eop_sqrt >::value == true) { r
eturn eop_aux::sqrt(val); } | |
| else if(is_same_type<eop_type, eop_log10 >::value == true) { r
eturn eop_aux::log10(val); } | | else if(is_same_type<eop_type, eop_log10 >::value == true) { r
eturn eop_aux::log10(val); } | |
| else if(is_same_type<eop_type, eop_log >::value == true) { r
eturn eop_aux::log(val); } | | else if(is_same_type<eop_type, eop_log >::value == true) { r
eturn eop_aux::log(val); } | |
| else if(is_same_type<eop_type, eop_trunc_log >::value == true) { r
eturn arma::trunc_log(val); } | | else if(is_same_type<eop_type, eop_trunc_log >::value == true) { r
eturn arma::trunc_log(val); } | |
| else if(is_same_type<eop_type, eop_exp >::value == true) { r
eturn eop_aux::exp(val); } | | else if(is_same_type<eop_type, eop_exp >::value == true) { r
eturn eop_aux::exp(val); } | |
| else if(is_same_type<eop_type, eop_trunc_exp >::value == true) { r
eturn arma::trunc_exp(val); } | | else if(is_same_type<eop_type, eop_trunc_exp >::value == true) { r
eturn arma::trunc_exp(val); } | |
| else if(is_same_type<eop_type, eop_cos >::value == true) { r
eturn eop_aux::cos(val); } | | else if(is_same_type<eop_type, eop_cos >::value == true) { r
eturn eop_aux::cos(val); } | |
| else if(is_same_type<eop_type, eop_sin >::value == true) { r
eturn eop_aux::sin(val); } | | else if(is_same_type<eop_type, eop_sin >::value == true) { r
eturn eop_aux::sin(val); } | |
| else if(is_same_type<eop_type, eop_tan >::value == true) { r
eturn eop_aux::tan(val); } | | else if(is_same_type<eop_type, eop_tan >::value == true) { r
eturn eop_aux::tan(val); } | |
| else if(is_same_type<eop_type, eop_acos >::value == true) { r
eturn eop_aux::acos(val); } | | else if(is_same_type<eop_type, eop_acos >::value == true) { r
eturn eop_aux::acos(val); } | |
| | | | |
End of changes. 2 change blocks. |
| 4 lines changed or deleted | | 3 lines changed or added | |
|
| eop_cube_core_meat.hpp | | eop_cube_core_meat.hpp | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| template<typename T1> | | template<typename T1> | |
| arma_hot | | arma_hot | |
| arma_inline | | arma_inline | |
| typename T1::elem_type | | typename T1::elem_type | |
| eop_cube_core<eop_cube_type>::process(const eOpCube<T1, eop_cube_type>& x,
const typename T1::elem_type val) | | eop_cube_core<eop_cube_type>::process(const eOpCube<T1, eop_cube_type>& x,
const typename T1::elem_type val) | |
| { | | { | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| // the optimiser will keep only one return statement | | // the optimiser will keep only one return statement | |
| | | | |
|
| if(is_same_type<eop_cube_type, eop_cube_neg >::value == | | if(is_same_type<eop_cube_type, eop_cube_scalar_plus >::value == | |
| true) { return -val; } | | true) { return val + x.aux; } | |
| else if(is_same_type<eop_cube_type, eop_cube_scalar_plus >::value == | | | |
| true) { return val + x.aux; } | | | |
| else if(is_same_type<eop_cube_type, eop_cube_scalar_minus_pre >::value ==
true) { return x.aux - val; } | | else if(is_same_type<eop_cube_type, eop_cube_scalar_minus_pre >::value ==
true) { return x.aux - val; } | |
| else if(is_same_type<eop_cube_type, eop_cube_scalar_minus_post>::value ==
true) { return val - x.aux; } | | else if(is_same_type<eop_cube_type, eop_cube_scalar_minus_post>::value ==
true) { return val - x.aux; } | |
| else if(is_same_type<eop_cube_type, eop_cube_scalar_times >::value ==
true) { return val * x.aux; } | | else if(is_same_type<eop_cube_type, eop_cube_scalar_times >::value ==
true) { return val * x.aux; } | |
| else if(is_same_type<eop_cube_type, eop_cube_scalar_div_pre >::value ==
true) { return x.aux / val; } | | else if(is_same_type<eop_cube_type, eop_cube_scalar_div_pre >::value ==
true) { return x.aux / val; } | |
| else if(is_same_type<eop_cube_type, eop_cube_scalar_div_post >::value ==
true) { return val / x.aux; } | | else if(is_same_type<eop_cube_type, eop_cube_scalar_div_post >::value ==
true) { return val / x.aux; } | |
| else if(is_same_type<eop_cube_type, eop_cube_square >::value ==
true) { return val*val; } | | else if(is_same_type<eop_cube_type, eop_cube_square >::value ==
true) { return val*val; } | |
|
| | | else if(is_same_type<eop_cube_type, eop_cube_neg >::value ==
true) { return eop_aux::neg(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_sqrt >::value ==
true) { return eop_aux::sqrt(val); } | | else if(is_same_type<eop_cube_type, eop_cube_sqrt >::value ==
true) { return eop_aux::sqrt(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_log10 >::value ==
true) { return eop_aux::log10(val); } | | else if(is_same_type<eop_cube_type, eop_cube_log10 >::value ==
true) { return eop_aux::log10(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_log >::value ==
true) { return eop_aux::log(val); } | | else if(is_same_type<eop_cube_type, eop_cube_log >::value ==
true) { return eop_aux::log(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_trunc_log >::value ==
true) { return arma::trunc_log(val); } | | else if(is_same_type<eop_cube_type, eop_cube_trunc_log >::value ==
true) { return arma::trunc_log(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_exp >::value ==
true) { return eop_aux::exp(val); } | | else if(is_same_type<eop_cube_type, eop_cube_exp >::value ==
true) { return eop_aux::exp(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_trunc_exp >::value ==
true) { return arma::trunc_exp(val); } | | else if(is_same_type<eop_cube_type, eop_cube_trunc_exp >::value ==
true) { return arma::trunc_exp(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_cos >::value ==
true) { return eop_aux::cos(val); } | | else if(is_same_type<eop_cube_type, eop_cube_cos >::value ==
true) { return eop_aux::cos(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_cosh >::value ==
true) { return eop_aux::cosh(val); } | | else if(is_same_type<eop_cube_type, eop_cube_cosh >::value ==
true) { return eop_aux::cosh(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_acos >::value ==
true) { return eop_aux::acos(val); } | | else if(is_same_type<eop_cube_type, eop_cube_acos >::value ==
true) { return eop_aux::acos(val); } | |
| else if(is_same_type<eop_cube_type, eop_cube_acosh >::value ==
true) { return eop_aux::acosh(val); } | | else if(is_same_type<eop_cube_type, eop_cube_acosh >::value ==
true) { return eop_aux::acosh(val); } | |
| | | | |
End of changes. 2 change blocks. |
| 4 lines changed or deleted | | 3 lines changed or added | |
|
| field_proto.hpp | | field_proto.hpp | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| // 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 field | | //! \addtogroup field | |
| //! @{ | | //! @{ | |
| | | | |
|
| | | struct field_prealloc_n_elem | |
| | | { | |
| | | static const u32 val = 16; | |
| | | }; | |
| | | | |
| //! A lightweight 2D container for abitrary objects | | //! A lightweight 2D container for abitrary objects | |
| //! (the objects must have a copy constructor) | | //! (the objects must have a copy constructor) | |
| | | | |
| template<typename oT> | | template<typename oT> | |
| class field | | class field | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef oT object_type; | | typedef oT object_type; | |
| | | | |
| const u32 n_rows; //!< number of rows in the field (read-only) | | const u32 n_rows; //!< number of rows in the field (read-only) | |
| const u32 n_cols; //!< number of columns in the field (read-only) | | const u32 n_cols; //!< number of columns in the field (read-only) | |
| const u32 n_elem; //!< number of elements in the field (read-only) | | const u32 n_elem; //!< number of elements in the field (read-only) | |
| | | | |
| private: | | private: | |
| | | | |
| arma_aligned oT** mem; //!< pointer to memory used by the obj
ect | | arma_aligned oT** mem; //!< pointer to memory used by the obj
ect | |
|
| arma_aligned oT* mem_local[ 16 ]; //!< Internal memory, to avoid calling | | arma_aligned oT* mem_local[ field_prealloc_n_elem::val ]; | |
| the 'new' operator for small amounts of memory | | //!< Internal memory, to avoid calling the 'new' operator for small amoun | |
| | | ts of memory | |
| | | | |
| public: | | public: | |
| | | | |
| inline ~field(); | | inline ~field(); | |
| inline field(); | | inline field(); | |
| | | | |
| inline field(const field& x); | | inline field(const field& x); | |
| inline const field& operator=(const field& x); | | inline const field& operator=(const field& x); | |
| | | | |
| inline field(const subview_field<oT>& x); | | inline field(const subview_field<oT>& x); | |
| | | | |
| skipping to change at line 71 | | skipping to change at line 77 | |
| | | | |
| arma_inline oT& operator()(const u32 i); | | arma_inline oT& operator()(const u32 i); | |
| arma_inline const oT& operator()(const u32 i) const; | | arma_inline const oT& operator()(const u32 i) const; | |
| | | | |
| arma_inline oT& at(const u32 row, const u32 col); | | arma_inline oT& at(const u32 row, const u32 col); | |
| arma_inline const oT& at(const u32 row, const u32 col) const; | | arma_inline const oT& at(const u32 row, const u32 col) const; | |
| | | | |
| arma_inline oT& operator()(const u32 row, const u32 col); | | arma_inline oT& operator()(const u32 row, const u32 col); | |
| arma_inline const oT& operator()(const u32 row, const u32 col) const; | | arma_inline const oT& operator()(const u32 row, const u32 col) const; | |
| | | | |
|
| | | inline field_injector<field> operator<<(const oT& val); | |
| | | inline field_injector<field> operator<<(const injector_helper x); | |
| | | | |
| inline subview_field<oT> row(const u32 row_num); | | inline subview_field<oT> row(const u32 row_num); | |
| inline const subview_field<oT> row(const u32 row_num) const; | | inline const subview_field<oT> row(const u32 row_num) const; | |
| | | | |
| inline subview_field<oT> col(const u32 col_num); | | inline subview_field<oT> col(const u32 col_num); | |
| inline const subview_field<oT> col(const u32 col_num) const; | | inline const subview_field<oT> col(const u32 col_num) const; | |
| | | | |
| inline subview_field<oT> rows(const u32 in_row1, const u32 in_row2)
; | | inline subview_field<oT> rows(const u32 in_row1, const u32 in_row2)
; | |
| inline const subview_field<oT> rows(const u32 in_row1, const u32 in_row2)
const; | | inline const subview_field<oT> rows(const u32 in_row1, const u32 in_row2)
const; | |
| | | | |
| inline subview_field<oT> cols(const u32 in_col1, const u32 in_col2)
; | | inline subview_field<oT> cols(const u32 in_col1, const u32 in_col2)
; | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 11 lines changed or added | |
|
| fn_misc.hpp | | fn_misc.hpp | |
| | | | |
| skipping to change at line 320 | | skipping to change at line 320 | |
| | | | |
| return eOpCube<T1, eop_cube_exp>(A.get_ref()); | | return eOpCube<T1, eop_cube_exp>(A.get_ref()); | |
| } | | } | |
| | | | |
| // | | // | |
| // abs | | // abs | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const eOp<T1, eop_abs> | | const eOp<T1, eop_abs> | |
|
| abs(const Base<typename T1::elem_type,T1>& X) | | 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_extra_debug_sigprint(); | |
| | | | |
| return eOp<T1, eop_abs>(X.get_ref()); | | return eOp<T1, eop_abs>(X.get_ref()); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const eOpCube<T1, eop_cube_abs> | | const eOpCube<T1, eop_cube_abs> | |
|
| abs(const BaseCube<typename T1::elem_type,T1>& X) | | abs(const BaseCube<typename T1::elem_type,T1>& X, const typename arma_not_c
x<typename T1::elem_type>::result* junk = 0) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eOpCube<T1, eop_cube_abs>(X.get_ref()); | | return eOpCube<T1, eop_cube_abs>(X.get_ref()); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| const mtOp<typename T1::pod_type, T1, op_abs> | | const mtOp<typename T1::pod_type, T1, op_abs> | |
|
| abs(const Base<std::complex<typename T1::pod_type>, T1>& X) | | abs(const Base<std::complex<typename T1::pod_type>, T1>& X, const typename
arma_cx_only<typename T1::elem_type>::result* junk = 0) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | | return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| Mat<typename T1::pod_type> | | Cube<typename T1::pod_type> | |
| abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X) | | abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const typen | |
| | | ame arma_cx_only<typename T1::elem_type>::result* junk = 0) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const ProxyCube<T1> A(X.get_ref()); | | const ProxyCube<T1> A(X.get_ref()); | |
| | | | |
| // if T1 is a complex matrix, | | // if T1 is a complex matrix, | |
| // pod_type is the underlying type used by std::complex; | | // pod_type is the underlying type used by std::complex; | |
| // otherwise pod_type is the same as elem_type | | // otherwise pod_type is the same as elem_type | |
| | | | |
| typedef typename T1::elem_type in_eT; | | typedef typename T1::elem_type in_eT; | |
| | | | |
| skipping to change at line 381 | | skipping to change at line 381 | |
| | | | |
| return out; | | return out; | |
| } | | } | |
| | | | |
| // | | // | |
| // fabs | | // fabs | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const eOp<T1, eop_abs> | | const eOp<T1, eop_abs> | |
|
| fabs(const Base<typename T1::pod_type,T1>& X) | | 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_extra_debug_sigprint(); | |
| | | | |
| return eOp<T1, eop_abs>(X.get_ref()); | | return eOp<T1, eop_abs>(X.get_ref()); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const eOpCube<T1, eop_cube_abs> | | const eOpCube<T1, eop_cube_abs> | |
|
| fabs(const BaseCube<typename T1::pod_type,T1>& X) | | fabs(const BaseCube<typename T1::pod_type,T1>& X, const typename arma_not_c
x<typename T1::elem_type>::result* junk = 0) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return eOpCube<T1, eop_cube_abs>(X.get_ref()); | | return eOpCube<T1, eop_cube_abs>(X.get_ref()); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| const mtOp<typename T1::pod_type, T1, op_abs> | | const mtOp<typename T1::pod_type, T1, op_abs> | |
|
| fabs(const Base<std::complex<typename T1::pod_type>, T1>& X) | | fabs(const Base<std::complex<typename T1::pod_type>, T1>& X, const typename
arma_cx_only<typename T1::elem_type>::result* junk = 0) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | | return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| Mat<typename T1::pod_type> | | Cube<typename T1::pod_type> | |
| fabs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X) | | fabs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const type | |
| | | name arma_cx_only<typename T1::elem_type>::result* junk = 0) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return abs(X); | | return abs(X); | |
| } | | } | |
| | | | |
| // | | // | |
| // square | | // square | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| | | | |
End of changes. 8 change blocks. |
| 10 lines changed or deleted | | 12 lines changed or added | |
|
| forward_proto.hpp | | forward_proto.hpp | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| | | | |
| using std::cout; | | using std::cout; | |
| using std::cerr; | | using std::cerr; | |
| using std::endl; | | using std::endl; | |
| using std::ios; | | using std::ios; | |
| | | | |
| template<typename eT> class Mat; | | template<typename eT> class Mat; | |
| template<typename eT> class Col; | | template<typename eT> class Col; | |
| template<typename eT> class Row; | | template<typename eT> class Row; | |
| template<typename eT> class Cube; | | template<typename eT> class Cube; | |
|
| | | template<typename oT> class field; | |
| | | | |
| template<typename eT> class subview; | | template<typename eT> class subview; | |
| template<typename eT> class subview_col; | | template<typename eT> class subview_col; | |
| template<typename eT> class subview_row; | | template<typename eT> class subview_row; | |
| template<typename oT> class subview_field; | | template<typename oT> class subview_field; | |
| template<typename oT> class subview_cube; | | template<typename oT> class subview_cube; | |
| | | | |
| template<typename eT> class diagview; | | template<typename eT> class diagview; | |
| | | | |
| class diskio; | | class diskio; | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 91 | |
| | | | |
| template<typename out_eT, typename T1, typename op_type > cla
ss mtOp; | | template<typename out_eT, typename T1, typename op_type > cla
ss mtOp; | |
| template<typename out_eT, typename T1, typename T2, typename glue_type> cla
ss mtGlue; | | template<typename out_eT, typename T1, typename T2, typename glue_type> cla
ss mtGlue; | |
| | | | |
| template<typename T1, typename T2, typename glue_type> class GlueCube; | | template<typename T1, typename T2, typename glue_type> class GlueCube; | |
| template<typename T1, typename T2, typename eglue_type> class eGlueCube; | | template<typename T1, typename T2, typename eglue_type> class eGlueCube; | |
| | | | |
| template<typename T1> class Proxy; | | template<typename T1> class Proxy; | |
| template<typename T1> class ProxyCube; | | template<typename T1> class ProxyCube; | |
| | | | |
|
| | | //! \addtogroup injector | |
| | | //! @{ | |
| | | | |
| | | enum injector_helper | |
| | | { | |
| | | endr //!< indicate "end of row", similar conceptual meaning to std::endl | |
| | | }; | |
| | | | |
| | | //! @} | |
| | | | |
| //! \addtogroup diskio | | //! \addtogroup diskio | |
| //! @{ | | //! @{ | |
| | | | |
| //! file types supported by Armadillo | | //! file types supported by Armadillo | |
| enum file_type | | enum file_type | |
| { | | { | |
| auto_detect, //!< Automatically detect the file type (file must be one o
f the following types) | | auto_detect, //!< Automatically detect the file type (file must be one o
f the following types) | |
| raw_ascii, //!< ASCII format (text), without any other information. | | raw_ascii, //!< ASCII format (text), without any other information. | |
| arma_ascii, //!< Armadillo ASCII format (text), with information about
matrix type and size | | arma_ascii, //!< Armadillo ASCII format (text), with information about
matrix type and size | |
| arma_binary, //!< Armadillo binary format | | arma_binary, //!< Armadillo binary format | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 11 lines changed or added | |
|
| op_princomp_meat.hpp | | op_princomp_meat.hpp | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| score_out.reset(); | | score_out.reset(); | |
| latent_out.reset(); | | latent_out.reset(); | |
| tsquared_out.reset(); | | tsquared_out.reset(); | |
| | | | |
| return; | | return; | |
| } | | } | |
| | | | |
| //U.reset(); // TODO: do we need this ? U will get automatically dele
ted anyway | | //U.reset(); // TODO: do we need this ? U will get automatically dele
ted anyway | |
| | | | |
| // normalize the eigenvalues | | // normalize the eigenvalues | |
|
| s /= std::sqrt(n_rows - 1); | | s /= std::sqrt( double(n_rows - 1) ); | |
| | | | |
| // project the samples to the principals | | // project the samples to the principals | |
| score_out *= coeff_out; | | score_out *= coeff_out; | |
| | | | |
| if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | | if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | |
| { | | { | |
| score_out.cols(n_rows-1,n_cols-1).zeros(); | | score_out.cols(n_rows-1,n_cols-1).zeros(); | |
| | | | |
| //Col<eT> s_tmp = zeros< Col<eT> >(n_cols); | | //Col<eT> s_tmp = zeros< Col<eT> >(n_cols); | |
| Col<eT> s_tmp(n_cols); | | Col<eT> s_tmp(n_cols); | |
| | | | |
| skipping to change at line 175 | | skipping to change at line 175 | |
| coeff_out.reset(); | | coeff_out.reset(); | |
| score_out.reset(); | | score_out.reset(); | |
| latent_out.reset(); | | latent_out.reset(); | |
| | | | |
| return; | | return; | |
| } | | } | |
| | | | |
| // U.reset(); | | // U.reset(); | |
| | | | |
| // normalize the eigenvalues | | // normalize the eigenvalues | |
|
| s /= std::sqrt(n_rows - 1); | | s /= std::sqrt( double(n_rows - 1) ); | |
| | | | |
| // project the samples to the principals | | // project the samples to the principals | |
| score_out *= coeff_out; | | score_out *= coeff_out; | |
| | | | |
| if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | | if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | |
| { | | { | |
| score_out.cols(n_rows-1,n_cols-1).zeros(); | | score_out.cols(n_rows-1,n_cols-1).zeros(); | |
| | | | |
| Col<eT> s_tmp = zeros< Col<eT> >(n_cols); | | Col<eT> s_tmp = zeros< Col<eT> >(n_cols); | |
| s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); | | s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); | |
| | | | |
| skipping to change at line 259 | | skipping to change at line 259 | |
| | | | |
| coeff_out.reset(); | | coeff_out.reset(); | |
| score_out.reset(); | | score_out.reset(); | |
| | | | |
| return; | | return; | |
| } | | } | |
| | | | |
| // U.reset(); | | // U.reset(); | |
| | | | |
| // normalize the eigenvalues | | // normalize the eigenvalues | |
|
| s /= std::sqrt(n_rows - 1); | | s /= std::sqrt( double(n_rows - 1) ); | |
| | | | |
| // project the samples to the principals | | // project the samples to the principals | |
| score_out *= coeff_out; | | score_out *= coeff_out; | |
| | | | |
| if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | | if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | |
| { | | { | |
| score_out.cols(n_rows-1,n_cols-1).zeros(); | | score_out.cols(n_rows-1,n_cols-1).zeros(); | |
| | | | |
| Col<eT> s_tmp = zeros< Col<eT> >(n_cols); | | Col<eT> s_tmp = zeros< Col<eT> >(n_cols); | |
| s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); | | s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); | |
| | | | |
| skipping to change at line 379 | | skipping to change at line 379 | |
| score_out.reset(); | | score_out.reset(); | |
| latent_out.reset(); | | latent_out.reset(); | |
| tsquared_out.reset(); | | tsquared_out.reset(); | |
| | | | |
| return; | | return; | |
| } | | } | |
| | | | |
| //U.reset(); | | //U.reset(); | |
| | | | |
| // normalize the eigenvalues | | // normalize the eigenvalues | |
|
| s /= std::sqrt(n_rows - 1); | | s /= std::sqrt( double(n_rows - 1) ); | |
| | | | |
| // project the samples to the principals | | // project the samples to the principals | |
| score_out *= coeff_out; | | score_out *= coeff_out; | |
| | | | |
| if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | | if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | |
| { | | { | |
| score_out.cols(n_rows-1,n_cols-1).zeros(); | | score_out.cols(n_rows-1,n_cols-1).zeros(); | |
| | | | |
| Col<T> s_tmp = zeros< Col<T> >(n_cols); | | Col<T> s_tmp = zeros< Col<T> >(n_cols); | |
| s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); | | s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); | |
| | | | |
| skipping to change at line 482 | | skipping to change at line 482 | |
| coeff_out.reset(); | | coeff_out.reset(); | |
| score_out.reset(); | | score_out.reset(); | |
| latent_out.reset(); | | latent_out.reset(); | |
| | | | |
| return; | | return; | |
| } | | } | |
| | | | |
| // U.reset(); | | // U.reset(); | |
| | | | |
| // normalize the eigenvalues | | // normalize the eigenvalues | |
|
| s /= std::sqrt(n_rows - 1); | | s /= std::sqrt( double(n_rows - 1) ); | |
| | | | |
| // project the samples to the principals | | // project the samples to the principals | |
| score_out *= coeff_out; | | score_out *= coeff_out; | |
| | | | |
| if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | | if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | |
| { | | { | |
| score_out.cols(n_rows-1,n_cols-1).zeros(); | | score_out.cols(n_rows-1,n_cols-1).zeros(); | |
| | | | |
| Col<T> s_tmp = zeros< Col<T> >(n_cols); | | Col<T> s_tmp = zeros< Col<T> >(n_cols); | |
| s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); | | s_tmp.rows(0,n_rows-2) = s.rows(0,n_rows-2); | |
| | | | |
| skipping to change at line 565 | | skipping to change at line 565 | |
| | | | |
| coeff_out.reset(); | | coeff_out.reset(); | |
| score_out.reset(); | | score_out.reset(); | |
| | | | |
| return; | | return; | |
| } | | } | |
| | | | |
| // U.reset(); | | // U.reset(); | |
| | | | |
| // normalize the eigenvalues | | // normalize the eigenvalues | |
|
| s /= std::sqrt(n_rows - 1); | | s /= std::sqrt( double(n_rows - 1) ); | |
| | | | |
| // project the samples to the principals | | // project the samples to the principals | |
| score_out *= coeff_out; | | score_out *= coeff_out; | |
| | | | |
| if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | | if(n_rows <= n_cols) // number of samples is less than their dimensiona
lity | |
| { | | { | |
| score_out.cols(n_rows-1,n_cols-1).zeros(); | | score_out.cols(n_rows-1,n_cols-1).zeros(); | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
End of changes. 6 change blocks. |
| 6 lines changed or deleted | | 6 lines changed or added | |
|
| op_reshape_meat.hpp | | op_reshape_meat.hpp | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const unwrap<T1> tmp(in.m); | | const unwrap<T1> tmp(in.m); | |
| const Mat<eT>& A = tmp.M; | | const Mat<eT>& A = tmp.M; | |
| | | | |
| const u32 in_n_rows = in.aux_u32_a; | | const u32 in_n_rows = in.aux_u32_a; | |
| const u32 in_n_cols = in.aux_u32_b; | | const u32 in_n_cols = in.aux_u32_b; | |
| | | | |
| const u32 in_n_elem = in_n_rows * in_n_cols; | | const u32 in_n_elem = in_n_rows * in_n_cols; | |
| | | | |
|
| arma_debug_check( (A.n_elem != in_n_elem), "reshape(): incompatible dimen | | if(A.n_elem == in_n_elem) | |
| sions"); | | | |
| | | | |
| if(in.aux == eT(0)) | | | |
| { | | { | |
|
| if(&out != &A) | | if(in.aux == eT(0)) | |
| { | | { | |
|
| out.set_size(in_n_rows, in_n_cols); | | if(&out != &A) | |
| syslib::copy_elem( out.memptr(), A.memptr(), out.n_elem ); | | { | |
| | | out.set_size(in_n_rows, in_n_cols); | |
| | | syslib::copy_elem( out.memptr(), A.memptr(), out.n_elem ); | |
| | | } | |
| | | else | |
| | | { | |
| | | access::rw(out.n_rows) = in_n_rows; | |
| | | access::rw(out.n_cols) = in_n_cols; | |
| | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| access::rw(out.n_rows) = in_n_rows; | | unwrap_check< Mat<eT> > tmp(A, out); | |
| access::rw(out.n_cols) = in_n_cols; | | const Mat<eT>& B = tmp.M; | |
| | | | |
| | | out.set_size(in_n_rows, in_n_cols); | |
| | | | |
| | | eT* out_mem = out.memptr(); | |
| | | u32 i = 0; | |
| | | | |
| | | for(u32 row=0; row<B.n_rows; ++row) | |
| | | { | |
| | | for(u32 col=0; col<B.n_cols; ++col) | |
| | | { | |
| | | out_mem[i] = B.at(row,col); | |
| | | ++i; | |
| | | } | |
| | | } | |
| | | | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| unwrap_check< Mat<eT> > tmp(A, out); | | const unwrap_check< Mat<eT> > tmp(A, out); | |
| const Mat<eT>& B = tmp.M; | | const Mat<eT>& B = tmp.M; | |
| | | | |
| | | const u32 n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); | |
| | | | |
| out.set_size(in_n_rows, in_n_cols); | | out.set_size(in_n_rows, in_n_cols); | |
| | | | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
|
| u32 i = 0; | | | |
| | | | |
|
| for(u32 row=0; row<B.n_rows; ++row) | | if(in.aux == eT(0)) | |
| | | { | |
| | | syslib::copy_elem( out_mem, B.memptr(), n_elem_to_copy ); | |
| | | } | |
| | | else | |
| { | | { | |
|
| for(u32 col=0; col<B.n_cols; ++col) | | u32 row = 0; | |
| | | u32 col = 0; | |
| | | | |
| | | for(u32 i=0; i<n_elem_to_copy; ++i) | |
| { | | { | |
| out_mem[i] = B.at(row,col); | | out_mem[i] = B.at(row,col); | |
|
| ++i; | | | |
| | | ++col; | |
| | | | |
| | | if(col >= B.n_cols) | |
| | | { | |
| | | col = 0; | |
| | | ++row; | |
| | | } | |
| } | | } | |
| } | | } | |
| | | | |
|
| } | | for(u32 i=n_elem_to_copy; i<in_n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = eT(0); | |
| | | } | |
| | | | |
|
| | | } | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| op_reshape::apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_res
hape>& in) | | op_reshape::apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_res
hape>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const unwrap_cube<T1> tmp(in.m); | | const unwrap_cube<T1> tmp(in.m); | |
| const Cube<eT>& A = tmp.M; | | const Cube<eT>& A = tmp.M; | |
| | | | |
| const u32 in_n_rows = in.aux_u32_a; | | const u32 in_n_rows = in.aux_u32_a; | |
| const u32 in_n_cols = in.aux_u32_b; | | const u32 in_n_cols = in.aux_u32_b; | |
| const u32 in_n_slices = in.aux_u32_c; | | const u32 in_n_slices = in.aux_u32_c; | |
| | | | |
| const u32 in_n_elem = in_n_rows * in_n_cols * in_n_slices; | | const u32 in_n_elem = in_n_rows * in_n_cols * in_n_slices; | |
| | | | |
|
| arma_debug_check( (A.n_elem != in_n_elem), "reshape(): incompatible dimen | | if(A.n_elem == in_n_elem) | |
| sions"); | | | |
| | | | |
| if(in.aux == eT(0)) | | | |
| { | | { | |
|
| if(&out != &A) | | if(in.aux == eT(0)) | |
| { | | { | |
|
| out.set_size(in_n_rows, in_n_cols, in_n_slices); | | if(&out != &A) | |
| syslib::copy_elem( out.memptr(), A.memptr(), out.n_elem ); | | { | |
| | | out.set_size(in_n_rows, in_n_cols, in_n_slices); | |
| | | syslib::copy_elem( out.memptr(), A.memptr(), out.n_elem ); | |
| | | } | |
| | | else | |
| | | { | |
| | | access::rw(out.n_rows) = in_n_rows; | |
| | | access::rw(out.n_cols) = in_n_cols; | |
| | | access::rw(out.n_slices) = in_n_slices; | |
| | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| access::rw(out.n_rows) = in_n_rows; | | unwrap_cube_check< Cube<eT> > tmp(A, out); | |
| access::rw(out.n_cols) = in_n_cols; | | const Cube<eT>& B = tmp.M; | |
| access::rw(out.n_slices) = in_n_slices; | | | |
| | | out.set_size(in_n_rows, in_n_cols, in_n_slices); | |
| | | | |
| | | eT* out_mem = out.memptr(); | |
| | | u32 i = 0; | |
| | | | |
| | | for(u32 slice=0; slice<B.n_slices; ++slice) | |
| | | { | |
| | | for(u32 row=0; row<B.n_rows; ++row) | |
| | | { | |
| | | for(u32 col=0; col<B.n_cols; ++col) | |
| | | { | |
| | | out_mem[i] = B.at(row,col,slice); | |
| | | ++i; | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| unwrap_cube_check< Cube<eT> > tmp(A, out); | | const unwrap_cube_check< Cube<eT> > tmp(A, out); | |
| const Cube<eT>& B = tmp.M; | | const Cube<eT>& B = tmp.M; | |
| | | | |
| | | const u32 n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); | |
| | | | |
| out.set_size(in_n_rows, in_n_cols, in_n_slices); | | out.set_size(in_n_rows, in_n_cols, in_n_slices); | |
| | | | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
|
| u32 i = 0; | | | |
| | | | |
|
| for(u32 slice=0; slice<B.n_slices; ++slice) | | if(in.aux == eT(0)) | |
| { | | { | |
|
| for(u32 row=0; row<B.n_rows; ++row) | | syslib::copy_elem( out_mem, B.memptr(), n_elem_to_copy ); | |
| | | } | |
| | | else | |
| | | { | |
| | | u32 row = 0; | |
| | | u32 col = 0; | |
| | | u32 slice = 0; | |
| | | | |
| | | for(u32 i=0; i<n_elem_to_copy; ++i) | |
| { | | { | |
|
| for(u32 col=0; col<B.n_cols; ++col) | | out_mem[i] = B.at(row,col,slice); | |
| | | | |
| | | ++col; | |
| | | | |
| | | if(col >= B.n_cols) | |
| { | | { | |
|
| out_mem[i] = B.at(row,col,slice); | | col = 0; | |
| ++i; | | ++row; | |
| | | | |
| | | if(row >= B.n_rows) | |
| | | { | |
| | | row = 0; | |
| | | ++slice; | |
| | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
|
| } | | for(u32 i=n_elem_to_copy; i<in_n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = eT(0); | |
| | | } | |
| | | | |
|
| | | } | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 23 change blocks. |
| 35 lines changed or deleted | | 120 lines changed or added | |
|