| Cube_meat.hpp | | Cube_meat.hpp | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| Cube<eT>::~Cube() | | Cube<eT>::~Cube() | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| delete_mat(); | | delete_mat(); | |
| | | | |
| if(mem_state == 0) | | if(mem_state == 0) | |
| { | | { | |
| if(n_elem > Cube_prealloc::mem_n_elem) | | if(n_elem > Cube_prealloc::mem_n_elem) | |
| { | | { | |
|
| #if defined(ARMA_USE_TBB_ALLOC) | | memory::release( access::rw(mem) ); | |
| scalable_free((void *)(mem)); | | | |
| #else | | | |
| delete [] mem; | | | |
| #endif | | | |
| } | | } | |
| } | | } | |
| | | | |
| if(arma_config::debug == true) | | if(arma_config::debug == true) | |
| { | | { | |
| // try to expose buggy user code that accesses deleted objects | | // try to expose buggy user code that accesses deleted objects | |
| access::rw(n_rows) = 0; | | access::rw(n_rows) = 0; | |
| access::rw(n_cols) = 0; | | access::rw(n_cols) = 0; | |
| access::rw(n_slices) = 0; | | access::rw(n_slices) = 0; | |
| access::rw(n_elem) = 0; | | access::rw(n_elem) = 0; | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 104 | |
| ); | | ); | |
| | | | |
| if(n_elem <= Cube_prealloc::mem_n_elem) | | if(n_elem <= Cube_prealloc::mem_n_elem) | |
| { | | { | |
| access::rw(mem) = mem_local; | | access::rw(mem) = mem_local; | |
| } | | } | |
| else | | else | |
| { | | { | |
| arma_extra_debug_print("Cube::init(): allocating memory"); | | arma_extra_debug_print("Cube::init(): allocating memory"); | |
| | | | |
|
| #if defined(ARMA_USE_TBB_ALLOC) | | access::rw(mem) = memory::acquire<eT>(n_elem); | |
| access::rw(mem) = (eT *)scalable_malloc(sizeof(eT)*n_elem); | | | |
| #else | | | |
| access::rw(mem) = new(std::nothrow) eT[n_elem]; | | | |
| #endif | | | |
| | | | |
| arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" ); | | arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" ); | |
| } | | } | |
| | | | |
| if(n_elem == 0) | | if(n_elem == 0) | |
| { | | { | |
| access::rw(n_rows) = 0; | | access::rw(n_rows) = 0; | |
| access::rw(n_cols) = 0; | | access::rw(n_cols) = 0; | |
| access::rw(n_elem_slice) = 0; | | access::rw(n_elem_slice) = 0; | |
| access::rw(n_slices) = 0; | | access::rw(n_slices) = 0; | |
| | | | |
| skipping to change at line 200 | | skipping to change at line 192 | |
| arma_debug_check( (t_mem_state == 2), "Cube::init(): requested size is
not compatible with the size of auxiliary memory" ); | | arma_debug_check( (t_mem_state == 2), "Cube::init(): requested size is
not compatible with the size of auxiliary memory" ); | |
| | | | |
| delete_mat(); | | delete_mat(); | |
| | | | |
| if(t_mem_state == 0) | | if(t_mem_state == 0) | |
| { | | { | |
| if(n_elem > Cube_prealloc::mem_n_elem ) | | if(n_elem > Cube_prealloc::mem_n_elem ) | |
| { | | { | |
| arma_extra_debug_print("Cube::init(): freeing memory"); | | arma_extra_debug_print("Cube::init(): freeing memory"); | |
| | | | |
|
| #if defined(ARMA_USE_TBB_ALLOC) | | memory::release( access::rw(mem) ); | |
| scalable_free((void *)(mem)); | | | |
| #else | | | |
| delete [] mem; | | | |
| #endif | | | |
| } | | } | |
| } | | } | |
| | | | |
| access::rw(mem_state) = 0; | | access::rw(mem_state) = 0; | |
| | | | |
| if(new_n_elem <= Cube_prealloc::mem_n_elem) | | if(new_n_elem <= Cube_prealloc::mem_n_elem) | |
| { | | { | |
| access::rw(mem) = mem_local; | | access::rw(mem) = mem_local; | |
| } | | } | |
| else | | else | |
| { | | { | |
| arma_extra_debug_print("Cube::init(): allocating memory"); | | arma_extra_debug_print("Cube::init(): allocating memory"); | |
| | | | |
|
| #if defined(ARMA_USE_TBB_ALLOC) | | access::rw(mem) = memory::acquire<eT>(new_n_elem); | |
| access::rw(mem) = (eT *)scalable_malloc(sizeof(eT)*new_n_elem); | | | |
| #else | | | |
| access::rw(mem) = new(std::nothrow) eT[new_n_elem]; | | | |
| #endif | | | |
| | | | |
| arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" ); | | arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" ); | |
| } | | } | |
| | | | |
| if(new_n_elem > 0) | | if(new_n_elem > 0) | |
| { | | { | |
| access::rw(n_rows) = in_n_rows; | | access::rw(n_rows) = in_n_rows; | |
| access::rw(n_cols) = in_n_cols; | | access::rw(n_cols) = in_n_cols; | |
| access::rw(n_elem_slice) = in_n_rows*in_n_cols; | | access::rw(n_elem_slice) = in_n_rows*in_n_cols; | |
| access::rw(n_slices) = in_n_slices; | | access::rw(n_slices) = in_n_slices; | |
| | | | |
| skipping to change at line 2998 | | skipping to change at line 2982 | |
| const Cube<eT>& A = tmp.M; | | const Cube<eT>& A = tmp.M; | |
| | | | |
| arma_debug_assert_same_size( out, A, "Cube::set_real()" ); | | arma_debug_assert_same_size( out, A, "Cube::set_real()" ); | |
| | | | |
| out = A; | | out = A; | |
| } | | } | |
| | | | |
| template<typename eT, typename T1> | | template<typename eT, typename T1> | |
| inline | | inline | |
| void | | void | |
|
| Cube_aux::set_imag(Cube<eT>& out, const BaseCube<eT,T1>& X) | | Cube_aux::set_imag(Cube<eT>&, const BaseCube<eT,T1>&) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| template<typename T, typename T1> | | template<typename T, typename T1> | |
| inline | | inline | |
| void | | void | |
| Cube_aux::set_real(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X) | | Cube_aux::set_real(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
End of changes. 5 change blocks. |
| 21 lines changed or deleted | | 5 lines changed or added | |
|
| Proxy.hpp | | Proxy.hpp | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| // 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 Proxy | | //! \addtogroup Proxy | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| class Proxy | | class Proxy | |
| { | | { | |
| public: | | public: | |
|
| inline Proxy(const T1& A) | | inline Proxy(const T1&) | |
| { | | { | |
| arma_type_check(( is_arma_type<T1>::value == false )); | | arma_type_check(( is_arma_type<T1>::value == false )); | |
| } | | } | |
| }; | | }; | |
| | | | |
| // ea_type is the "element accessor" type, | | // ea_type is the "element accessor" type, | |
| // which can provide access to elements via operator[] | | // which can provide access to elements via operator[] | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Proxy< Mat<eT> > | | class Proxy< Mat<eT> > | |
| | | | |
| skipping to change at line 334 | | skipping to change at line 334 | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Proxy< subview_col<eT> > | | class Proxy< subview_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 subview_col<eT> stored_type; | | typedef subview_col<eT> stored_type; | |
|
| typedef const subview_col<eT>& ea_type; | | typedef const eT* ea_type; | |
| | | | |
|
| static const bool prefer_at_accessor = true; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = true; | | static const bool has_subview = true; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = true; | | static const bool is_col = true; | |
| | | | |
| arma_aligned const subview_col<eT>& Q; | | arma_aligned const subview_col<eT>& Q; | |
| | | | |
| inline explicit Proxy(const subview_col<eT>& A) | | inline explicit Proxy(const subview_col<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline uword get_n_rows() const { return Q.n_rows; } | | arma_inline uword get_n_rows() const { return Q.n_rows; } | |
| arma_inline uword get_n_cols() const { return 1; } | | arma_inline uword get_n_cols() const { return 1; } | |
| arma_inline uword get_n_elem() const { return Q.n_elem; } | | arma_inline uword get_n_elem() const { return Q.n_elem; } | |
| | | | |
|
| arma_inline elem_type operator[] (const uword i) const { r | | arma_inline elem_type operator[] (const uword i) const { r | |
| eturn Q[i]; } | | eturn Q[i]; } | |
| arma_inline elem_type at (const uword row, const uword) const { r | | arma_inline elem_type at (const uword row, const uword) const { r | |
| eturn Q.at(row, 0); } | | eturn Q[row]; } | |
| | | | |
|
| arma_inline ea_type get_ea() const { return Q; } | | arma_inline ea_type get_ea() const { return Q.colptr(0); } | |
| | | | |
| template<typename eT2> | | template<typename eT2> | |
| arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q
.m)) == void_ptr(&X)); } | | arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q
.m)) == void_ptr(&X)); } | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Proxy< subview_row<eT> > | | class Proxy< subview_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 subview_row<eT> stored_type; | | typedef subview_row<eT> stored_type; | |
| typedef const subview_row<eT>& ea_type; | | typedef const subview_row<eT>& ea_type; | |
| | | | |
|
| static const bool prefer_at_accessor = true; | | static const bool prefer_at_accessor = false; | |
| static const bool has_subview = true; | | static const bool has_subview = true; | |
| | | | |
| static const bool is_row = true; | | static const bool is_row = true; | |
| static const bool is_col = false; | | static const bool is_col = false; | |
| | | | |
| arma_aligned const subview_row<eT>& Q; | | arma_aligned const subview_row<eT>& Q; | |
| | | | |
| inline explicit Proxy(const subview_row<eT>& A) | | inline explicit Proxy(const subview_row<eT>& A) | |
| : Q(A) | | : Q(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| arma_inline uword get_n_rows() const { return 1; } | | arma_inline uword get_n_rows() const { return 1; } | |
| arma_inline uword get_n_cols() const { return Q.n_cols; } | | arma_inline uword get_n_cols() const { return Q.n_cols; } | |
| arma_inline uword get_n_elem() const { return Q.n_elem; } | | arma_inline uword get_n_elem() const { return Q.n_elem; } | |
| | | | |
|
| arma_inline elem_type operator[] (const uword i) const { r | | arma_inline elem_type operator[] (const uword i) const { r | |
| eturn Q[i]; } | | eturn Q[i]; } | |
| arma_inline elem_type at (const uword, const uword col) const { r | | arma_inline elem_type at (const uword, const uword col) const { r | |
| eturn Q.at(0, col); } | | eturn Q[col]; } | |
| | | | |
| arma_inline ea_type get_ea() const { return Q; } | | arma_inline ea_type get_ea() const { return Q; } | |
| | | | |
| template<typename eT2> | | template<typename eT2> | |
| arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q
.m)) == void_ptr(&X)); } | | arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q
.m)) == void_ptr(&X)); } | |
| }; | | }; | |
| | | | |
| template<typename eT, typename T1> | | template<typename eT, typename T1> | |
| class Proxy< subview_elem1<eT,T1> > | | class Proxy< subview_elem1<eT,T1> > | |
| { | | { | |
| | | | |
End of changes. 7 change blocks. |
| 13 lines changed or deleted | | 13 lines changed or added | |
|
| armadillo | | armadillo | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| | | | |
| #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_USE_MKL_ALLOC) | |
| | | #include <mkl_service.h> | |
| | | #endif | |
| | | | |
| #if defined(ARMA_HAVE_STD_TR1) | | #if defined(ARMA_HAVE_STD_TR1) | |
| // TODO: add handling of this functionality when use of C++11 is enabled | | // TODO: add handling of this functionality when use of C++11 is enabled | |
| #include <tr1/cmath> | | #include <tr1/cmath> | |
| #include <tr1/complex> | | #include <tr1/complex> | |
| #elif defined(ARMA_USE_BOOST) | | #elif defined(ARMA_USE_BOOST) | |
| #include <boost/math/complex.hpp> | | #include <boost/math/complex.hpp> | |
| #include <boost/math/special_functions/acosh.hpp> | | #include <boost/math/special_functions/acosh.hpp> | |
| #include <boost/math/special_functions/asinh.hpp> | | #include <boost/math/special_functions/asinh.hpp> | |
| #include <boost/math/special_functions/atanh.hpp> | | #include <boost/math/special_functions/atanh.hpp> | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 94 | |
| #include "armadillo_bits/typedef.hpp" | | #include "armadillo_bits/typedef.hpp" | |
| #include "armadillo_bits/typedef_blas_int.hpp" | | #include "armadillo_bits/typedef_blas_int.hpp" | |
| #include "armadillo_bits/format_wrap.hpp" | | #include "armadillo_bits/format_wrap.hpp" | |
| #include "armadillo_bits/arma_version.hpp" | | #include "armadillo_bits/arma_version.hpp" | |
| #include "armadillo_bits/arma_config.hpp" | | #include "armadillo_bits/arma_config.hpp" | |
| #include "armadillo_bits/traits.hpp" | | #include "armadillo_bits/traits.hpp" | |
| #include "armadillo_bits/promote_type.hpp" | | #include "armadillo_bits/promote_type.hpp" | |
| #include "armadillo_bits/upgrade_val.hpp" | | #include "armadillo_bits/upgrade_val.hpp" | |
| #include "armadillo_bits/restrictors.hpp" | | #include "armadillo_bits/restrictors.hpp" | |
| #include "armadillo_bits/access.hpp" | | #include "armadillo_bits/access.hpp" | |
|
| | | #include "armadillo_bits/memory.hpp" | |
| #include "armadillo_bits/span.hpp" | | #include "armadillo_bits/span.hpp" | |
| #include "armadillo_bits/constants.hpp" | | #include "armadillo_bits/constants.hpp" | |
| #include "armadillo_bits/constants_compat.hpp" | | #include "armadillo_bits/constants_compat.hpp" | |
| | | | |
| // | | // | |
| // class prototypes | | // class prototypes | |
| | | | |
| #include "armadillo_bits/Base_bones.hpp" | | #include "armadillo_bits/Base_bones.hpp" | |
| #include "armadillo_bits/BaseCube_bones.hpp" | | #include "armadillo_bits/BaseCube_bones.hpp" | |
| | | | |
| #include "armadillo_bits/blas_bones.hpp" | | #include "armadillo_bits/blas_bones.hpp" | |
| #include "armadillo_bits/lapack_bones.hpp" | | #include "armadillo_bits/lapack_bones.hpp" | |
| #include "armadillo_bits/atlas_bones.hpp" | | #include "armadillo_bits/atlas_bones.hpp" | |
| | | | |
| #include "armadillo_bits/blas_wrapper.hpp" | | #include "armadillo_bits/blas_wrapper.hpp" | |
| #include "armadillo_bits/lapack_wrapper.hpp" | | #include "armadillo_bits/lapack_wrapper.hpp" | |
| #include "armadillo_bits/atlas_wrapper.hpp" | | #include "armadillo_bits/atlas_wrapper.hpp" | |
| | | | |
|
| | | #include "armadillo_bits/cond_rel_bones.hpp" | |
| #include "armadillo_bits/arrayops_bones.hpp" | | #include "armadillo_bits/arrayops_bones.hpp" | |
| #include "armadillo_bits/podarray_bones.hpp" | | #include "armadillo_bits/podarray_bones.hpp" | |
| #include "armadillo_bits/auxlib_bones.hpp" | | #include "armadillo_bits/auxlib_bones.hpp" | |
| | | | |
| #include "armadillo_bits/injector_bones.hpp" | | #include "armadillo_bits/injector_bones.hpp" | |
| | | | |
| #include "armadillo_bits/Mat_bones.hpp" | | #include "armadillo_bits/Mat_bones.hpp" | |
| #include "armadillo_bits/Col_bones.hpp" | | #include "armadillo_bits/Col_bones.hpp" | |
| #include "armadillo_bits/Row_bones.hpp" | | #include "armadillo_bits/Row_bones.hpp" | |
| #include "armadillo_bits/Cube_bones.hpp" | | #include "armadillo_bits/Cube_bones.hpp" | |
| | | | |
| skipping to change at line 358 | | skipping to change at line 364 | |
| // | | // | |
| // class meat | | // class meat | |
| | | | |
| #include "armadillo_bits/gemv.hpp" | | #include "armadillo_bits/gemv.hpp" | |
| #include "armadillo_bits/gemm.hpp" | | #include "armadillo_bits/gemm.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" | |
| | | | |
|
| | | #include "armadillo_bits/cond_rel_meat.hpp" | |
| #include "armadillo_bits/arrayops_meat.hpp" | | #include "armadillo_bits/arrayops_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/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" | |
| | | | |
End of changes. 4 change blocks. |
| 0 lines changed or deleted | | 7 lines changed or added | |
|
| auxlib_meat.hpp | | auxlib_meat.hpp | |
| | | | |
| skipping to change at line 894 | | skipping to change at line 894 | |
| } | | } | |
| } | | } | |
| | | | |
| out_val = val; | | out_val = val; | |
| out_sign = T(sign); | | out_sign = T(sign); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
|
| | | arma_ignore(X); | |
| | | | |
| out_val = eT(0); | | out_val = eT(0); | |
| out_sign = T(0); | | out_sign = T(0); | |
| | | | |
| arma_stop("log_det(): use of ATLAS or LAPACK needs to be enabled"); | | arma_stop("log_det(): use of ATLAS or LAPACK needs to be enabled"); | |
| | | | |
| return false; | | return false; | |
| } | | } | |
| #endif | | #endif | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 1133 | | skipping to change at line 1135 | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| // rudimentary "better-than-nothing" test for symmetry | | // rudimentary "better-than-nothing" test for symmetry | |
| //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl
ib::eig(): given matrix is not symmetric" ); | | //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl
ib::eig(): given matrix is not symmetric" ); | |
| | | | |
| char jobz = 'N'; | | char jobz = 'N'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int n_rows = A.n_rows; | | blas_int n_rows = A.n_rows; | |
|
| blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1); | | blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1) + 2; // +2 for p
aranoia: some versions of Lapack might be trashing memory | |
| | | | |
| eigval.set_size( static_cast<uword>(n_rows) ); | | eigval.set_size( static_cast<uword>(n_rows) ); | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::syev()"); | | arma_extra_debug_print("lapack::syev()"); | |
| lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr(
), work.memptr(), &lwork, &info); | | lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr(
), work.memptr(), &lwork, &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| | | | |
| skipping to change at line 1181 | | skipping to change at line 1183 | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| char jobz = 'N'; | | char jobz = 'N'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int n_rows = A.n_rows; | | blas_int n_rows = A.n_rows; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
|
| blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1); // TODO: auto | | blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1) + 2; // +2 for | |
| matically find best size of lwork | | paranoia: some versions of Lapack might be trashing memory | |
| | | // TODO: automatically find best size of lwork | |
| | | | |
| eigval.set_size( static_cast<uword>(n_rows) ); | | eigval.set_size( static_cast<uword>(n_rows) ); | |
| | | | |
|
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows
- 2)) ); | | podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows
- 2)) ); | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::heev()"); | | arma_extra_debug_print("lapack::heev()"); | |
| lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(),
work.memptr(), &lwork, rwork.memptr(), &info); | | lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(),
work.memptr(), &lwork, rwork.memptr(), &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| | | | |
| skipping to change at line 1233 | | skipping to change at line 1236 | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| // rudimentary "better-than-nothing" test for symmetry | | // rudimentary "better-than-nothing" test for symmetry | |
| //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl
ib::eig(): given matrix is not symmetric" ); | | //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl
ib::eig(): given matrix is not symmetric" ); | |
| | | | |
| char jobz = 'V'; | | char jobz = 'V'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int n_rows = eigvec.n_rows; | | blas_int n_rows = eigvec.n_rows; | |
|
| blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1); | | blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1) + 2; // +2 for p
aranoia: some versions of Lapack might be trashing memory | |
| | | | |
| eigval.set_size( static_cast<uword>(n_rows) ); | | eigval.set_size( static_cast<uword>(n_rows) ); | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::syev()"); | | arma_extra_debug_print("lapack::syev()"); | |
| lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.me
mptr(), work.memptr(), &lwork, &info); | | lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.me
mptr(), work.memptr(), &lwork, &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| arma_ignore(eigval); | | arma_ignore(eigval); | |
| arma_ignore(eigvec); | | arma_ignore(eigvec); | |
|
| | | arma_ignore(X); | |
| | | | |
| arma_stop("eig_sym(): use of LAPACK needs to be enabled"); | | arma_stop("eig_sym(): use of LAPACK needs to be enabled"); | |
| | | | |
| return false; | | return false; | |
| } | | } | |
| #endif | | #endif | |
| } | | } | |
| | | | |
| //! immediate eigenvalues and eigenvectors of a hermitian complex matrix us
ing LAPACK | | //! immediate eigenvalues and eigenvectors of a hermitian complex matrix us
ing LAPACK | |
| template<typename T, typename T1> | | template<typename T, typename T1> | |
| inline | | inline | |
| | | | |
| skipping to change at line 1284 | | skipping to change at line 1289 | |
| eigval.reset(); | | eigval.reset(); | |
| eigvec.reset(); | | eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| char jobz = 'V'; | | char jobz = 'V'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int n_rows = eigvec.n_rows; | | blas_int n_rows = eigvec.n_rows; | |
| blas_int lda = eigvec.n_rows; | | blas_int lda = eigvec.n_rows; | |
|
| blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1); // TODO: auto | | blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1) + 2; // +2 for | |
| matically find best size of lwork | | paranoia: some versions of Lapack might be trashing memory | |
| | | // TODO: automatically find best size of lwork | |
| | | | |
| eigval.set_size( static_cast<uword>(n_rows) ); | | eigval.set_size( static_cast<uword>(n_rows) ); | |
| | | | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows
- 2)) ); | | podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows
- 2)) ); | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::heev()"); | | arma_extra_debug_print("lapack::heev()"); | |
| lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.mempt
r(), work.memptr(), &lwork, rwork.memptr(), &info); | | lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.mempt
r(), work.memptr(), &lwork, rwork.memptr(), &info); | |
| | | | |
| skipping to change at line 1373 | | skipping to change at line 1379 | |
| eigval.reset(); | | eigval.reset(); | |
| l_eigvec.reset(); | | l_eigvec.reset(); | |
| r_eigvec.reset(); | | r_eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| uword A_n_rows = A.n_rows; | | uword A_n_rows = A.n_rows; | |
| | | | |
| blas_int n_rows = A_n_rows; | | blas_int n_rows = A_n_rows; | |
| blas_int lda = A_n_rows; | | blas_int lda = A_n_rows; | |
|
| blas_int lwork = (std::max)(blas_int(1), 4*n_rows); // TODO: automati | | blas_int lwork = (std::max)(blas_int(1), 4*n_rows) + 2; // +2 for par | |
| cally find best size of lwork | | anoia: some versions of Lapack might be trashing memory | |
| | | // TODO: automatically find best size of lwork | |
| | | | |
| eigval.set_size(A_n_rows); | | eigval.set_size(A_n_rows); | |
| l_eigvec.set_size(A_n_rows, A_n_rows); | | l_eigvec.set_size(A_n_rows, A_n_rows); | |
| r_eigvec.set_size(A_n_rows, A_n_rows); | | r_eigvec.set_size(A_n_rows, A_n_rows); | |
| | | | |
|
| podarray<T> work( static_cast<uword>(lwork) ); | | podarray<T> work( static_cast<uword>(lwork) ); | |
| podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows)
) ); | | podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows)
) ); | |
| | | | |
| podarray<T> wr(A_n_rows); | | podarray<T> wr(A_n_rows); | |
| podarray<T> wi(A_n_rows); | | podarray<T> wi(A_n_rows); | |
| | | | |
| Mat<T> A_copy = A; | | Mat<T> A_copy = A; | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::geev()"); | | arma_extra_debug_print("lapack::geev()"); | |
| lapack::geev(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr(
), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, wor
k.memptr(), &lwork, &info); | | lapack::geev(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr(
), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, wor
k.memptr(), &lwork, &info); | |
| | | | |
| skipping to change at line 1478 | | skipping to change at line 1485 | |
| eigval.reset(); | | eigval.reset(); | |
| l_eigvec.reset(); | | l_eigvec.reset(); | |
| r_eigvec.reset(); | | r_eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| uword A_n_rows = A.n_rows; | | uword A_n_rows = A.n_rows; | |
| | | | |
| blas_int n_rows = A_n_rows; | | blas_int n_rows = A_n_rows; | |
| blas_int lda = A_n_rows; | | blas_int lda = A_n_rows; | |
|
| blas_int lwork = (std::max)(blas_int(1), 4*n_rows); // TODO: automati | | blas_int lwork = (std::max)(blas_int(1), 4*n_rows) + 2; // +2 for par | |
| cally find best size of lwork | | anoia: some versions of Lapack might be trashing memory | |
| | | // TODO: automatically find best size of lwork | |
| | | | |
| eigval.set_size(A_n_rows); | | eigval.set_size(A_n_rows); | |
| l_eigvec.set_size(A_n_rows, A_n_rows); | | l_eigvec.set_size(A_n_rows, A_n_rows); | |
| r_eigvec.set_size(A_n_rows, A_n_rows); | | r_eigvec.set_size(A_n_rows, A_n_rows); | |
| | | | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows
)) ); // was 2,3 | | podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows
)) ); // was 2,3 | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| | | | |
| skipping to change at line 1548 | | skipping to change at line 1556 | |
| { | | { | |
| colptr[row] = eT(0); | | colptr[row] = eT(0); | |
| } | | } | |
| } | | } | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| arma_ignore(out); | | arma_ignore(out); | |
|
| | | arma_ignore(X); | |
| | | | |
| arma_stop("chol(): use of LAPACK needs to be enabled"); | | arma_stop("chol(): use of LAPACK needs to be enabled"); | |
| return false; | | return false; | |
| } | | } | |
| #endif | | #endif | |
| } | | } | |
| | | | |
| template<typename eT, typename T1> | | template<typename eT, typename T1> | |
| inline | | inline | |
| bool | | bool | |
| auxlib::qr(Mat<eT>& Q, Mat<eT>& R, const Base<eT,T1>& X) | | auxlib::qr(Mat<eT>& Q, Mat<eT>& R, const Base<eT,T1>& X) | |
| | | | |
| skipping to change at line 2360 | | skipping to change at line 2370 | |
| gemm_emul<false,false,false,false>::apply(out, A_inv, B); | | gemm_emul<false,false,false,false>::apply(out, A_inv, B); | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| } | | } | |
| | | | |
| if( (A_n_rows > 4) || (status == false) ) | | if( (A_n_rows > 4) || (status == false) ) | |
| { | | { | |
| #if defined(ARMA_USE_ATLAS) | | #if defined(ARMA_USE_ATLAS) | |
| { | | { | |
|
| podarray<int> ipiv(A_n_rows); | | | |
| | | | |
| out = B; | | out = B; | |
| | | | |
|
| | | podarray<int> ipiv(A_n_rows + 2); // +2 for paranoia: old versions | |
| | | of Atlas might be trashing memory | |
| | | | |
| int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows,
B.n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows); | | int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows,
B.n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #elif defined(ARMA_USE_LAPACK) | | #elif defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| blas_int n = A_n_rows; | | blas_int n = A_n_rows; // assuming A is square | |
| blas_int lda = A_n_rows; | | blas_int lda = A_n_rows; | |
| blas_int ldb = A_n_rows; | | blas_int ldb = A_n_rows; | |
| blas_int nrhs = B.n_cols; | | blas_int nrhs = B.n_cols; | |
| blas_int info; | | blas_int info; | |
| | | | |
|
| podarray<blas_int> ipiv(A_n_rows); | | | |
| | | | |
| out = B; | | out = B; | |
| | | | |
|
| | | podarray<blas_int> ipiv(A_n_rows + 2); // +2 for paranoia: some ve | |
| | | rsions of Lapack might be trashing memory | |
| | | | |
| lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.me
mptr(), &ldb, &info); | | lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.me
mptr(), &ldb, &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| arma_stop("solve(): use of ATLAS or LAPACK needs to be enabled"); | | arma_stop("solve(): use of ATLAS or LAPACK needs to be enabled"); | |
| return false; | | return false; | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 2420 | | skipping to change at line 2430 | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| char trans = 'N'; | | char trans = 'N'; | |
| | | | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| blas_int ldb = A.n_rows; | | blas_int ldb = A.n_rows; | |
| blas_int nrhs = B.n_cols; | | blas_int nrhs = B.n_cols; | |
|
| blas_int lwork = n + (std::max)(n, nrhs); | | blas_int lwork = n + (std::max)(n, nrhs) + 2; // +2 for paranoia: som
e versions of Lapack might be trashing memory | |
| blas_int info; | | blas_int info; | |
| | | | |
| Mat<eT> tmp = B; | | Mat<eT> tmp = B; | |
| | | | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| | | | |
| arma_extra_debug_print("lapack::gels()"); | | arma_extra_debug_print("lapack::gels()"); | |
| | | | |
| // NOTE: the dgels() function in the lapack library supplied by ATLAS 3
.6 seems to have problems | | // NOTE: the dgels() function in the lapack library supplied by ATLAS 3
.6 seems to have problems | |
| | | | |
| | | | |
| skipping to change at line 2486 | | skipping to change at line 2496 | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| char trans = 'N'; | | char trans = 'N'; | |
| | | | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| blas_int ldb = A.n_cols; | | blas_int ldb = A.n_cols; | |
| blas_int nrhs = B.n_cols; | | blas_int nrhs = B.n_cols; | |
|
| blas_int lwork = m + (std::max)(m,nrhs); | | blas_int lwork = m + (std::max)(m,nrhs) + 2; // +2 for paranoia: some
versions of Lapack might be trashing memory | |
| blas_int info; | | blas_int info; | |
| | | | |
| Mat<eT> tmp; | | Mat<eT> tmp; | |
| tmp.zeros(A.n_cols, B.n_cols); | | tmp.zeros(A.n_cols, B.n_cols); | |
| | | | |
| for(uword col=0; col<B.n_cols; ++col) | | for(uword col=0; col<B.n_cols; ++col) | |
| { | | { | |
| eT* tmp_colmem = tmp.colptr(col); | | eT* tmp_colmem = tmp.colptr(col); | |
| | | | |
| arrayops::copy( tmp_colmem, B.colptr(col), B.n_rows ); | | arrayops::copy( tmp_colmem, B.colptr(col), B.n_rows ); | |
| | | | |
| skipping to change at line 2634 | | skipping to change at line 2644 | |
| podarray<eT> wi(A_n_rows); // output for eigenvalues | | podarray<eT> wi(A_n_rows); // output for eigenvalues | |
| | | | |
| lapack::gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, wr.mempt
r(), wi.memptr(), Z.memptr(), &n, work.memptr(), &lwork, bwork.memptr(), &i
nfo); | | lapack::gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, wr.mempt
r(), wi.memptr(), Z.memptr(), &n, work.memptr(), &lwork, bwork.memptr(), &i
nfo); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| arma_ignore(Z); | | arma_ignore(Z); | |
| arma_ignore(T); | | arma_ignore(T); | |
|
| | | arma_ignore(A); | |
| | | | |
| arma_stop("schur_dec(): use of LAPACK needs to be enabled"); | | arma_stop("schur_dec(): use of LAPACK needs to be enabled"); | |
| return false; | | return false; | |
| } | | } | |
| #endif | | #endif | |
| } | | } | |
| | | | |
| template<typename cT> | | template<typename cT> | |
| inline | | inline | |
| bool | | bool | |
| auxlib::schur_dec(Mat<std::complex<cT> >& Z, Mat<std::complex<cT> >& T, con
st Mat<std::complex<cT> >& A) | | auxlib::schur_dec(Mat<std::complex<cT> >& Z, Mat<std::complex<cT> >& T, con
st Mat<std::complex<cT> >& A) | |
| | | | |
| skipping to change at line 2689 | | skipping to change at line 2701 | |
| podarray<cT> rwork(A_n_rows); | | podarray<cT> rwork(A_n_rows); | |
| | | | |
| lapack::cx_gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, w.mem
ptr(), Z.memptr(), &n, work.memptr(), &lwork, rwork.memptr(), bwork.memptr(
), &info); | | lapack::cx_gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, w.mem
ptr(), Z.memptr(), &n, work.memptr(), &lwork, rwork.memptr(), bwork.memptr(
), &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| arma_ignore(Z); | | arma_ignore(Z); | |
| arma_ignore(T); | | arma_ignore(T); | |
|
| | | arma_ignore(A); | |
| | | | |
| arma_stop("schur_dec(): use of LAPACK needs to be enabled"); | | arma_stop("schur_dec(): use of LAPACK needs to be enabled"); | |
| return false; | | return false; | |
| } | | } | |
| #endif | | #endif | |
| } | | } | |
| | | | |
| // | | // | |
| // syl (solution of the Sylvester equation AX + XB = C) | | // syl (solution of the Sylvester equation AX + XB = C) | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| | | | |
End of changes. 20 change blocks. |
| 19 lines changed or deleted | | 35 lines changed or added | |
|
| fn_princomp.hpp | | fn_princomp.hpp | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| ( | | ( | |
| Mat<typename T1::elem_type>& coeff_out, | | Mat<typename T1::elem_type>& coeff_out, | |
| Mat<typename T1::elem_type>& score_out, | | Mat<typename T1::elem_type>& score_out, | |
| Col<typename T1::pod_type>& latent_out, | | Col<typename T1::pod_type>& latent_out, | |
| Col<typename T1::elem_type>& tsquared_out, | | Col<typename T1::elem_type>& tsquared_out, | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | arma_ignore(junk); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const unwrap<T1> tmp(X.get_ref()); | | const unwrap<T1> tmp(X.get_ref()); | |
| const Mat<eT>& A = tmp.M; | | const Mat<eT>& A = tmp.M; | |
| | | | |
| const bool status = op_princomp::direct_princomp(coeff_out, score_out, la
tent_out, tsquared_out, A); | | const bool status = op_princomp::direct_princomp(coeff_out, score_out, la
tent_out, tsquared_out, A); | |
| | | | |
| if(status == false) | | if(status == false) | |
| { | | { | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 77 | |
| princomp | | princomp | |
| ( | | ( | |
| Mat<typename T1::elem_type>& coeff_out, | | Mat<typename T1::elem_type>& coeff_out, | |
| Mat<typename T1::elem_type>& score_out, | | Mat<typename T1::elem_type>& score_out, | |
| Col<typename T1::pod_type>& latent_out, | | Col<typename T1::pod_type>& latent_out, | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | arma_ignore(junk); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const unwrap<T1> tmp(X.get_ref()); | | const unwrap<T1> tmp(X.get_ref()); | |
| const Mat<eT>& A = tmp.M; | | const Mat<eT>& A = tmp.M; | |
| | | | |
| const bool status = op_princomp::direct_princomp(coeff_out, score_out, la
tent_out, A); | | const bool status = op_princomp::direct_princomp(coeff_out, score_out, la
tent_out, A); | |
| | | | |
| if(status == false) | | if(status == false) | |
| { | | { | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 114 | |
| bool | | bool | |
| princomp | | princomp | |
| ( | | ( | |
| Mat<typename T1::elem_type>& coeff_out, | | Mat<typename T1::elem_type>& coeff_out, | |
| Mat<typename T1::elem_type>& score_out, | | Mat<typename T1::elem_type>& score_out, | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | arma_ignore(junk); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const unwrap<T1> tmp(X.get_ref()); | | const unwrap<T1> tmp(X.get_ref()); | |
| const Mat<eT>& A = tmp.M; | | const Mat<eT>& A = tmp.M; | |
| | | | |
| const bool status = op_princomp::direct_princomp(coeff_out, score_out, A)
; | | const bool status = op_princomp::direct_princomp(coeff_out, score_out, A)
; | |
| | | | |
| if(status == false) | | if(status == false) | |
| { | | { | |
| | | | |
| skipping to change at line 145 | | skipping to change at line 148 | |
| inline | | inline | |
| bool | | bool | |
| princomp | | princomp | |
| ( | | ( | |
| Mat<typename T1::elem_type>& coeff_out, | | Mat<typename T1::elem_type>& coeff_out, | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | arma_ignore(junk); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const unwrap<T1> tmp(X.get_ref()); | | const unwrap<T1> tmp(X.get_ref()); | |
| const Mat<eT>& A = tmp.M; | | const Mat<eT>& A = tmp.M; | |
| | | | |
| const bool status = op_princomp::direct_princomp(coeff_out, A); | | const bool status = op_princomp::direct_princomp(coeff_out, A); | |
| | | | |
| if(status == false) | | if(status == false) | |
| { | | { | |
| | | | |
| skipping to change at line 173 | | skipping to change at line 177 | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| const Op<T1, op_princomp> | | const Op<T1, op_princomp> | |
| princomp | | princomp | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
|
| | | arma_ignore(junk); | |
| | | | |
| return Op<T1, op_princomp>(X.get_ref()); | | return Op<T1, op_princomp>(X.get_ref()); | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 5 change blocks. |
| 0 lines changed or deleted | | 5 lines changed or added | |
|
| glue_solve_meat.hpp | | glue_solve_meat.hpp | |
|
| // Copyright (C) 2009-2011 NICTA (www.nicta.com.au) | | // Copyright (C) 2009-2012 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2009-2011 Conrad Sanderson | | // Copyright (C) 2009-2012 Conrad Sanderson | |
| // | | // | |
| // This file is part of the Armadillo C++ library. | | // This file is part of the Armadillo C++ library. | |
| // It is provided without any warranty of fitness | | // It is provided without any warranty of fitness | |
| // 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 glue_solve | | //! \addtogroup glue_solve | |
| //! @{ | | //! @{ | |
| | | | |
|
| template<typename T1, typename T2> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
|
| glue_solve::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_s
olve>& X) | | glue_solve::solve_direct(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const
bool slow) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | const uword A_n_rows = A.n_rows; | |
| | | const uword A_n_cols = A.n_cols; | |
| | | | |
|
| Mat<eT> A = X.A.get_ref(); | | arma_debug_check( (A_n_rows != B.n_rows), "solve(): number of rows in A a | |
| | | nd B must be the same" ); | |
| const unwrap_check<T2> B_tmp(X.B, out); | | | |
| const Mat<eT>& B = B_tmp.M; | | | |
| | | | |
|
| arma_debug_check( (A.n_rows != B.n_rows), "solve(): number of rows in A a
nd B must be the same" ); | | bool status = false; | |
| | | | |
|
| bool status; | | if(A_n_rows == A_n_cols) | |
| | | | |
| if(A.n_rows == A.n_cols) | | | |
| { | | { | |
|
| const uword mode = X.aux_uword; | | status = auxlib::solve(out, A, B, slow); | |
| | | | |
| status = (mode == 0) ? auxlib::solve(out, A, B) : auxlib::solve(out, A, | | | |
| B, true); | | | |
| } | | } | |
| else | | else | |
|
| if(A.n_rows > A.n_cols) | | if(A_n_rows > A_n_cols) | |
| { | | { | |
| arma_extra_debug_print("solve(): detected over-determined system"); | | arma_extra_debug_print("solve(): detected over-determined system"); | |
| status = auxlib::solve_od(out, A, B); | | status = auxlib::solve_od(out, A, B); | |
| } | | } | |
| else | | else | |
| { | | { | |
| arma_extra_debug_print("solve(): detected under-determined system"); | | arma_extra_debug_print("solve(): detected under-determined system"); | |
| status = auxlib::solve_ud(out, A, B); | | status = auxlib::solve_ud(out, A, B); | |
| } | | } | |
| | | | |
| if(status == false) | | if(status == false) | |
| { | | { | |
| out.reset(); | | out.reset(); | |
| arma_bad("solve(): solution not found"); | | arma_bad("solve(): solution not found"); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| void | | void | |
|
| | | glue_solve::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_s | |
| | | olve>& X) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | typedef typename T1::elem_type eT; | |
| | | | |
| | | Mat<eT> A = X.A.get_ref(); | |
| | | | |
| | | const unwrap_check<T2> B_tmp(X.B, out); | |
| | | const Mat<eT>& B = B_tmp.M; | |
| | | | |
| | | glue_solve::solve_direct( out, A, B, (X.aux_uword == 1) ); | |
| | | } | |
| | | | |
| | | template<typename T1, typename T2> | |
| | | inline | |
| | | void | |
| glue_solve_tr::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glu
e_solve_tr>& X) | | glue_solve_tr::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glu
e_solve_tr>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const unwrap_check<T1> A_tmp(X.A, out); | | const unwrap_check<T1> A_tmp(X.A, out); | |
| const unwrap_check<T2> B_tmp(X.B, out); | | const unwrap_check<T2> B_tmp(X.B, out); | |
| | | | |
| const Mat<eT>& A = A_tmp.M; | | const Mat<eT>& A = A_tmp.M; | |
| | | | |
End of changes. 10 change blocks. |
| 18 lines changed or deleted | | 30 lines changed or added | |
|
| operator_div.hpp | | operator_div.hpp | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| // 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 operator_div | | //! \addtogroup operator_div | |
| //! @{ | | //! @{ | |
| | | | |
| //! Base / scalar | | //! Base / scalar | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_scalar_div_post> | | typename | |
| | | enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_div_post> >:: | |
| | | result | |
| operator/ | | operator/ | |
| ( | | ( | |
|
| const Base<typename T1::elem_type,T1>& X, | | const T1& X, | |
| const typename T1::elem_type k | | const typename T1::elem_type k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1, eop_scalar_div_post>(X.get_ref(), k); | | return eOp<T1, eop_scalar_div_post>(X, k); | |
| } | | } | |
| | | | |
| //! scalar / Base | | //! scalar / Base | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_scalar_div_pre> | | typename | |
| | | enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_div_pre> >::r | |
| | | esult | |
| operator/ | | operator/ | |
| ( | | ( | |
|
| const typename T1::elem_type k, | | const typename T1::elem_type k, | |
| const Base<typename T1::elem_type,T1>& X | | const T1& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1, eop_scalar_div_pre>(X.get_ref(), k); | | return eOp<T1, eop_scalar_div_pre>(X, k); | |
| } | | } | |
| | | | |
|
| //! complex scalar / non-complex Base (experimental) | | //! complex scalar / non-complex Base | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_d | | typename | |
| iv_pre> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value == | |
| | | false), | |
| | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar | |
| | | _div_pre> | |
| | | >::result | |
| operator/ | | operator/ | |
| ( | | ( | |
| const std::complex<typename T1::pod_type>& k, | | const std::complex<typename T1::pod_type>& k, | |
|
| const Base<typename T1::pod_type, T1>& X | | const T1& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_div_pre>('j', X.get_ref(), k); | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_div_pre>('j', X, k); | |
| } | | } | |
| | | | |
|
| //! non-complex Base / complex scalar (experimental) | | //! non-complex Base / complex scalar | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_d | | typename | |
| iv_post> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value == | |
| | | false), | |
| | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar | |
| | | _div_post> | |
| | | >::result | |
| operator/ | | operator/ | |
| ( | | ( | |
|
| const Base<typename T1::pod_type, T1>& X, | | const T1& X, | |
| const std::complex<typename T1::pod_type>& k | | const std::complex<typename T1::pod_type>& k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_div_post>('j', X.get_ref(), k); | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_div_post>('j', X, k); | |
| } | | } | |
| | | | |
| //! element-wise division of Base objects with same element type | | //! element-wise division of Base objects with same element type | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
|
| const eGlue<T1, T2, eglue_div> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typen | |
| | | ame T1::elem_type, typename T2::elem_type>::value), | |
| | | const eGlue<T1, T2, eglue_div> | |
| | | >::result | |
| operator/ | | operator/ | |
| ( | | ( | |
|
| const Base<typename T1::elem_type,T1>& X, | | const T1& X, | |
| const Base<typename T1::elem_type,T2>& Y | | const T2& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eGlue<T1, T2, eglue_div>(X.get_ref(), Y.get_ref()); | | return eGlue<T1, T2, eglue_div>(X, Y); | |
| } | | } | |
| | | | |
| //! element-wise division of Base objects with different element types | | //! element-wise division of Base objects with different element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele | | typename | |
| m_type>::result, T1, T2, glue_mixed_div> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type | |
| | | name T1::elem_type, typename T2::elem_type>::value == false)), | |
| | | const mtGlue<typename promote_type<typename T1::elem_type, typename T2::e | |
| | | lem_type>::result, T1, T2, glue_mixed_div> | |
| | | >::result | |
| operator/ | | operator/ | |
| ( | | ( | |
|
| const Base< typename force_different_type<typename T1::elem_type, typenam | | const T1& X, | |
| e T2::elem_type>::T1_result, T1>& X, | | const T2& Y | |
| const Base< typename force_different_type<typename T1::elem_type, typenam | | | |
| e T2::elem_type>::T2_result, T2>& Y | | | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| 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 promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| return mtGlue<out_eT, T1, T2, glue_mixed_div>( X.get_ref(), Y.get_ref() )
; | | return mtGlue<out_eT, T1, T2, glue_mixed_div>( X, Y ); | |
| } | | } | |
| | | | |
|
| // | | | |
| // | | | |
| // | | | |
| | | | |
| #undef armaObj | | | |
| #undef armaObjA | | | |
| #undef armaObjB | | | |
| | | | |
| #undef arma_operator_obj_scalar | | | |
| #undef arma_operator_scalar_obj | | | |
| #undef arma_operator_obj_cx_scalar | | | |
| #undef arma_operator_cx_scalar_obj | | | |
| #undef arma_operator_obj_base | | | |
| #undef arma_operator_base_obj | | | |
| #undef arma_operator_obj1_obj2 | | | |
| #undef arma_operator_obj1_obj2_mixed | | | |
| | | | |
| #define arma_operator_obj_scalar(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_scalar_div_post> \ | | | |
| operator/ \ | | | |
| (const armaObj<eT>& X, const typename armaObj<eT>::elem_type k) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>, eop_scalar_div_post>(X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_scalar_obj(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_scalar_div_pre> \ | | | |
| operator/ \ | | | |
| (const typename armaObj<eT>::elem_type k, const armaObj<eT>& X) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>, eop_scalar_div_pre>(X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_cx_scalar(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e | | | |
| T>, op_cx_scalar_div_post> \ | | | |
| operator/ \ | | | |
| ( \ | | | |
| const armaObj<eT>& X, \ | | | |
| const std::complex<typename armaObj<eT>::pod_type>& k \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb | | | |
| j<eT>, op_cx_scalar_div_post>('j', X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_cx_scalar_obj(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e | | | |
| T>, op_cx_scalar_div_pre> \ | | | |
| operator/ \ | | | |
| ( \ | | | |
| const std::complex<typename armaObj<eT>::pod_type>& k, \ | | | |
| const armaObj<eT>& X \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb | | | |
| j<eT>, op_cx_scalar_div_pre>('j', X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_base(armaObj) \ | | | |
| template<typename BT> \ | | | |
| arma_inline \ | | | |
| const eGlue<armaObj<typename BT::elem_type>, BT, eglue_div> \ | | | |
| operator/ \ | | | |
| ( \ | | | |
| const armaObj<typename BT::elem_type>& X, \ | | | |
| const Base<typename BT::elem_type, BT>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<armaObj<typename BT::elem_type>, BT, eglue_div>(X, Y.get_ref | | | |
| ()); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_base_obj(armaObj) \ | | | |
| template<typename BT> \ | | | |
| arma_inline \ | | | |
| const eGlue<BT, armaObj<typename BT::elem_type>, eglue_div> \ | | | |
| operator/ \ | | | |
| ( \ | | | |
| const Base<typename BT::elem_type, BT>& X, \ | | | |
| const armaObj<typename BT::elem_type> & Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<BT, armaObj<typename BT::elem_type>, eglue_div>(X.get_ref(), | | | |
| Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj1_obj2(armaObjA, armaObjB) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eGlue<armaObjA<eT>, armaObjB<eT>, eglue_div> \ | | | |
| operator/ \ | | | |
| ( \ | | | |
| const armaObjA<eT>& X, \ | | | |
| const armaObjB<eT>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<armaObjA<eT>, armaObjB<eT>, eglue_div>(X, Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj1_obj2_mixed(armaObjA, armaObjB) \ | | | |
| template<typename eT1, typename eT2> \ | | | |
| inline \ | | | |
| const mtGlue<typename promote_type<eT1, eT2>::result, armaObjA<eT1>, armaOb | | | |
| jB<eT2>, glue_mixed_div> \ | | | |
| operator/ \ | | | |
| ( \ | | | |
| const armaObjA<eT1>& X, \ | | | |
| const armaObjB<eT2>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| typedef typename promote_type<eT1,eT2>::result out_eT; \ | | | |
| \ | | | |
| promote_type<eT1,eT2>::check(); \ | | | |
| \ | | | |
| return mtGlue<out_eT, armaObjA<eT1>, armaObjB<eT2>, glue_mixed_div>( X, Y | | | |
| ); \ | | | |
| } | | | |
| | | | |
| arma_operator_obj_scalar(Col) | | | |
| arma_operator_obj_scalar(Row) | | | |
| arma_operator_obj_scalar(diagview) | | | |
| arma_operator_obj_scalar(subview_col) | | | |
| arma_operator_obj_scalar(subview_row) | | | |
| | | | |
| arma_operator_scalar_obj(Col) | | | |
| arma_operator_scalar_obj(Row) | | | |
| arma_operator_scalar_obj(diagview) | | | |
| arma_operator_scalar_obj(subview_col) | | | |
| arma_operator_scalar_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_cx_scalar(Col) | | | |
| arma_operator_obj_cx_scalar(Row) | | | |
| arma_operator_obj_cx_scalar(diagview) | | | |
| arma_operator_obj_cx_scalar(subview_col) | | | |
| arma_operator_obj_cx_scalar(subview_row) | | | |
| | | | |
| arma_operator_cx_scalar_obj(Col) | | | |
| arma_operator_cx_scalar_obj(Row) | | | |
| arma_operator_cx_scalar_obj(diagview) | | | |
| arma_operator_cx_scalar_obj(subview_col) | | | |
| arma_operator_cx_scalar_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_base(Col) | | | |
| arma_operator_obj_base(Row) | | | |
| arma_operator_obj_base(diagview) | | | |
| arma_operator_obj_base(subview_col) | | | |
| arma_operator_obj_base(subview_row) | | | |
| | | | |
| arma_operator_base_obj(Col) | | | |
| arma_operator_base_obj(Row) | | | |
| arma_operator_base_obj(diagview) | | | |
| arma_operator_base_obj(subview_col) | | | |
| arma_operator_base_obj(subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(Col,Col) | | | |
| arma_operator_obj1_obj2(Col,Row) | | | |
| arma_operator_obj1_obj2(Col,diagview) | | | |
| arma_operator_obj1_obj2(Col,subview_col) | | | |
| arma_operator_obj1_obj2(Col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(Row,Col) | | | |
| arma_operator_obj1_obj2(Row,Row) | | | |
| arma_operator_obj1_obj2(Row,diagview) | | | |
| arma_operator_obj1_obj2(Row,subview_col) | | | |
| arma_operator_obj1_obj2(Row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(diagview,Col) | | | |
| arma_operator_obj1_obj2(diagview,Row) | | | |
| arma_operator_obj1_obj2(diagview,diagview) | | | |
| arma_operator_obj1_obj2(diagview,subview_col) | | | |
| arma_operator_obj1_obj2(diagview,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(subview_col,Col) | | | |
| arma_operator_obj1_obj2(subview_col,Row) | | | |
| arma_operator_obj1_obj2(subview_col,diagview) | | | |
| arma_operator_obj1_obj2(subview_col,subview_col) | | | |
| arma_operator_obj1_obj2(subview_col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(subview_row,Col) | | | |
| arma_operator_obj1_obj2(subview_row,Row) | | | |
| arma_operator_obj1_obj2(subview_row,diagview) | | | |
| arma_operator_obj1_obj2(subview_row,subview_col) | | | |
| arma_operator_obj1_obj2(subview_row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(Col,Col) | | | |
| arma_operator_obj1_obj2_mixed(Col,Row) | | | |
| arma_operator_obj1_obj2_mixed(Col,diagview) | | | |
| arma_operator_obj1_obj2_mixed(Col,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(Col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(Row,Col) | | | |
| arma_operator_obj1_obj2_mixed(Row,Row) | | | |
| arma_operator_obj1_obj2_mixed(Row,diagview) | | | |
| arma_operator_obj1_obj2_mixed(Row,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(Row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(diagview,Col) | | | |
| arma_operator_obj1_obj2_mixed(diagview,Row) | | | |
| arma_operator_obj1_obj2_mixed(diagview,diagview) | | | |
| arma_operator_obj1_obj2_mixed(diagview,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(diagview,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(subview_col,Col) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,Row) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,diagview) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,subview_row) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,Col) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,Row) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,diagview) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,subview_row) | | | |
| | | | |
| // TODO: explicit handling of subview_elem1, perhaps via expanding the abov | | | |
| e macros to take another paramater (for template<T1>) | | | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 21 change blocks. |
| 270 lines changed or deleted | | 55 lines changed or added | |
|
| operator_minus.hpp | | operator_minus.hpp | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| // 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 operator_minus | | //! \addtogroup operator_minus | |
| //! @{ | | //! @{ | |
| | | | |
| //! unary - | | //! unary - | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_neg> | | typename | |
| | | enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_neg> >::result | |
| operator- | | operator- | |
|
| (const Base<typename T1::elem_type,T1>& X) | | (const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1,eop_neg>(X.get_ref()); | | return eOp<T1,eop_neg>(X); | |
| } | | } | |
| | | | |
| //! cancellation of two consecutive negations: -(-T1) | | //! cancellation of two consecutive negations: -(-T1) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const T1& | | const T1& | |
| operator- | | operator- | |
| (const eOp<T1, eop_neg>& X) | | (const eOp<T1, eop_neg>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return X.m; | | return X.m; | |
| } | | } | |
| | | | |
| //! Base - scalar | | //! Base - scalar | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_scalar_minus_post> | | typename | |
| | | enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_minus_post> > | |
| | | ::result | |
| operator- | | operator- | |
| ( | | ( | |
|
| const Base<typename T1::elem_type,T1>& X, | | const T1& X, | |
| const typename T1::elem_type k | | const typename T1::elem_type k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1, eop_scalar_minus_post>(X.get_ref(), k); | | return eOp<T1, eop_scalar_minus_post>(X, k); | |
| } | | } | |
| | | | |
| //! scalar - Base | | //! scalar - Base | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_scalar_minus_pre> | | typename | |
| | | enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_minus_pre> >: | |
| | | :result | |
| operator- | | operator- | |
| ( | | ( | |
|
| const typename T1::elem_type k, | | const typename T1::elem_type k, | |
| const Base<typename T1::elem_type,T1>& X | | const T1& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1, eop_scalar_minus_pre>(X.get_ref(), k); | | return eOp<T1, eop_scalar_minus_pre>(X, k); | |
| } | | } | |
| | | | |
|
| //! complex scalar - non-complex Base (experimental) | | //! complex scalar - non-complex Base | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_m | | typename | |
| inus_pre> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value == | |
| | | false), | |
| | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar | |
| | | _minus_pre> | |
| | | >::result | |
| operator- | | operator- | |
| ( | | ( | |
| const std::complex<typename T1::pod_type>& k, | | const std::complex<typename T1::pod_type>& k, | |
|
| const Base<typename T1::pod_type, T1>& X | | const T1& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_minus_pre>('j', X.get_ref(), k); | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_minus_pre>('j', X, k); | |
| } | | } | |
| | | | |
|
| //! non-complex Base - complex scalar (experimental) | | //! non-complex Base - complex scalar | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_m | | typename | |
| inus_post> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value == | |
| | | false), | |
| | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar | |
| | | _minus_post> | |
| | | >::result | |
| operator- | | operator- | |
| ( | | ( | |
|
| const Base<typename T1::pod_type, T1>& X, | | const T1& X, | |
| const std::complex<typename T1::pod_type>& k | | const std::complex<typename T1::pod_type>& k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_minus_post>('j', X.get_ref(), k); | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_minus_post>('j', X, k); | |
| } | | } | |
| | | | |
| //! subtraction of Base objects with same element type | | //! subtraction of Base objects with same element type | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
|
| const eGlue<T1, T2, eglue_minus> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena | |
| | | me T1::elem_type, typename T2::elem_type>::value, | |
| | | const eGlue<T1, T2, eglue_minus> | |
| | | >::result | |
| operator- | | operator- | |
| ( | | ( | |
|
| const Base<typename T1::elem_type,T1>& X, | | const T1& X, | |
| const Base<typename T1::elem_type,T2>& Y | | const T2& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eGlue<T1, T2, eglue_minus>(X.get_ref(), Y.get_ref()); | | return eGlue<T1, T2, eglue_minus>(X, Y); | |
| } | | } | |
| | | | |
| //! subtraction of Base objects with different element types | | //! subtraction of Base objects with different element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele | | typename | |
| m_type>::result, T1, T2, glue_mixed_minus> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type | |
| | | name T1::elem_type, typename T2::elem_type>::value == false)), | |
| | | const mtGlue<typename promote_type<typename T1::elem_type, typename T2::e | |
| | | lem_type>::result, T1, T2, glue_mixed_minus> | |
| | | >::result | |
| operator- | | operator- | |
| ( | | ( | |
|
| const Base< typename force_different_type<typename T1::elem_type, typenam | | const T1& X, | |
| e T2::elem_type>::T1_result, T1>& X, | | const T2& Y | |
| const Base< typename force_different_type<typename T1::elem_type, typenam | | | |
| e T2::elem_type>::T2_result, T2>& Y | | | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| 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 promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| return mtGlue<out_eT, T1, T2, glue_mixed_minus>( X.get_ref(), Y.get_ref()
); | | return mtGlue<out_eT, T1, T2, glue_mixed_minus>( X, Y ); | |
| } | | } | |
| | | | |
|
| // | | | |
| // | | | |
| // | | | |
| | | | |
| #undef armaObj | | | |
| #undef armaObjA | | | |
| #undef armaObjB | | | |
| | | | |
| #undef arma_operator_unary | | | |
| #undef arma_operator_obj_scalar | | | |
| #undef arma_operator_scalar_obj | | | |
| #undef arma_operator_obj_cx_scalar | | | |
| #undef arma_operator_cx_scalar_obj | | | |
| #undef arma_operator_obj_base | | | |
| #undef arma_operator_base_obj | | | |
| #undef arma_operator_obj1_obj2 | | | |
| #undef arma_operator_obj1_obj2_mixed | | | |
| | | | |
| #define arma_operator_unary(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_neg> \ | | | |
| operator- \ | | | |
| (const armaObj<eT>& X) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>,eop_neg>(X); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_scalar(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_scalar_minus_post> \ | | | |
| operator- \ | | | |
| (const armaObj<eT>& X, const typename armaObj<eT>::elem_type k) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>, eop_scalar_minus_post>(X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_scalar_obj(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_scalar_minus_pre> \ | | | |
| operator- \ | | | |
| (const typename armaObj<eT>::elem_type k, const armaObj<eT>& X) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>, eop_scalar_minus_pre>(X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_cx_scalar(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e | | | |
| T>, op_cx_scalar_minus_post> \ | | | |
| operator- \ | | | |
| ( \ | | | |
| const armaObj<eT>& X, \ | | | |
| const std::complex<typename armaObj<eT>::pod_type>& k \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb | | | |
| j<eT>, op_cx_scalar_minus_post>('j', X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_cx_scalar_obj(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e | | | |
| T>, op_cx_scalar_minus_pre> \ | | | |
| operator- \ | | | |
| ( \ | | | |
| const std::complex<typename armaObj<eT>::pod_type>& k, \ | | | |
| const armaObj<eT>& X \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb | | | |
| j<eT>, op_cx_scalar_minus_pre>('j', X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_base(armaObj) \ | | | |
| template<typename BT> \ | | | |
| arma_inline \ | | | |
| const eGlue<armaObj<typename BT::elem_type>, BT, eglue_minus> \ | | | |
| operator- \ | | | |
| ( \ | | | |
| const armaObj<typename BT::elem_type>& X, \ | | | |
| const Base<typename BT::elem_type, BT>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<armaObj<typename BT::elem_type>, BT, eglue_minus>(X, Y.get_r | | | |
| ef()); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_base_obj(armaObj) \ | | | |
| template<typename BT> \ | | | |
| arma_inline \ | | | |
| const eGlue<BT, armaObj<typename BT::elem_type>, eglue_minus> \ | | | |
| operator- \ | | | |
| ( \ | | | |
| const Base<typename BT::elem_type, BT>& X, \ | | | |
| const armaObj<typename BT::elem_type> & Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<BT, armaObj<typename BT::elem_type>, eglue_minus>(X.get_ref( | | | |
| ), Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj1_obj2(armaObjA, armaObjB) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eGlue<armaObjA<eT>, armaObjB<eT>, eglue_minus> \ | | | |
| operator- \ | | | |
| ( \ | | | |
| const armaObjA<eT>& X, \ | | | |
| const armaObjB<eT>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<armaObjA<eT>, armaObjB<eT>, eglue_minus>(X, Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj1_obj2_mixed(armaObjA, armaObjB) \ | | | |
| template<typename eT1, typename eT2> \ | | | |
| inline \ | | | |
| const mtGlue<typename promote_type<eT1, eT2>::result, armaObjA<eT1>, armaOb | | | |
| jB<eT2>, glue_mixed_minus> \ | | | |
| operator- \ | | | |
| ( \ | | | |
| const armaObjA<eT1>& X, \ | | | |
| const armaObjB<eT2>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| typedef typename promote_type<eT1,eT2>::result out_eT; \ | | | |
| \ | | | |
| promote_type<eT1,eT2>::check(); \ | | | |
| \ | | | |
| return mtGlue<out_eT, armaObjA<eT1>, armaObjB<eT2>, glue_mixed_minus>( X, | | | |
| Y ); \ | | | |
| } | | | |
| | | | |
| arma_operator_unary(Col) | | | |
| arma_operator_unary(Row) | | | |
| arma_operator_unary(diagview) | | | |
| arma_operator_unary(subview_col) | | | |
| arma_operator_unary(subview_row) | | | |
| | | | |
| arma_operator_obj_scalar(Col) | | | |
| arma_operator_obj_scalar(Row) | | | |
| arma_operator_obj_scalar(diagview) | | | |
| arma_operator_obj_scalar(subview_col) | | | |
| arma_operator_obj_scalar(subview_row) | | | |
| | | | |
| arma_operator_scalar_obj(Col) | | | |
| arma_operator_scalar_obj(Row) | | | |
| arma_operator_scalar_obj(diagview) | | | |
| arma_operator_scalar_obj(subview_col) | | | |
| arma_operator_scalar_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_cx_scalar(Col) | | | |
| arma_operator_obj_cx_scalar(Row) | | | |
| arma_operator_obj_cx_scalar(diagview) | | | |
| arma_operator_obj_cx_scalar(subview_col) | | | |
| arma_operator_obj_cx_scalar(subview_row) | | | |
| | | | |
| arma_operator_cx_scalar_obj(Col) | | | |
| arma_operator_cx_scalar_obj(Row) | | | |
| arma_operator_cx_scalar_obj(diagview) | | | |
| arma_operator_cx_scalar_obj(subview_col) | | | |
| arma_operator_cx_scalar_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_base(Col) | | | |
| arma_operator_obj_base(Row) | | | |
| arma_operator_obj_base(diagview) | | | |
| arma_operator_obj_base(subview_col) | | | |
| arma_operator_obj_base(subview_row) | | | |
| | | | |
| arma_operator_base_obj(Col) | | | |
| arma_operator_base_obj(Row) | | | |
| arma_operator_base_obj(diagview) | | | |
| arma_operator_base_obj(subview_col) | | | |
| arma_operator_base_obj(subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(Col,Col) | | | |
| arma_operator_obj1_obj2(Col,Row) | | | |
| arma_operator_obj1_obj2(Col,diagview) | | | |
| arma_operator_obj1_obj2(Col,subview_col) | | | |
| arma_operator_obj1_obj2(Col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(Row,Col) | | | |
| arma_operator_obj1_obj2(Row,Row) | | | |
| arma_operator_obj1_obj2(Row,diagview) | | | |
| arma_operator_obj1_obj2(Row,subview_col) | | | |
| arma_operator_obj1_obj2(Row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(diagview,Col) | | | |
| arma_operator_obj1_obj2(diagview,Row) | | | |
| arma_operator_obj1_obj2(diagview,diagview) | | | |
| arma_operator_obj1_obj2(diagview,subview_col) | | | |
| arma_operator_obj1_obj2(diagview,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(subview_col,Col) | | | |
| arma_operator_obj1_obj2(subview_col,Row) | | | |
| arma_operator_obj1_obj2(subview_col,diagview) | | | |
| arma_operator_obj1_obj2(subview_col,subview_col) | | | |
| arma_operator_obj1_obj2(subview_col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(subview_row,Col) | | | |
| arma_operator_obj1_obj2(subview_row,Row) | | | |
| arma_operator_obj1_obj2(subview_row,diagview) | | | |
| arma_operator_obj1_obj2(subview_row,subview_col) | | | |
| arma_operator_obj1_obj2(subview_row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(Col,Col) | | | |
| arma_operator_obj1_obj2_mixed(Col,Row) | | | |
| arma_operator_obj1_obj2_mixed(Col,diagview) | | | |
| arma_operator_obj1_obj2_mixed(Col,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(Col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(Row,Col) | | | |
| arma_operator_obj1_obj2_mixed(Row,Row) | | | |
| arma_operator_obj1_obj2_mixed(Row,diagview) | | | |
| arma_operator_obj1_obj2_mixed(Row,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(Row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(diagview,Col) | | | |
| arma_operator_obj1_obj2_mixed(diagview,Row) | | | |
| arma_operator_obj1_obj2_mixed(diagview,diagview) | | | |
| arma_operator_obj1_obj2_mixed(diagview,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(diagview,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(subview_col,Col) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,Row) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,diagview) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,subview_row) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,Col) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,Row) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,diagview) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,subview_row) | | | |
| | | | |
| // TODO: explicit handling of subview_elem1, perhaps via expanding the abov | | | |
| e macros to take another paramater (for template<T1>) | | | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 24 change blocks. |
| 292 lines changed or deleted | | 59 lines changed or added | |
|
| operator_plus.hpp | | operator_plus.hpp | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| // 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 operator_plus | | //! \addtogroup operator_plus | |
| //! @{ | | //! @{ | |
| | | | |
| //! unary plus operation (does nothing, but is required for completeness) | | //! unary plus operation (does nothing, but is required for completeness) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const Base<typename T1::elem_type,T1>& | | typename enable_if2< is_arma_type<T1>::value, const T1& >::result | |
| operator+ | | operator+ | |
|
| (const Base<typename T1::elem_type,T1>& X) | | (const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return X; | | return X; | |
| } | | } | |
| | | | |
| //! Base + scalar | | //! Base + scalar | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_scalar_plus> | | typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_plus
> >::result | |
| operator+ | | operator+ | |
|
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type k) | | (const T1& X, const typename T1::elem_type k) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1, eop_scalar_plus>(X.get_ref(), k); | | return eOp<T1, eop_scalar_plus>(X, k); | |
| } | | } | |
| | | | |
| //! scalar + Base | | //! scalar + Base | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_scalar_plus> | | typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_plus
> >::result | |
| operator+ | | operator+ | |
|
| (const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X) | | (const typename T1::elem_type k, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1, eop_scalar_plus>(X.get_ref(), k); // NOTE: order is swapp
ed | | return eOp<T1, eop_scalar_plus>(X, k); // NOTE: order is swapped | |
| } | | } | |
| | | | |
| //! non-complex Base + complex scalar | | //! non-complex Base + complex scalar | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_p | | typename | |
| lus> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value == | |
| | | false), | |
| | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar | |
| | | _plus> | |
| | | >::result | |
| operator+ | | operator+ | |
| ( | | ( | |
|
| const Base<typename T1::pod_type, T1>& X, | | const T1& X, | |
| const std::complex<typename T1::pod_type>& k | | const std::complex<typename T1::pod_type>& k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_plus>('j', X.get_ref(), k); | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_plus>('j', X, k); | |
| } | | } | |
| | | | |
| //! complex scalar + non-complex Base | | //! complex scalar + non-complex Base | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_p | | typename | |
| lus> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value == | |
| | | false), | |
| | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar | |
| | | _plus> | |
| | | >::result | |
| operator+ | | operator+ | |
| ( | | ( | |
| const std::complex<typename T1::pod_type>& k, | | const std::complex<typename T1::pod_type>& k, | |
|
| const Base<typename T1::pod_type, T1>& X | | const T1& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_plus>('j', X.get_ref(), k); // NOTE: order is swapped | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_plus>('j', X, k); // NOTE: order is swapped | |
| } | | } | |
| | | | |
|
| //! addition of Base objects with same element type | | //! addition of user-accessible Armadillo objects with same element type | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
|
| const eGlue<T1, T2, eglue_plus> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena | |
| | | me T1::elem_type, typename T2::elem_type>::value, | |
| | | const eGlue<T1, T2, eglue_plus> | |
| | | >::result | |
| operator+ | | operator+ | |
| ( | | ( | |
|
| const Base<typename T1::elem_type,T1>& X, | | const T1& X, | |
| const Base<typename T1::elem_type,T2>& Y | | const T2& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eGlue<T1, T2, eglue_plus>(X.get_ref(), Y.get_ref()); | | return eGlue<T1, T2, eglue_plus>(X, Y); | |
| } | | } | |
| | | | |
|
| //! addition of Base objects with different element types | | //! addition of user-accessible Armadillo objects with different element ty
pes | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele | | typename | |
| m_type>::result, T1, T2, glue_mixed_plus> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type | |
| | | name T1::elem_type, typename T2::elem_type>::value == false)), | |
| | | const mtGlue<typename promote_type<typename T1::elem_type, typename T2::e | |
| | | lem_type>::result, T1, T2, glue_mixed_plus> | |
| | | >::result | |
| operator+ | | operator+ | |
| ( | | ( | |
|
| const Base< typename force_different_type<typename T1::elem_type, typenam | | const T1& X, | |
| e T2::elem_type>::T1_result, T1>& X, | | const T2& Y | |
| const Base< typename force_different_type<typename T1::elem_type, typenam | | | |
| e T2::elem_type>::T2_result, T2>& Y | | | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| 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 promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| return mtGlue<out_eT, T1, T2, glue_mixed_plus>( X.get_ref(), Y.get_ref()
); | | return mtGlue<out_eT, T1, T2, glue_mixed_plus>( X, Y ); | |
| } | | } | |
| | | | |
|
| // | | | |
| // | | | |
| // | | | |
| | | | |
| #undef armaObj | | | |
| #undef armaObjA | | | |
| #undef armaObjB | | | |
| | | | |
| #undef arma_operator_unary | | | |
| #undef arma_operator_obj_scalar | | | |
| #undef arma_operator_scalar_obj | | | |
| #undef arma_operator_obj_cx_scalar | | | |
| #undef arma_operator_cx_scalar_obj | | | |
| #undef arma_operator_obj_base | | | |
| #undef arma_operator_base_obj | | | |
| #undef arma_operator_obj1_obj2 | | | |
| #undef arma_operator_obj1_obj2_mixed | | | |
| | | | |
| #define arma_operator_unary(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const armaObj<eT>& \ | | | |
| operator+ \ | | | |
| (const armaObj<eT>& X) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return X; \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_scalar(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_scalar_plus> \ | | | |
| operator+ \ | | | |
| (const armaObj<eT>& X, const typename armaObj<eT>::elem_type k) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>, eop_scalar_plus>(X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_scalar_obj(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_scalar_plus> \ | | | |
| operator+ \ | | | |
| (const typename armaObj<eT>::elem_type k, const armaObj<eT>& X) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>, eop_scalar_plus>(X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_cx_scalar(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e | | | |
| T>, op_cx_scalar_plus> \ | | | |
| operator+ \ | | | |
| ( \ | | | |
| const armaObj<eT>& X, \ | | | |
| const std::complex<typename armaObj<eT>::pod_type>& k \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb | | | |
| j<eT>, op_cx_scalar_plus>('j', X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_cx_scalar_obj(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e | | | |
| T>, op_cx_scalar_plus> \ | | | |
| operator+ \ | | | |
| ( \ | | | |
| const std::complex<typename armaObj<eT>::pod_type>& k, \ | | | |
| const armaObj<eT>& X \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb | | | |
| j<eT>, op_cx_scalar_plus>('j', X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_base(armaObj) \ | | | |
| template<typename BT> \ | | | |
| arma_inline \ | | | |
| const eGlue<armaObj<typename BT::elem_type>, BT, eglue_plus> \ | | | |
| operator+ \ | | | |
| ( \ | | | |
| const armaObj<typename BT::elem_type>& X, \ | | | |
| const Base<typename BT::elem_type, BT>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<armaObj<typename BT::elem_type>, BT, eglue_plus>(X, Y.get_re | | | |
| f()); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_base_obj(armaObj) \ | | | |
| template<typename BT> \ | | | |
| arma_inline \ | | | |
| const eGlue<BT, armaObj<typename BT::elem_type>, eglue_plus> \ | | | |
| operator+ \ | | | |
| ( \ | | | |
| const Base<typename BT::elem_type, BT>& X, \ | | | |
| const armaObj<typename BT::elem_type> & Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<BT, armaObj<typename BT::elem_type>, eglue_plus>(X.get_ref() | | | |
| , Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj1_obj2(armaObjA, armaObjB) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eGlue<armaObjA<eT>, armaObjB<eT>, eglue_plus> \ | | | |
| operator+ \ | | | |
| ( \ | | | |
| const armaObjA<eT>& X, \ | | | |
| const armaObjB<eT>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eGlue<armaObjA<eT>, armaObjB<eT>, eglue_plus>(X, Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj1_obj2_mixed(armaObjA, armaObjB) \ | | | |
| template<typename eT1, typename eT2> \ | | | |
| inline \ | | | |
| const mtGlue<typename promote_type<eT1, eT2>::result, armaObjA<eT1>, armaOb | | | |
| jB<eT2>, glue_mixed_plus> \ | | | |
| operator+ \ | | | |
| ( \ | | | |
| const armaObjA<eT1>& X, \ | | | |
| const armaObjB<eT2>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| typedef typename promote_type<eT1,eT2>::result out_eT; \ | | | |
| \ | | | |
| promote_type<eT1,eT2>::check(); \ | | | |
| \ | | | |
| return mtGlue<out_eT, armaObjA<eT1>, armaObjB<eT2>, glue_mixed_plus>( X, | | | |
| Y ); \ | | | |
| } | | | |
| | | | |
| arma_operator_unary(Col) | | | |
| arma_operator_unary(Row) | | | |
| arma_operator_unary(diagview) | | | |
| arma_operator_unary(subview_col) | | | |
| arma_operator_unary(subview_row) | | | |
| | | | |
| arma_operator_obj_scalar(Col) | | | |
| arma_operator_obj_scalar(Row) | | | |
| arma_operator_obj_scalar(diagview) | | | |
| arma_operator_obj_scalar(subview_col) | | | |
| arma_operator_obj_scalar(subview_row) | | | |
| | | | |
| arma_operator_scalar_obj(Col) | | | |
| arma_operator_scalar_obj(Row) | | | |
| arma_operator_scalar_obj(diagview) | | | |
| arma_operator_scalar_obj(subview_col) | | | |
| arma_operator_scalar_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_cx_scalar(Col) | | | |
| arma_operator_obj_cx_scalar(Row) | | | |
| arma_operator_obj_cx_scalar(diagview) | | | |
| arma_operator_obj_cx_scalar(subview_col) | | | |
| arma_operator_obj_cx_scalar(subview_row) | | | |
| | | | |
| arma_operator_cx_scalar_obj(Col) | | | |
| arma_operator_cx_scalar_obj(Row) | | | |
| arma_operator_cx_scalar_obj(diagview) | | | |
| arma_operator_cx_scalar_obj(subview_col) | | | |
| arma_operator_cx_scalar_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_base(Col) | | | |
| arma_operator_obj_base(Row) | | | |
| arma_operator_obj_base(diagview) | | | |
| arma_operator_obj_base(subview_col) | | | |
| arma_operator_obj_base(subview_row) | | | |
| | | | |
| arma_operator_base_obj(Col) | | | |
| arma_operator_base_obj(Row) | | | |
| arma_operator_base_obj(diagview) | | | |
| arma_operator_base_obj(subview_col) | | | |
| arma_operator_base_obj(subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(Col,Col) | | | |
| arma_operator_obj1_obj2(Col,Row) | | | |
| arma_operator_obj1_obj2(Col,diagview) | | | |
| arma_operator_obj1_obj2(Col,subview_col) | | | |
| arma_operator_obj1_obj2(Col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(Row,Col) | | | |
| arma_operator_obj1_obj2(Row,Row) | | | |
| arma_operator_obj1_obj2(Row,diagview) | | | |
| arma_operator_obj1_obj2(Row,subview_col) | | | |
| arma_operator_obj1_obj2(Row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(diagview,Col) | | | |
| arma_operator_obj1_obj2(diagview,Row) | | | |
| arma_operator_obj1_obj2(diagview,diagview) | | | |
| arma_operator_obj1_obj2(diagview,subview_col) | | | |
| arma_operator_obj1_obj2(diagview,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(subview_col,Col) | | | |
| arma_operator_obj1_obj2(subview_col,Row) | | | |
| arma_operator_obj1_obj2(subview_col,diagview) | | | |
| arma_operator_obj1_obj2(subview_col,subview_col) | | | |
| arma_operator_obj1_obj2(subview_col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(subview_row,Col) | | | |
| arma_operator_obj1_obj2(subview_row,Row) | | | |
| arma_operator_obj1_obj2(subview_row,diagview) | | | |
| arma_operator_obj1_obj2(subview_row,subview_col) | | | |
| arma_operator_obj1_obj2(subview_row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(Col,Col) | | | |
| arma_operator_obj1_obj2_mixed(Col,Row) | | | |
| arma_operator_obj1_obj2_mixed(Col,diagview) | | | |
| arma_operator_obj1_obj2_mixed(Col,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(Col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(Row,Col) | | | |
| arma_operator_obj1_obj2_mixed(Row,Row) | | | |
| arma_operator_obj1_obj2_mixed(Row,diagview) | | | |
| arma_operator_obj1_obj2_mixed(Row,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(Row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(diagview,Col) | | | |
| arma_operator_obj1_obj2_mixed(diagview,Row) | | | |
| arma_operator_obj1_obj2_mixed(diagview,diagview) | | | |
| arma_operator_obj1_obj2_mixed(diagview,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(diagview,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(subview_col,Col) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,Row) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,diagview) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,subview_row) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,Col) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,Row) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,diagview) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,subview_row) | | | |
| | | | |
| // TODO: explicit handling of subview_elem1, perhaps via expanding the abov | | | |
| e macros to take another paramater (for template<T1>) | | | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 23 change blocks. |
| 289 lines changed or deleted | | 51 lines changed or added | |
|
| operator_relational.hpp | | operator_relational.hpp | |
|
| // Copyright (C) 2009-2010 NICTA (www.nicta.com.au) | | // Copyright (C) 2009-2012 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2009-2010 Conrad Sanderson | | // Copyright (C) 2009-2012 Conrad Sanderson | |
| // | | // | |
| // This file is part of the Armadillo C++ library. | | // This file is part of the Armadillo C++ library. | |
| // It is provided without any warranty of fitness | | // It is provided without any warranty of fitness | |
| // 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) | |
| | | | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| | | | |
| // < : lt | | // < : lt | |
| // > : gt | | // > : gt | |
| // <= : lteq | | // <= : lteq | |
| // >= : gteq | | // >= : gteq | |
| // == : eq | | // == : eq | |
| // != : noteq | | // != : noteq | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<uword, T1, T2, glue_rel_lt> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_complex<typena | |
| | | me T1::elem_type>::value == false) && (is_complex<typename T2::elem_type>:: | |
| | | value == false)), | |
| | | const mtGlue<uword, T1, T2, glue_rel_lt> | |
| | | >::result | |
| operator< | | operator< | |
|
| (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co
nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) | | (const T1& X, const T2& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtGlue<uword, T1, T2, glue_rel_lt>( X.get_ref(), Y.get_ref() ); | | return mtGlue<uword, T1, T2, glue_rel_lt>( X, Y ); | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<uword, T1, T2, glue_rel_gt> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_complex<typena | |
| | | me T1::elem_type>::value == false) && (is_complex<typename T2::elem_type>:: | |
| | | value == false)), | |
| | | const mtGlue<uword, T1, T2, glue_rel_gt> | |
| | | >::result | |
| operator> | | operator> | |
|
| (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co
nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) | | (const T1& X, const T2& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtGlue<uword, T1, T2, glue_rel_gt>( X.get_ref(), Y.get_ref() ); | | return mtGlue<uword, T1, T2, glue_rel_gt>( X, Y ); | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<uword, T1, T2, glue_rel_lteq> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_complex<typena | |
| | | me T1::elem_type>::value == false) && (is_complex<typename T2::elem_type>:: | |
| | | value == false)), | |
| | | const mtGlue<uword, T1, T2, glue_rel_lteq> | |
| | | >::result | |
| operator<= | | operator<= | |
|
| (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co
nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) | | (const T1& X, const T2& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtGlue<uword, T1, T2, glue_rel_lteq>( X.get_ref(), Y.get_ref() ); | | return mtGlue<uword, T1, T2, glue_rel_lteq>( X, Y ); | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<uword, T1, T2, glue_rel_gteq> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_complex<typena | |
| | | me T1::elem_type>::value == false) && (is_complex<typename T2::elem_type>:: | |
| | | value == false)), | |
| | | const mtGlue<uword, T1, T2, glue_rel_gteq> | |
| | | >::result | |
| operator>= | | operator>= | |
|
| (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co
nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) | | (const T1& X, const T2& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtGlue<uword, T1, T2, glue_rel_gteq>( X.get_ref(), Y.get_ref() ); | | return mtGlue<uword, T1, T2, glue_rel_gteq>( X, Y ); | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<uword, T1, T2, glue_rel_eq> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value), | |
| | | const mtGlue<uword, T1, T2, glue_rel_eq> | |
| | | >::result | |
| operator== | | operator== | |
|
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | | (const T1& X, const T2& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtGlue<uword, T1, T2, glue_rel_eq>( X.get_ref(), Y.get_ref() ); | | return mtGlue<uword, T1, T2, glue_rel_eq>( X, Y ); | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<uword, T1, T2, glue_rel_noteq> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value), | |
| | | const mtGlue<uword, T1, T2, glue_rel_noteq> | |
| | | >::result | |
| operator!= | | operator!= | |
|
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | | (const T1& X, const T2& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtGlue<uword, T1, T2, glue_rel_noteq>( X.get_ref(), Y.get_ref() ); | | return mtGlue<uword, T1, T2, glue_rel_noteq>( X, Y ); | |
| } | | } | |
| | | | |
| // | | // | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_lt_pre> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value == | |
| | | false)), | |
| | | const mtOp<uword, T1, op_rel_lt_pre> | |
| | | >::result | |
| operator< | | operator< | |
|
| (const typename arma_not_cx<typename T1::elem_type>::result val, const Base
<typename arma_not_cx<typename T1::elem_type>::result,T1>& X) | | (const typename T1::elem_type val, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_lt_pre>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_lt_pre>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_lt_post> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value == | |
| | | false)), | |
| | | const mtOp<uword, T1, op_rel_lt_post> | |
| | | >::result | |
| operator< | | operator< | |
|
| (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co
nst typename arma_not_cx<typename T1::elem_type>::result val) | | (const T1& X, const typename T1::elem_type val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_lt_post>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_lt_post>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_gt_pre> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value == | |
| | | false)), | |
| | | const mtOp<uword, T1, op_rel_gt_pre> | |
| | | >::result | |
| operator> | | operator> | |
|
| (const typename arma_not_cx<typename T1::elem_type>::result val, const Base
<typename arma_not_cx<typename T1::elem_type>::result,T1>& X) | | (const typename T1::elem_type val, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_gt_pre>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_gt_pre>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_gt_post> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value == | |
| | | false)), | |
| | | const mtOp<uword, T1, op_rel_gt_post> | |
| | | >::result | |
| operator> | | operator> | |
|
| (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co
nst typename arma_not_cx<typename T1::elem_type>::result val) | | (const T1& X, const typename T1::elem_type val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_gt_post>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_gt_post>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_lteq_pre> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value == | |
| | | false)), | |
| | | const mtOp<uword, T1, op_rel_lteq_pre> | |
| | | >::result | |
| operator<= | | operator<= | |
|
| (const typename arma_not_cx<typename T1::elem_type>::result val, const Base
<typename arma_not_cx<typename T1::elem_type>::result,T1>& X) | | (const typename T1::elem_type val, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_lteq_pre>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_lteq_pre>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_lteq_post> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value == | |
| | | false)), | |
| | | const mtOp<uword, T1, op_rel_lteq_post> | |
| | | >::result | |
| operator<= | | operator<= | |
|
| (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co
nst typename arma_not_cx<typename T1::elem_type>::result val) | | (const T1& X, const typename T1::elem_type val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_lteq_post>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_lteq_post>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_gteq_pre> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value == | |
| | | false)), | |
| | | const mtOp<uword, T1, op_rel_gteq_pre> | |
| | | >::result | |
| operator>= | | operator>= | |
|
| (const typename arma_not_cx<typename T1::elem_type>::result val, const Base
<typename arma_not_cx<typename T1::elem_type>::result,T1>& X) | | (const typename T1::elem_type val, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_gteq_pre>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_gteq_pre>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_gteq_post> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value == | |
| | | false)), | |
| | | const mtOp<uword, T1, op_rel_gteq_post> | |
| | | >::result | |
| operator>= | | operator>= | |
|
| (const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co
nst typename arma_not_cx<typename T1::elem_type>::result val) | | (const T1& X, const typename T1::elem_type val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_gteq_post>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_gteq_post>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_eq> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | is_arma_type<T1>::value, | |
| | | const mtOp<uword, T1, op_rel_eq> | |
| | | >::result | |
| operator== | | operator== | |
|
| (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X
) | | (const typename T1::elem_type val, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_eq>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_eq>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_eq> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | is_arma_type<T1>::value, | |
| | | const mtOp<uword, T1, op_rel_eq> | |
| | | >::result | |
| operator== | | operator== | |
|
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val
) | | (const T1& X, const typename T1::elem_type val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_eq>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_eq>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_noteq> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | is_arma_type<T1>::value, | |
| | | const mtOp<uword, T1, op_rel_noteq> | |
| | | >::result | |
| operator!= | | operator!= | |
|
| (const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X
) | | (const typename T1::elem_type val, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_noteq>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_noteq>(X, val); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| const mtOp<uword, T1, op_rel_noteq> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | is_arma_type<T1>::value, | |
| | | const mtOp<uword, T1, op_rel_noteq> | |
| | | >::result | |
| operator!= | | operator!= | |
|
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val
) | | (const T1& X, const typename T1::elem_type val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<uword, T1, op_rel_noteq>(X.get_ref(), val); | | return mtOp<uword, T1, op_rel_noteq>(X, val); | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 55 change blocks. |
| 56 lines changed or deleted | | 162 lines changed or added | |
|
| operator_schur.hpp | | operator_schur.hpp | |
|
| // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2010 Conrad Sanderson | | // Copyright (C) 2008-2012 Conrad Sanderson | |
| // | | // | |
| // This file is part of the Armadillo C++ library. | | // This file is part of the Armadillo C++ library. | |
| // It is provided without any warranty of fitness | | // It is provided without any warranty of fitness | |
| // 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 operator_schur | | //! \addtogroup operator_schur | |
| //! @{ | | //! @{ | |
| | | | |
| // operator %, which we define it to do a schur product (element-wise multi
plication) | | // operator %, which we define it to do a schur product (element-wise multi
plication) | |
| | | | |
|
| //! element-wise multiplication of Base objects with same element type | | //! element-wise multiplication of user-accessible Armadillo objects with s
ame element type | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
|
| const eGlue<T1, T2, eglue_schur> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena | |
| | | me T1::elem_type, typename T2::elem_type>::value, | |
| | | const eGlue<T1, T2, eglue_schur> | |
| | | >::result | |
| operator% | | operator% | |
| ( | | ( | |
|
| const Base<typename T1::elem_type,T1>& X, | | const T1& X, | |
| const Base<typename T1::elem_type,T2>& Y | | const T2& Y | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eGlue<T1, T2, eglue_schur>(X.get_ref(), Y.get_ref()); | | return eGlue<T1, T2, eglue_schur>(X, Y); | |
| } | | } | |
| | | | |
|
| //! element-wise multiplication of Base objects with different element type
s | | //! element-wise multiplication of user-accessible Armadillo objects with d
ifferent element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele | | typename | |
| m_type>::result, T1, T2, glue_mixed_schur> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type | |
| | | name T1::elem_type, typename T2::elem_type>::value == false)), | |
| | | const mtGlue<typename promote_type<typename T1::elem_type, typename T2::e | |
| | | lem_type>::result, T1, T2, glue_mixed_schur> | |
| | | >::result | |
| operator% | | operator% | |
| ( | | ( | |
|
| const Base< typename force_different_type<typename T1::elem_type, typenam | | const T1& X, | |
| e T2::elem_type>::T1_result, T1>& X, | | const T2& Y | |
| const Base< typename force_different_type<typename T1::elem_type, typenam | | | |
| e T2::elem_type>::T2_result, T2>& Y | | | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| 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 promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| return mtGlue<out_eT, T1, T2, glue_mixed_schur>( X.get_ref(), Y.get_ref()
); | | return mtGlue<out_eT, T1, T2, glue_mixed_schur>( X, Y ); | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 9 change blocks. |
| 15 lines changed or deleted | | 25 lines changed or added | |
|
| operator_times.hpp | | operator_times.hpp | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| // 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 operator_times | | //! \addtogroup operator_times | |
| //! @{ | | //! @{ | |
| | | | |
| //! Base * scalar | | //! Base * scalar | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_scalar_times> | | typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_time
s> >::result | |
| operator* | | operator* | |
|
| (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type k) | | (const T1& X, const typename T1::elem_type k) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1, eop_scalar_times>(X.get_ref(),k); | | return eOp<T1, eop_scalar_times>(X,k); | |
| } | | } | |
| | | | |
| //! scalar * Base | | //! scalar * Base | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const eOp<T1, eop_scalar_times> | | typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_time
s> >::result | |
| operator* | | operator* | |
|
| (const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X) | | (const typename T1::elem_type k, const T1& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return eOp<T1, eop_scalar_times>(X.get_ref(),k); // NOTE: order is swapp
ed | | return eOp<T1, eop_scalar_times>(X,k); // NOTE: order is swapped | |
| } | | } | |
| | | | |
|
| //! non-complex Base * complex scalar (experimental) | | //! non-complex Base * complex scalar | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_t | | typename | |
| imes> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value == | |
| | | false), | |
| | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar | |
| | | _times> | |
| | | >::result | |
| operator* | | operator* | |
| ( | | ( | |
|
| const Base<typename T1::pod_type, T1>& X, | | const T1& X, | |
| const std::complex<typename T1::pod_type>& k | | const std::complex<typename T1::pod_type>& k | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_times>('j', X.get_ref(), k); | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_times>('j', X, k); | |
| } | | } | |
| | | | |
|
| //! complex scalar * non-complex Base (experimental) | | //! complex scalar * non-complex Base | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
|
| const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_t | | typename | |
| imes> | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value == | |
| | | false), | |
| | | const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar | |
| | | _times> | |
| | | >::result | |
| operator* | | operator* | |
| ( | | ( | |
| const std::complex<typename T1::pod_type>& k, | | const std::complex<typename T1::pod_type>& k, | |
|
| const Base<typename T1::pod_type, T1>& X | | const T1& X | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_times>('j', X.get_ref(), k); | | return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala
r_times>('j', X, k); | |
| } | | } | |
| | | | |
| //! scalar * trans(T1) | | //! scalar * trans(T1) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const Op<T1, op_htrans2> | | const Op<T1, op_htrans2> | |
| operator* | | operator* | |
| (const typename T1::elem_type k, const Op<T1, op_htrans>& X) | | (const typename T1::elem_type k, const Op<T1, op_htrans>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 107 | |
| (const Op<T1, op_htrans>& X, const typename T1::elem_type k) | | (const Op<T1, op_htrans>& X, const typename T1::elem_type k) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| return Op<T1, op_htrans2>(X.m, k); | | return Op<T1, op_htrans2>(X.m, k); | |
| } | | } | |
| | | | |
| //! Base * diagmat | | //! Base * diagmat | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
|
| const Glue<T1, Op<T2, op_diagmat>, glue_times_diag> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_same_type<typename T1::elem_type, typename | |
| | | T2::elem_type>::value), | |
| | | const Glue<T1, Op<T2, op_diagmat>, glue_times_diag> | |
| | | >::result | |
| operator* | | operator* | |
|
| (const Base<typename T2::elem_type,T1>& X, const Op<T2, op_diagmat>& Y) | | (const T1& X, const Op<T2, op_diagmat>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return Glue<T1, Op<T2, op_diagmat>, glue_times_diag>(X.get_ref(), Y); | | return Glue<T1, Op<T2, op_diagmat>, glue_times_diag>(X, Y); | |
| } | | } | |
| | | | |
| //! diagmat * Base | | //! diagmat * Base | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
|
| const Glue<Op<T1, op_diagmat>, T2, glue_times_diag> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T2>::value && is_same_type<typename T1::elem_type, typename | |
| | | T2::elem_type>::value), | |
| | | const Glue<Op<T1, op_diagmat>, T2, glue_times_diag> | |
| | | >::result | |
| operator* | | operator* | |
|
| (const Op<T1, op_diagmat>& X, const Base<typename T1::elem_type,T2>& Y) | | (const Op<T1, op_diagmat>& X, const T2& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return Glue<Op<T1, op_diagmat>, T2, glue_times_diag>(X, Y.get_ref()); | | return Glue<Op<T1, op_diagmat>, T2, glue_times_diag>(X, Y); | |
| } | | } | |
| | | | |
| //! diagmat * diagmat | | //! diagmat * diagmat | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
| Mat< typename promote_type<typename T1::elem_type, typename T2::elem_type>:
:result > | | Mat< typename promote_type<typename T1::elem_type, typename T2::elem_type>:
:result > | |
| operator* | | operator* | |
| (const Op<T1, op_diagmat>& X, const Op<T2, op_diagmat>& Y) | | (const Op<T1, op_diagmat>& X, const Op<T2, op_diagmat>& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 156 | | skipping to change at line 176 | |
| { | | { | |
| out.at(i,i) = upgrade_val<eT1,eT2>::apply( A[i] ) * upgrade_val<eT1,eT2
>::apply( B[i] ); | | out.at(i,i) = upgrade_val<eT1,eT2>::apply( A[i] ) * upgrade_val<eT1,eT2
>::apply( B[i] ); | |
| } | | } | |
| | | | |
| return out; | | return out; | |
| } | | } | |
| | | | |
| //! multiplication of Base objects with same element type | | //! multiplication of Base objects with same element type | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| arma_inline | | arma_inline | |
|
| const Glue<T1, T2, glue_times> | | typename | |
| | | enable_if2 | |
| | | < | |
| | | is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena | |
| | | me T1::elem_type, typename T2::elem_type>::value, | |
| | | const Glue<T1, T2, glue_times> | |
| | | >::result | |
| operator* | | operator* | |
|
| (const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ
e,T2>& Y) | | (const T1& X, const T2& Y) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return Glue<T1, T2, glue_times>(X.get_ref(), Y.get_ref()); | | return Glue<T1, T2, glue_times>(X, Y); | |
| } | | } | |
| | | | |
| //! multiplication of Base objects with different element types | | //! multiplication of Base objects with different element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
|
| const mtGlue< typename promote_type<typename T1::elem_type, typename T2::el | | typename | |
| em_type>::result, T1, T2, glue_mixed_times > | | enable_if2 | |
| | | < | |
| | | (is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type | |
| | | name T1::elem_type, typename T2::elem_type>::value == false)), | |
| | | const mtGlue< typename promote_type<typename T1::elem_type, typename T2:: | |
| | | elem_type>::result, T1, T2, glue_mixed_times > | |
| | | >::result | |
| operator* | | operator* | |
| ( | | ( | |
|
| const Base< typename force_different_type<typename T1::elem_type, typenam | | const T1& X, | |
| e T2::elem_type>::T1_result, T1>& X, | | const T2& Y | |
| const Base< typename force_different_type<typename T1::elem_type, typenam | | | |
| e T2::elem_type>::T2_result, T2>& Y | | | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| 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 promote_type<eT1,eT2>::result out_eT; | | typedef typename promote_type<eT1,eT2>::result out_eT; | |
| | | | |
| promote_type<eT1,eT2>::check(); | | promote_type<eT1,eT2>::check(); | |
| | | | |
|
| return mtGlue<out_eT, T1, T2, glue_mixed_times>( X.get_ref(), Y.get_ref()
); | | return mtGlue<out_eT, T1, T2, glue_mixed_times>( X, Y ); | |
| } | | } | |
| | | | |
|
| // | | | |
| // | | | |
| // | | | |
| | | | |
| #undef armaObj | | | |
| #undef armaObjA | | | |
| #undef armaObjB | | | |
| | | | |
| // TODO: add handling of scalar*trans(object) | | | |
| // TODO: add handling of trans(object)*scalar | | | |
| | | | |
| #undef arma_operator_obj_scalar | | | |
| #undef arma_operator_scalar_obj | | | |
| #undef arma_operator_obj_cx_scalar | | | |
| #undef arma_operator_cx_scalar_obj | | | |
| #undef arma_operator_obj_base | | | |
| #undef arma_operator_base_obj | | | |
| #undef arma_operator_obj_diagmat | | | |
| #undef arma_operator_diagmat_obj | | | |
| #undef arma_operator_obj1_obj2 | | | |
| #undef arma_operator_obj1_obj2_mixed | | | |
| | | | |
| #define arma_operator_obj_scalar(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_scalar_times> \ | | | |
| operator* \ | | | |
| (const armaObj<eT>& X, const typename armaObj<eT>::elem_type k) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>, eop_scalar_times>(X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_scalar_obj(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const eOp<armaObj<eT>, eop_scalar_times> \ | | | |
| operator* \ | | | |
| (const typename armaObj<eT>::elem_type k, const armaObj<eT>& X) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return eOp<armaObj<eT>, eop_scalar_times>(X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_cx_scalar(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e | | | |
| T>, op_cx_scalar_times> \ | | | |
| operator* \ | | | |
| ( \ | | | |
| const armaObj<eT>& X, \ | | | |
| const std::complex<typename armaObj<eT>::pod_type>& k \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb | | | |
| j<eT>, op_cx_scalar_times>('j', X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_cx_scalar_obj(armaObj) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e | | | |
| T>, op_cx_scalar_times> \ | | | |
| operator* \ | | | |
| ( \ | | | |
| const std::complex<typename armaObj<eT>::pod_type>& k, \ | | | |
| const armaObj<eT>& X \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb | | | |
| j<eT>, op_cx_scalar_times>('j', X, k); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_base(armaObj) \ | | | |
| template<typename BT> \ | | | |
| arma_inline \ | | | |
| const Glue<armaObj<typename BT::elem_type>, BT, glue_times> \ | | | |
| operator* \ | | | |
| ( \ | | | |
| const armaObj<typename BT::elem_type>& X, \ | | | |
| const Base<typename BT::elem_type, BT>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return Glue<armaObj<typename BT::elem_type>, BT, glue_times>(X, Y.get_ref | | | |
| ()); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_base_obj(armaObj) \ | | | |
| template<typename BT> \ | | | |
| arma_inline \ | | | |
| const Glue<BT, armaObj<typename BT::elem_type>, glue_times> \ | | | |
| operator* \ | | | |
| ( \ | | | |
| const Base<typename BT::elem_type, BT>& X, \ | | | |
| const armaObj<typename BT::elem_type> & Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return Glue<BT, armaObj<typename BT::elem_type>, glue_times>(X.get_ref(), | | | |
| Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj_diagmat(armaObj) \ | | | |
| template<typename T1> \ | | | |
| arma_inline \ | | | |
| const Glue< armaObj<typename T1::elem_type>, Op<T1, op_diagmat>, glue_times | | | |
| _diag > \ | | | |
| operator* \ | | | |
| ( \ | | | |
| const armaObj<typename T1::elem_type>& X, \ | | | |
| const Op<T1, op_diagmat>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return Glue< armaObj<typename T1::elem_type>, Op<T1, op_diagmat>, glue_ti | | | |
| mes_diag >(X, Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_diagmat_obj(armaObj) \ | | | |
| template<typename T1> \ | | | |
| arma_inline \ | | | |
| const Glue< Op<T1, op_diagmat>, armaObj<typename T1::elem_type>, glue_times | | | |
| _diag > \ | | | |
| operator* \ | | | |
| ( \ | | | |
| const Op<T1, op_diagmat>& X, \ | | | |
| const armaObj<typename T1::elem_type>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return Glue< Op<T1, op_diagmat>, armaObj<typename T1::elem_type>, glue_ti | | | |
| mes_diag >(X, Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj1_obj2(armaObjA, armaObjB) \ | | | |
| template<typename eT> \ | | | |
| arma_inline \ | | | |
| const Glue<armaObjA<eT>, armaObjB<eT>, glue_times> \ | | | |
| operator* \ | | | |
| ( \ | | | |
| const armaObjA<eT>& X, \ | | | |
| const armaObjB<eT>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| return Glue<armaObjA<eT>, armaObjB<eT>, glue_times>(X, Y); \ | | | |
| } | | | |
| | | | |
| #define arma_operator_obj1_obj2_mixed(armaObjA, armaObjB) \ | | | |
| template<typename eT1, typename eT2> \ | | | |
| inline \ | | | |
| const mtGlue<typename promote_type<eT1, eT2>::result, armaObjA<eT1>, armaOb | | | |
| jB<eT2>, glue_mixed_times> \ | | | |
| operator* \ | | | |
| ( \ | | | |
| const armaObjA<eT1>& X, \ | | | |
| const armaObjB<eT2>& Y \ | | | |
| ) \ | | | |
| { \ | | | |
| arma_extra_debug_sigprint(); \ | | | |
| \ | | | |
| typedef typename promote_type<eT1,eT2>::result out_eT; \ | | | |
| \ | | | |
| promote_type<eT1,eT2>::check(); \ | | | |
| \ | | | |
| return mtGlue<out_eT, armaObjA<eT1>, armaObjB<eT2>, glue_mixed_times>( X, | | | |
| Y ); \ | | | |
| } | | | |
| | | | |
| arma_operator_obj_scalar(Col) | | | |
| arma_operator_obj_scalar(Row) | | | |
| arma_operator_obj_scalar(diagview) | | | |
| arma_operator_obj_scalar(subview_col) | | | |
| arma_operator_obj_scalar(subview_row) | | | |
| | | | |
| arma_operator_scalar_obj(Col) | | | |
| arma_operator_scalar_obj(Row) | | | |
| arma_operator_scalar_obj(diagview) | | | |
| arma_operator_scalar_obj(subview_col) | | | |
| arma_operator_scalar_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_cx_scalar(Col) | | | |
| arma_operator_obj_cx_scalar(Row) | | | |
| arma_operator_obj_cx_scalar(diagview) | | | |
| arma_operator_obj_cx_scalar(subview_col) | | | |
| arma_operator_obj_cx_scalar(subview_row) | | | |
| | | | |
| arma_operator_cx_scalar_obj(Col) | | | |
| arma_operator_cx_scalar_obj(Row) | | | |
| arma_operator_cx_scalar_obj(diagview) | | | |
| arma_operator_cx_scalar_obj(subview_col) | | | |
| arma_operator_cx_scalar_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_base(Col) | | | |
| arma_operator_obj_base(Row) | | | |
| arma_operator_obj_base(diagview) | | | |
| arma_operator_obj_base(subview_col) | | | |
| arma_operator_obj_base(subview_row) | | | |
| | | | |
| arma_operator_base_obj(Col) | | | |
| arma_operator_base_obj(Row) | | | |
| arma_operator_base_obj(diagview) | | | |
| arma_operator_base_obj(subview_col) | | | |
| arma_operator_base_obj(subview_row) | | | |
| | | | |
| arma_operator_obj_diagmat(Col) | | | |
| arma_operator_obj_diagmat(Row) | | | |
| arma_operator_obj_diagmat(diagview) | | | |
| arma_operator_obj_diagmat(subview_col) | | | |
| arma_operator_obj_diagmat(subview_row) | | | |
| | | | |
| arma_operator_diagmat_obj(Col) | | | |
| arma_operator_diagmat_obj(Row) | | | |
| arma_operator_diagmat_obj(diagview) | | | |
| arma_operator_diagmat_obj(subview_col) | | | |
| arma_operator_diagmat_obj(subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(Col,Col) | | | |
| arma_operator_obj1_obj2(Col,Row) | | | |
| arma_operator_obj1_obj2(Col,diagview) | | | |
| arma_operator_obj1_obj2(Col,subview_col) | | | |
| arma_operator_obj1_obj2(Col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(Row,Col) | | | |
| arma_operator_obj1_obj2(Row,Row) | | | |
| arma_operator_obj1_obj2(Row,diagview) | | | |
| arma_operator_obj1_obj2(Row,subview_col) | | | |
| arma_operator_obj1_obj2(Row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(diagview,Col) | | | |
| arma_operator_obj1_obj2(diagview,Row) | | | |
| arma_operator_obj1_obj2(diagview,diagview) | | | |
| arma_operator_obj1_obj2(diagview,subview_col) | | | |
| arma_operator_obj1_obj2(diagview,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(subview_col,Col) | | | |
| arma_operator_obj1_obj2(subview_col,Row) | | | |
| arma_operator_obj1_obj2(subview_col,diagview) | | | |
| arma_operator_obj1_obj2(subview_col,subview_col) | | | |
| arma_operator_obj1_obj2(subview_col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2(subview_row,Col) | | | |
| arma_operator_obj1_obj2(subview_row,Row) | | | |
| arma_operator_obj1_obj2(subview_row,diagview) | | | |
| arma_operator_obj1_obj2(subview_row,subview_col) | | | |
| arma_operator_obj1_obj2(subview_row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(Col,Col) | | | |
| arma_operator_obj1_obj2_mixed(Col,Row) | | | |
| arma_operator_obj1_obj2_mixed(Col,diagview) | | | |
| arma_operator_obj1_obj2_mixed(Col,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(Col,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(Row,Col) | | | |
| arma_operator_obj1_obj2_mixed(Row,Row) | | | |
| arma_operator_obj1_obj2_mixed(Row,diagview) | | | |
| arma_operator_obj1_obj2_mixed(Row,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(Row,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(diagview,Col) | | | |
| arma_operator_obj1_obj2_mixed(diagview,Row) | | | |
| arma_operator_obj1_obj2_mixed(diagview,diagview) | | | |
| arma_operator_obj1_obj2_mixed(diagview,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(diagview,subview_row) | | | |
| | | | |
| arma_operator_obj1_obj2_mixed(subview_col,Col) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,Row) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,diagview) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(subview_col,subview_row) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,Col) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,Row) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,diagview) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,subview_col) | | | |
| arma_operator_obj1_obj2_mixed(subview_row,subview_row) | | | |
| | | | |
| // TODO: explicit handling of subview_elem1, perhaps via expanding the abov | | | |
| e macros to take another paramater (for template<T1>) | | | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 27 change blocks. |
| 324 lines changed or deleted | | 66 lines changed or added | |
|
| subview_bones.hpp | | subview_bones.hpp | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 89 | |
| | | | |
| inline eT& operator()(const uword i); | | inline eT& operator()(const uword i); | |
| inline eT operator()(const uword i) const; | | inline eT operator()(const uword i) const; | |
| | | | |
| inline eT& operator()(const uword in_row, const uword in_col); | | inline eT& operator()(const uword in_row, const uword in_col); | |
| inline eT operator()(const uword in_row, const uword in_col) const; | | inline eT operator()(const uword in_row, const uword in_col) const; | |
| | | | |
| inline eT& at(const uword in_row, const uword in_col); | | inline eT& at(const uword in_row, const uword in_col); | |
| inline eT at(const uword in_row, const uword in_col) const; | | inline eT at(const uword in_row, const uword in_col) const; | |
| | | | |
|
| | | inline eT& at_slow(const uword in_row, const uword in_col); | |
| | | inline eT at_slow(const uword in_row, const uword in_col) const; | |
| | | | |
| arma_inline eT* colptr(const uword in_col); | | arma_inline eT* colptr(const uword in_col); | |
| arma_inline const eT* colptr(const uword in_col) const; | | arma_inline const eT* colptr(const uword in_col) const; | |
| | | | |
| inline bool check_overlap(const subview& x) const; | | inline bool check_overlap(const subview& x) const; | |
| | | | |
| inline bool is_vec() const; | | inline bool is_vec() const; | |
| | | | |
| inline subview_row<eT> row(const uword row_num); | | inline subview_row<eT> row(const uword row_num); | |
| inline const subview_row<eT> row(const uword row_num) const; | | inline const subview_row<eT> row(const uword row_num) const; | |
| | | | |
| | | | |
| skipping to change at line 176 | | skipping to change at line 179 | |
| class subview_col : public subview<eT> | | class subview_col : public 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; | |
| | | | |
| static const bool is_row = false; | | static const bool is_row = false; | |
| static const bool is_col = true; | | static const bool is_col = true; | |
| | | | |
|
| | | const eT* colmem; | |
| | | | |
| inline void operator= (const subview<eT>& x); | | inline void operator= (const subview<eT>& x); | |
| inline void operator= (const subview_col& x); | | inline void operator= (const subview_col& x); | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline void operator= (const Base<eT,T1>& x); | | inline void operator= (const Base<eT,T1>& x); | |
| | | | |
| arma_inline const Op<subview_col<eT>,op_htrans> t() const; | | arma_inline const Op<subview_col<eT>,op_htrans> t() const; | |
| arma_inline const Op<subview_col<eT>,op_htrans> ht() const; | | arma_inline const Op<subview_col<eT>,op_htrans> ht() const; | |
| arma_inline const Op<subview_col<eT>,op_strans> st() const; | | arma_inline const Op<subview_col<eT>,op_strans> st() const; | |
| | | | |
|
| | | inline eT& operator[](const uword i); | |
| | | inline eT operator[](const uword i) const; | |
| | | | |
| | | inline eT& operator()(const uword i); | |
| | | inline eT operator()(const uword i) const; | |
| | | | |
| | | inline eT& operator()(const uword in_row, const uword in_col); | |
| | | inline eT operator()(const uword in_row, const uword in_col) const; | |
| | | | |
| | | inline eT& at(const uword in_row, const uword in_col); | |
| | | inline eT at(const uword in_row, const uword in_col) const; | |
| | | | |
| | | arma_inline eT* colptr(const uword in_col); | |
| | | arma_inline const eT* colptr(const uword in_col) const; | |
| | | | |
| inline subview_col<eT> rows(const uword in_row1, const uword in_row
2); | | inline subview_col<eT> rows(const uword in_row1, const uword in_row
2); | |
| inline const subview_col<eT> rows(const uword in_row1, const uword in_row
2) const; | | inline const subview_col<eT> rows(const uword in_row1, const uword in_row
2) const; | |
| | | | |
| inline subview_col<eT> subvec(const uword in_row1, const uword in_r
ow2); | | inline subview_col<eT> subvec(const uword in_row1, const uword in_r
ow2); | |
| inline const subview_col<eT> subvec(const uword in_row1, const uword in_r
ow2) const; | | inline const subview_col<eT> subvec(const uword in_row1, const uword in_r
ow2) const; | |
| | | | |
| protected: | | protected: | |
| | | | |
| inline subview_col(const Mat<eT>& in_m, const uword in_col); | | inline subview_col(const Mat<eT>& in_m, const uword in_col); | |
| inline subview_col(const Mat<eT>& in_m, const uword in_col, const uword i
n_row1, const uword in_n_rows); | | inline subview_col(const Mat<eT>& in_m, const uword in_col, const uword i
n_row1, const uword in_n_rows); | |
| | | | |
| skipping to change at line 227 | | skipping to change at line 247 | |
| inline void operator= (const subview<eT>& x); | | inline void operator= (const subview<eT>& x); | |
| inline void operator= (const subview_row& x); | | inline void operator= (const subview_row& x); | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline void operator= (const Base<eT,T1>& x); | | inline void operator= (const Base<eT,T1>& x); | |
| | | | |
| arma_inline const Op<subview_row<eT>,op_htrans> t() const; | | arma_inline const Op<subview_row<eT>,op_htrans> t() const; | |
| arma_inline const Op<subview_row<eT>,op_htrans> ht() const; | | arma_inline const Op<subview_row<eT>,op_htrans> ht() const; | |
| arma_inline const Op<subview_row<eT>,op_strans> st() const; | | arma_inline const Op<subview_row<eT>,op_strans> st() const; | |
| | | | |
|
| | | inline eT& operator[](const uword i); | |
| | | inline eT operator[](const uword i) const; | |
| | | | |
| | | inline eT& operator()(const uword i); | |
| | | inline eT operator()(const uword i) const; | |
| | | | |
| | | inline eT& operator()(const uword in_row, const uword in_col); | |
| | | inline eT operator()(const uword in_row, const uword in_col) const; | |
| | | | |
| | | inline eT& at(const uword in_row, const uword in_col); | |
| | | inline eT at(const uword in_row, const uword in_col) const; | |
| | | | |
| inline subview_row<eT> cols(const uword in_col1, const uword in_col
2); | | inline subview_row<eT> cols(const uword in_col1, const uword in_col
2); | |
| inline const subview_row<eT> cols(const uword in_col1, const uword in_col
2) const; | | inline const subview_row<eT> cols(const uword in_col1, const uword in_col
2) const; | |
| | | | |
| inline subview_row<eT> subvec(const uword in_col1, const uword in_c
ol2); | | inline subview_row<eT> subvec(const uword in_col1, const uword in_c
ol2); | |
| inline const subview_row<eT> subvec(const uword in_col1, const uword in_c
ol2) const; | | inline const subview_row<eT> subvec(const uword in_col1, const uword in_c
ol2) const; | |
| | | | |
| protected: | | protected: | |
| | | | |
| inline subview_row(const Mat<eT>& in_m, const uword in_row); | | inline subview_row(const Mat<eT>& in_m, const uword in_row); | |
| inline subview_row(const Mat<eT>& in_m, const uword in_row, const uword i
n_col1, const uword in_n_cols); | | inline subview_row(const Mat<eT>& in_m, const uword in_row, const uword i
n_col1, const uword in_n_cols); | |
| | | | |
End of changes. 4 change blocks. |
| 0 lines changed or deleted | | 32 lines changed or added | |
|
| subview_meat.hpp | | subview_meat.hpp | |
| | | | |
| skipping to change at line 247 | | skipping to change at line 247 | |
| A.at(row, start_col+j) = x_mem[j]; | | A.at(row, start_col+j) = x_mem[j]; | |
| } | | } | |
| | | | |
| if(i < t_n_cols) | | if(i < t_n_cols) | |
| { | | { | |
| A.at(row, start_col+i) = x_mem[i]; | | A.at(row, start_col+i) = x_mem[i]; | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<t_n_cols; ++col) | | for(uword col=0; col < t_n_cols; ++col) | |
| { | | { | |
| arrayops::copy( t.colptr(col), x.colptr(col), t_n_rows ); | | arrayops::copy( t.colptr(col), x.colptr(col), t_n_rows ); | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| Mat<eT>& A = const_cast< Mat<eT>& >(m); | | Mat<eT>& A = const_cast< Mat<eT>& >(m); | |
| | | | |
| skipping to change at line 353 | | skipping to change at line 353 | |
| A.at(row, start_col+j) += x_mem[j]; | | A.at(row, start_col+j) += x_mem[j]; | |
| } | | } | |
| | | | |
| if(i < t_n_cols) | | if(i < t_n_cols) | |
| { | | { | |
| A.at(row, start_col+i) += x_mem[i]; | | A.at(row, start_col+i) += x_mem[i]; | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<t_n_cols; ++col) | | for(uword col=0; col < t_n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_plus( t.colptr(col), x.colptr(col), t_n_rows ); | | arrayops::inplace_plus( t.colptr(col), x.colptr(col), t_n_rows ); | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| Mat<eT>& A = const_cast< Mat<eT>& >(m); | | Mat<eT>& A = const_cast< Mat<eT>& >(m); | |
| | | | |
| skipping to change at line 457 | | skipping to change at line 457 | |
| A.at(row, start_col+j) -= x_mem[j]; | | A.at(row, start_col+j) -= x_mem[j]; | |
| } | | } | |
| | | | |
| if(i < t_n_cols) | | if(i < t_n_cols) | |
| { | | { | |
| A.at(row, start_col+i) -= x_mem[i]; | | A.at(row, start_col+i) -= x_mem[i]; | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<t_n_cols; ++col) | | for(uword col=0; col < t_n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_minus( t.colptr(col), x.colptr(col), t_n_rows ); | | arrayops::inplace_minus( t.colptr(col), x.colptr(col), t_n_rows ); | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| Mat<eT>& A = const_cast< Mat<eT>& >(m); | | Mat<eT>& A = const_cast< Mat<eT>& >(m); | |
| | | | |
| skipping to change at line 563 | | skipping to change at line 563 | |
| A.at(row, start_col+j) *= x_mem[j]; | | A.at(row, start_col+j) *= x_mem[j]; | |
| } | | } | |
| | | | |
| if(i < t_n_cols) | | if(i < t_n_cols) | |
| { | | { | |
| A.at(row, start_col+i) *= x_mem[i]; | | A.at(row, start_col+i) *= x_mem[i]; | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<t_n_cols; ++col) | | for(uword col=0; col < t_n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_mul( t.colptr(col), x.colptr(col), t_n_rows ); | | arrayops::inplace_mul( t.colptr(col), x.colptr(col), t_n_rows ); | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| Mat<eT>& A = const_cast< Mat<eT>& >(m); | | Mat<eT>& A = const_cast< Mat<eT>& >(m); | |
| | | | |
| skipping to change at line 669 | | skipping to change at line 669 | |
| A.at(row, start_col+j) /= x_mem[j]; | | A.at(row, start_col+j) /= x_mem[j]; | |
| } | | } | |
| | | | |
| if(i < t_n_cols) | | if(i < t_n_cols) | |
| { | | { | |
| A.at(row, start_col+i) /= x_mem[i]; | | A.at(row, start_col+i) /= x_mem[i]; | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<t_n_cols; ++col) | | for(uword col=0; col < t_n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_div( t.colptr(col), x.colptr(col), t_n_rows ); | | arrayops::inplace_div( t.colptr(col), x.colptr(col), t_n_rows ); | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(t_n_rows == 1) | | if(t_n_rows == 1) | |
| { | | { | |
| Mat<eT>& A = const_cast< Mat<eT>& >(m); | | Mat<eT>& A = const_cast< Mat<eT>& >(m); | |
| | | | |
| skipping to change at line 1072 | | skipping to change at line 1072 | |
| X.at(row, j) = val; | | X.at(row, j) = val; | |
| } | | } | |
| | | | |
| if(i < end_col_plus1) | | if(i < end_col_plus1) | |
| { | | { | |
| X.at(row, i) = val; | | X.at(row, i) = val; | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<local_n_cols; ++col) | | for(uword col=0; col < local_n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_set( colptr(col), val, local_n_rows ); | | arrayops::inplace_set( colptr(col), val, local_n_rows ); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::zeros() | | subview<eT>::zeros() | |
| | | | |
| skipping to change at line 1168 | | skipping to change at line 1168 | |
| inline | | inline | |
| eT | | eT | |
| subview<eT>::operator()(const uword i) const | | subview<eT>::operator()(const uword i) const | |
| { | | { | |
| arma_debug_check( (i >= n_elem), "subview::operator(): index out of bound
s"); | | arma_debug_check( (i >= n_elem), "subview::operator(): index out of bound
s"); | |
| | | | |
| const uword in_col = i / n_rows; | | const uword in_col = i / n_rows; | |
| const uword in_row = i % n_rows; | | const uword in_row = i % n_rows; | |
| | | | |
| const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; | | const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; | |
|
| | | | |
| return m.mem[index]; | | return m.mem[index]; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| eT& | | eT& | |
| subview<eT>::operator()(const uword in_row, const uword in_col) | | subview<eT>::operator()(const uword in_row, const uword in_col) | |
| { | | { | |
| arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "subview::o
perator(): index out of bounds"); | | arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "subview::o
perator(): index out of bounds"); | |
| | | | |
| | | | |
| skipping to change at line 1211 | | skipping to change at line 1212 | |
| | | | |
| return access::rw( (const_cast< Mat<eT>& >(m)).mem[index] ); | | return access::rw( (const_cast< Mat<eT>& >(m)).mem[index] ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| eT | | eT | |
| subview<eT>::at(const uword in_row, const uword in_col) const | | subview<eT>::at(const uword in_row, const uword in_col) const | |
| { | | { | |
| const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; | | const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; | |
|
| | | | |
| | | return m.mem[index]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT& | |
| | | subview<eT>::at_slow(const uword in_row, const uword in_col) | |
| | | { | |
| | | const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; | |
| | | | |
| | | return access::rw( (const_cast< Mat<eT>& >(m)).mem[index] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview<eT>::at_slow(const uword in_row, const uword in_col) const | |
| | | { | |
| | | const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; | |
| | | | |
| return m.mem[index]; | | return m.mem[index]; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| eT* | | eT* | |
| subview<eT>::colptr(const uword in_col) | | subview<eT>::colptr(const uword in_col) | |
| { | | { | |
| return & access::rw((const_cast< Mat<eT>& >(m)).mem[ (in_col + aux_col1)*
m.n_rows + aux_row1 ]); | | return & access::rw((const_cast< Mat<eT>& >(m)).mem[ (in_col + aux_col1)*
m.n_rows + aux_row1 ]); | |
| } | | } | |
| | | | |
| skipping to change at line 1334 | | skipping to change at line 1356 | |
| if(i < n_cols) | | if(i < n_cols) | |
| { | | { | |
| out_mem[i] = X.at(row, start_col+i); | | out_mem[i] = X.at(row, start_col+i); | |
| } | | } | |
| } | | } | |
| } | | } | |
| else // general submatrix | | else // general submatrix | |
| { | | { | |
| arma_extra_debug_print("subview::extract(): general submatrix"); | | arma_extra_debug_print("subview::extract(): general submatrix"); | |
| | | | |
|
| for(uword col = 0; col<n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| { | | { | |
| arrayops::copy( out.colptr(col), in.colptr(col), n_rows ); | | arrayops::copy( out.colptr(col), in.colptr(col), n_rows ); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| //! X += Y.submat(...) | | //! X += Y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| | | | |
| skipping to change at line 1380 | | skipping to change at line 1402 | |
| out_mem[j] += tmp2; | | out_mem[j] += tmp2; | |
| } | | } | |
| | | | |
| if(i < n_cols) | | if(i < n_cols) | |
| { | | { | |
| out_mem[i] += X.at(row, start_col+i); | | out_mem[i] += X.at(row, start_col+i); | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_plus(out.colptr(col), in.colptr(col), n_rows); | | arrayops::inplace_plus(out.colptr(col), in.colptr(col), n_rows); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| //! X -= Y.submat(...) | | //! X -= Y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| | | | |
| skipping to change at line 1426 | | skipping to change at line 1448 | |
| out_mem[j] -= tmp2; | | out_mem[j] -= tmp2; | |
| } | | } | |
| | | | |
| if(i < n_cols) | | if(i < n_cols) | |
| { | | { | |
| out_mem[i] -= X.at(row, start_col+i); | | out_mem[i] -= X.at(row, start_col+i); | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_minus(out.colptr(col), in.colptr(col), n_rows); | | arrayops::inplace_minus(out.colptr(col), in.colptr(col), n_rows); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| //! X %= Y.submat(...) | | //! X %= Y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| | | | |
| skipping to change at line 1472 | | skipping to change at line 1494 | |
| out_mem[j] *= tmp2; | | out_mem[j] *= tmp2; | |
| } | | } | |
| | | | |
| if(i < n_cols) | | if(i < n_cols) | |
| { | | { | |
| out_mem[i] *= X.at(row, start_col+i); | | out_mem[i] *= X.at(row, start_col+i); | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_mul(out.colptr(col), in.colptr(col), n_rows); | | arrayops::inplace_mul(out.colptr(col), in.colptr(col), n_rows); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| //! X /= Y.submat(...) | | //! X /= Y.submat(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| | | | |
| skipping to change at line 1518 | | skipping to change at line 1540 | |
| out_mem[j] /= tmp2; | | out_mem[j] /= tmp2; | |
| } | | } | |
| | | | |
| if(i < n_cols) | | if(i < n_cols) | |
| { | | { | |
| out_mem[i] /= X.at(row, start_col+i); | | out_mem[i] /= X.at(row, start_col+i); | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| for(uword col=0; col<n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| { | | { | |
| arrayops::inplace_div(out.colptr(col), in.colptr(col), n_rows); | | arrayops::inplace_div(out.colptr(col), in.colptr(col), n_rows); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| //! creation of subview (row vector) | | //! creation of subview (row vector) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| subview_row<eT> | | subview_row<eT> | |
| | | | |
| skipping to change at line 2127 | | skipping to change at line 2149 | |
| // } | | // } | |
| | | | |
| // | | // | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| subview_col<eT>::subview_col(const Mat<eT>& in_m, const uword in_col) | | subview_col<eT>::subview_col(const Mat<eT>& in_m, const uword in_col) | |
| : subview<eT>(in_m, 0, in_col, in_m.n_rows, 1) | | : subview<eT>(in_m, 0, in_col, in_m.n_rows, 1) | |
|
| | | , colmem(subview<eT>::colptr(0)) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| subview_col<eT>::subview_col(const Mat<eT>& in_m, const uword in_col, const
uword in_row1, const uword in_n_rows) | | subview_col<eT>::subview_col(const Mat<eT>& in_m, const uword in_col, const
uword in_row1, const uword in_n_rows) | |
| : subview<eT>(in_m, in_row1, in_col, in_n_rows, 1) | | : subview<eT>(in_m, in_row1, in_col, in_n_rows, 1) | |
|
| | | , colmem(subview<eT>::colptr(0)) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_col<eT>::operator=(const subview<eT>& X) | | subview_col<eT>::operator=(const subview<eT>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); | | subview<eT>::operator=(X); | |
|
| | | | |
| | | access::rw(colmem) = subview<eT>::colptr(0); | |
| | | | |
| arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible
dimensions" ); | | arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible
dimensions" ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_col<eT>::operator=(const subview_col<eT>& X) | | subview_col<eT>::operator=(const subview_col<eT>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); // interprets 'subview_col' as 'subview' | | subview<eT>::operator=(X); // interprets 'subview_col' as 'subview' | |
|
| | | | |
| | | access::rw(colmem) = subview<eT>::colptr(0); | |
| | | | |
| arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible
dimensions" ); | | arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible
dimensions" ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_col<eT>::operator=(const Base<eT,T1>& X) | | subview_col<eT>::operator=(const Base<eT,T1>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| subview<eT>::operator=(X); | | subview<eT>::operator=(X); | |
|
| | | | |
| | | access::rw(colmem) = subview<eT>::colptr(0); | |
| | | | |
| arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible
dimensions" ); | | arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible
dimensions" ); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const Op<subview_col<eT>,op_htrans> | | const Op<subview_col<eT>,op_htrans> | |
| subview_col<eT>::t() const | | subview_col<eT>::t() const | |
| { | | { | |
| return Op<subview_col<eT>,op_htrans>(*this); | | return Op<subview_col<eT>,op_htrans>(*this); | |
| } | | } | |
| | | | |
| skipping to change at line 2199 | | skipping to change at line 2232 | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const Op<subview_col<eT>,op_strans> | | const Op<subview_col<eT>,op_strans> | |
| subview_col<eT>::st() const | | subview_col<eT>::st() const | |
| { | | { | |
| return Op<subview_col<eT>,op_strans>(*this); | | return Op<subview_col<eT>,op_strans>(*this); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
|
| | | eT& | |
| | | subview_col<eT>::operator[](const uword i) | |
| | | { | |
| | | return access::rw( colmem[i] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview_col<eT>::operator[](const uword i) const | |
| | | { | |
| | | return colmem[i]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT& | |
| | | subview_col<eT>::operator()(const uword i) | |
| | | { | |
| | | arma_debug_check( (i >= subview<eT>::n_elem), "subview::operator(): index | |
| | | out of bounds"); | |
| | | | |
| | | return access::rw( colmem[i] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview_col<eT>::operator()(const uword i) const | |
| | | { | |
| | | arma_debug_check( (i >= subview<eT>::n_elem), "subview::operator(): index | |
| | | out of bounds"); | |
| | | | |
| | | return colmem[i]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT& | |
| | | subview_col<eT>::operator()(const uword in_row, const uword in_col) | |
| | | { | |
| | | arma_debug_check( ((in_row >= subview<eT>::n_rows) || (in_col > 0)), "sub | |
| | | view::operator(): index out of bounds"); | |
| | | | |
| | | return access::rw( colmem[in_row] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview_col<eT>::operator()(const uword in_row, const uword in_col) const | |
| | | { | |
| | | arma_debug_check( ((in_row >= subview<eT>::n_rows) || (in_col > 0)), "sub | |
| | | view::operator(): index out of bounds"); | |
| | | | |
| | | return colmem[in_row]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT& | |
| | | subview_col<eT>::at(const uword in_row, const uword) | |
| | | { | |
| | | return access::rw( colmem[in_row] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview_col<eT>::at(const uword in_row, const uword) const | |
| | | { | |
| | | return colmem[in_row]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | eT* | |
| | | subview_col<eT>::colptr(const uword) | |
| | | { | |
| | | return const_cast<eT*>(colmem); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | arma_inline | |
| | | const eT* | |
| | | subview_col<eT>::colptr(const uword) const | |
| | | { | |
| | | return colmem; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| subview_col<eT> | | subview_col<eT> | |
| subview_col<eT>::rows(const uword in_row1, const uword in_row2) | | subview_col<eT>::rows(const uword in_row1, const uword in_row2) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= subview<eT>::n_row
s) ), "subview_col::rows(): indices out of bounds or incorrectly used"); | | arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= subview<eT>::n_row
s) ), "subview_col::rows(): indices out of bounds or incorrectly used"); | |
| | | | |
| const uword subview_n_rows = in_row2 - in_row1 + 1; | | const uword subview_n_rows = in_row2 - in_row1 + 1; | |
| | | | |
| const uword base_row1 = this->aux_row1 + in_row1; | | const uword base_row1 = this->aux_row1 + in_row1; | |
| | | | |
| skipping to change at line 2341 | | skipping to change at line 2462 | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| const Op<subview_row<eT>,op_strans> | | const Op<subview_row<eT>,op_strans> | |
| subview_row<eT>::st() const | | subview_row<eT>::st() const | |
| { | | { | |
| return Op<subview_row<eT>,op_strans>(*this); | | return Op<subview_row<eT>,op_strans>(*this); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
|
| | | eT& | |
| | | subview_row<eT>::operator[](const uword i) | |
| | | { | |
| | | const uword index = (i + (subview<eT>::aux_col1))*(subview<eT>::m).n_rows | |
| | | + (subview<eT>::aux_row1); | |
| | | | |
| | | return access::rw( (const_cast< Mat<eT>& >(subview<eT>::m)).mem[index] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview_row<eT>::operator[](const uword i) const | |
| | | { | |
| | | const uword index = (i + (subview<eT>::aux_col1))*(subview<eT>::m).n_rows | |
| | | + (subview<eT>::aux_row1); | |
| | | | |
| | | return subview<eT>::m.mem[index]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT& | |
| | | subview_row<eT>::operator()(const uword i) | |
| | | { | |
| | | arma_debug_check( (i >= subview<eT>::n_elem), "subview::operator(): index | |
| | | out of bounds"); | |
| | | | |
| | | const uword index = (i + (subview<eT>::aux_col1))*(subview<eT>::m).n_rows | |
| | | + (subview<eT>::aux_row1); | |
| | | | |
| | | return access::rw( (const_cast< Mat<eT>& >(subview<eT>::m)).mem[index] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview_row<eT>::operator()(const uword i) const | |
| | | { | |
| | | arma_debug_check( (i >= subview<eT>::n_elem), "subview::operator(): index | |
| | | out of bounds"); | |
| | | | |
| | | const uword index = (i + (subview<eT>::aux_col1))*(subview<eT>::m).n_rows | |
| | | + (subview<eT>::aux_row1); | |
| | | | |
| | | return subview<eT>::m.mem[index]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT& | |
| | | subview_row<eT>::operator()(const uword in_row, const uword in_col) | |
| | | { | |
| | | arma_debug_check( ((in_row > 0) || (in_col >= subview<eT>::n_cols)), "sub | |
| | | view::operator(): index out of bounds"); | |
| | | | |
| | | const uword index = (in_col + (subview<eT>::aux_col1))*(subview<eT>::m).n | |
| | | _rows + (subview<eT>::aux_row1); | |
| | | | |
| | | return access::rw( (const_cast< Mat<eT>& >(subview<eT>::m)).mem[index] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview_row<eT>::operator()(const uword in_row, const uword in_col) const | |
| | | { | |
| | | arma_debug_check( ((in_row > 0) || (in_col >= subview<eT>::n_cols)), "sub | |
| | | view::operator(): index out of bounds"); | |
| | | | |
| | | const uword index = (in_col + (subview<eT>::aux_col1))*(subview<eT>::m).n | |
| | | _rows + (subview<eT>::aux_row1); | |
| | | | |
| | | return subview<eT>::m.mem[index]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT& | |
| | | subview_row<eT>::at(const uword, const uword in_col) | |
| | | { | |
| | | const uword index = (in_col + (subview<eT>::aux_col1))*(subview<eT>::m).n | |
| | | _rows + (subview<eT>::aux_row1); | |
| | | | |
| | | return access::rw( (const_cast< Mat<eT>& >(subview<eT>::m)).mem[index] ); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | eT | |
| | | subview_row<eT>::at(const uword, const uword in_col) const | |
| | | { | |
| | | const uword index = (in_col + (subview<eT>::aux_col1))*(subview<eT>::m).n | |
| | | _rows + (subview<eT>::aux_row1); | |
| | | | |
| | | return subview<eT>::m.mem[index]; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| subview_row<eT> | | subview_row<eT> | |
| subview_row<eT>::cols(const uword in_col1, const uword in_col2) | | subview_row<eT>::cols(const uword in_col1, const uword in_col2) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= subview<eT>::n_col
s) ), "subview_row::cols(): indices out of bounds or incorrectly used" ); | | arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= subview<eT>::n_col
s) ), "subview_row::cols(): indices out of bounds or incorrectly used" ); | |
| | | | |
| const uword subview_n_cols = in_col2 - in_col1 + 1; | | const uword subview_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
| const uword base_col1 = this->aux_col1 + in_col1; | | const uword base_col1 = this->aux_col1 + in_col1; | |
| | | | |
End of changes. 20 change blocks. |
| 11 lines changed or deleted | | 236 lines changed or added | |
|
| traits.hpp | | traits.hpp | |
|
| // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2011 Conrad Sanderson | | // Copyright (C) 2008-2012 Conrad Sanderson | |
| // | | // | |
| // This file is part of the Armadillo C++ library. | | // This file is part of the Armadillo C++ library. | |
| // It is provided without any warranty of fitness | | // It is provided without any warranty of fitness | |
| // 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) | |
| | | | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| { typedef T2 result; }; | | { typedef T2 result; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_Mat_only | | struct is_Mat_only | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct is_Mat_only< Mat<eT> > | | struct is_Mat_only< Mat<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT> | |
| | | struct is_Mat_only< const Mat<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_Mat | | struct is_Mat | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct is_Mat< Mat<eT> > | | struct is_Mat< Mat<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | struct is_Mat< const Mat<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| struct is_Mat< Row<eT> > | | struct is_Mat< Row<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | struct is_Mat< const Row<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| struct is_Mat< Col<eT> > | | struct is_Mat< Col<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT> | |
| | | struct is_Mat< const Col<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_Row | | struct is_Row | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct is_Row< Row<eT> > | | struct is_Row< Row<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT> | |
| | | struct is_Row< const Row<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_Col | | struct is_Col | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct is_Col< Col<eT> > | | struct is_Col< Col<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT> | |
| | | struct is_Col< const Col<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename T> | |
| | | struct is_diagview | |
| | | { static const bool value = false; }; | |
| | | | |
| | | template<typename eT> | |
| | | struct is_diagview< diagview<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| | | struct is_diagview< const diagview<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_subview | | struct is_subview | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct is_subview< subview<eT> > | | struct is_subview< subview<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT> | |
| | | struct is_subview< const subview<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
|
| struct is_diagview | | struct is_subview_row | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| struct is_diagview< diagview<eT> > | | struct is_subview_row< subview_row<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| | | struct is_subview_row< const subview_row<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename T> | |
| | | struct is_subview_col | |
| | | { static const bool value = false; }; | |
| | | | |
| | | template<typename eT> | |
| | | struct is_subview_col< subview_col<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| | | struct is_subview_col< const subview_col<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename T> | |
| | | struct is_subview_elem1 | |
| | | { static const bool value = false; }; | |
| | | | |
| | | template<typename eT, typename T1> | |
| | | struct is_subview_elem1< subview_elem1<eT, T1> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT, typename T1> | |
| | | struct is_subview_elem1< const subview_elem1<eT, T1> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename T> | |
| | | struct is_subview_elem2 | |
| | | { static const bool value = false; }; | |
| | | | |
| | | template<typename eT, typename T1, typename T2> | |
| | | struct is_subview_elem2< subview_elem2<eT, T1, T2> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT, typename T1, typename T2> | |
| | | struct is_subview_elem2< const subview_elem2<eT, T1, T2> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| // | | // | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_Cube | | struct is_Cube | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 188 | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| // | | // | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_Gen | | struct is_Gen | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
|
| template<typename eT, typename gen_type> | | template<typename T1, typename gen_type> | |
| struct is_Gen< Gen<eT,gen_type> > | | struct is_Gen< Gen<T1,gen_type> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename T1, typename gen_type> | |
| | | struct is_Gen< const Gen<T1,gen_type> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_Op | | struct is_Op | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename T1, typename op_type> | | template<typename T1, typename op_type> | |
| struct is_Op< Op<T1,op_type> > | | struct is_Op< Op<T1,op_type> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename T1, typename op_type> | |
| | | struct is_Op< const Op<T1,op_type> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_eOp | | struct is_eOp | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename T1, typename eop_type> | | template<typename T1, typename eop_type> | |
| struct is_eOp< eOp<T1,eop_type> > | | struct is_eOp< eOp<T1,eop_type> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename T1, typename eop_type> | |
| | | struct is_eOp< const eOp<T1,eop_type> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_mtOp | | struct is_mtOp | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT, typename T1, typename op_type> | | template<typename eT, typename T1, typename op_type> | |
| struct is_mtOp< mtOp<eT, T1, op_type> > | | struct is_mtOp< mtOp<eT, T1, op_type> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT, typename T1, typename op_type> | |
| | | struct is_mtOp< const mtOp<eT, T1, op_type> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_Glue | | struct is_Glue | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename T1, typename T2, typename glue_type> | | template<typename T1, typename T2, typename glue_type> | |
| struct is_Glue< Glue<T1,T2,glue_type> > | | struct is_Glue< Glue<T1,T2,glue_type> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename T1, typename T2, typename glue_type> | |
| | | struct is_Glue< const Glue<T1,T2,glue_type> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_eGlue | | struct is_eGlue | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename T1, typename T2, typename eglue_type> | | template<typename T1, typename T2, typename eglue_type> | |
| struct is_eGlue< eGlue<T1,T2,eglue_type> > | | struct is_eGlue< eGlue<T1,T2,eglue_type> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename T1, typename T2, typename eglue_type> | |
| | | struct is_eGlue< const eGlue<T1,T2,eglue_type> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_mtGlue | | struct is_mtGlue | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT, typename T1, typename T2, typename glue_type> | | template<typename eT, typename T1, typename T2, typename glue_type> | |
| struct is_mtGlue< mtGlue<eT, T1, T2, glue_type> > | | struct is_mtGlue< mtGlue<eT, T1, T2, glue_type> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT, typename T1, typename T2, typename glue_type> | |
| | | struct is_mtGlue< const mtGlue<eT, T1, T2, glue_type> > | |
| | | { static const bool value = true; }; | |
| | | | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_glue_times | | struct is_glue_times | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| struct is_glue_times< Glue<T1,T2,glue_times> > | | struct is_glue_times< Glue<T1,T2,glue_times> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename T1, typename T2> | |
| | | struct is_glue_times< const Glue<T1,T2,glue_times> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_glue_times_diag | | struct is_glue_times_diag | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| struct is_glue_times_diag< Glue<T1,T2,glue_times_diag> > | | struct is_glue_times_diag< Glue<T1,T2,glue_times_diag> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename T1, typename T2> | |
| | | struct is_glue_times_diag< const Glue<T1,T2,glue_times_diag> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_op_diagmat | | struct is_op_diagmat | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct is_op_diagmat< Op<T1,op_diagmat> > | | struct is_op_diagmat< Op<T1,op_diagmat> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename T1> | |
| | | struct is_op_diagmat< const Op<T1,op_diagmat> > | |
| | | { static const bool value = true; }; | |
| | | | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_GenCube | | struct is_GenCube | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT, typename gen_type> | | template<typename eT, typename gen_type> | |
| struct is_GenCube< GenCube<eT,gen_type> > | | struct is_GenCube< GenCube<eT,gen_type> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| skipping to change at line 307 | | skipping to change at line 427 | |
| | | | |
| template<typename T> | | template<typename T> | |
| struct is_basevec | | struct is_basevec | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct is_basevec< Row<eT> > | | struct is_basevec< Row<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | struct is_basevec< const Row<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| struct is_basevec< Col<eT> > | | struct is_basevec< Col<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | struct is_basevec< const Col<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| struct is_basevec< subview_row<eT> > | | struct is_basevec< subview_row<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | struct is_basevec< const subview_row<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| struct is_basevec< subview_col<eT> > | | struct is_basevec< subview_col<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
|
| | | struct is_basevec< const subview_col<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename eT> | |
| struct is_basevec< diagview<eT> > | | struct is_basevec< diagview<eT> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT> | |
| | | struct is_basevec< const diagview<eT> > | |
| | | { static const bool value = true; }; | |
| | | | |
| template<typename eT, typename T1> | | template<typename eT, typename T1> | |
| struct is_basevec< subview_elem1<eT,T1> > | | struct is_basevec< subview_elem1<eT,T1> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename eT, typename T1> | |
| | | struct is_basevec< const subview_elem1<eT,T1> > | |
| | | { static const bool value = true; }; | |
| | | | |
| // | | // | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct is_arma_type | | struct is_arma_type | |
| { | | { | |
| static const bool value | | static const bool value | |
| = is_Mat<T1>::value | | = is_Mat<T1>::value | |
| || is_Gen<T1>::value | | || is_Gen<T1>::value | |
| || is_Op<T1>::value | | || is_Op<T1>::value | |
|
| || is_eOp<T1>::value | | | |
| || is_mtOp<T1>::value | | | |
| || is_Glue<T1>::value | | || is_Glue<T1>::value | |
|
| | | || is_eOp<T1>::value | |
| || is_eGlue<T1>::value | | || is_eGlue<T1>::value | |
|
| | | || is_mtOp<T1>::value | |
| || is_mtGlue<T1>::value | | || is_mtGlue<T1>::value | |
|
| || is_subview<T1>::value | | | |
| || is_diagview<T1>::value | | || is_diagview<T1>::value | |
|
| | | || is_subview<T1>::value | |
| | | || is_subview_row<T1>::value | |
| | | || is_subview_col<T1>::value | |
| | | || is_subview_elem1<T1>::value | |
| | | || is_subview_elem2<T1>::value | |
| ; | | ; | |
| }; | | }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct is_arma_cube_type | | struct is_arma_cube_type | |
| { | | { | |
| static const bool value | | static const bool value | |
| = is_Cube<T1>::value | | = is_Cube<T1>::value | |
| || is_GenCube<T1>::value | | || is_GenCube<T1>::value | |
| || is_OpCube<T1>::value | | || is_OpCube<T1>::value | |
| | | | |
End of changes. 31 change blocks. |
| 9 lines changed or deleted | | 157 lines changed or added | |
|