| Mat_bones.hpp | | Mat_bones.hpp | |
| | | | |
| skipping to change at line 22 | | skipping to change at line 22 | |
| //! Dense matrix class | | //! Dense matrix class | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Mat : public Base< eT, Mat<eT> > | | class Mat : public Base< eT, Mat<eT> > | |
| { | | { | |
| public: | | public: | |
| | | | |
| typedef eT elem_type; //!< the type of el
ements stored in the matrix | | typedef eT elem_type; //!< the type of el
ements stored in the matrix | |
| typedef typename get_pod_type<eT>::result pod_type; //!< if eT is non-c
omplex, pod_type is same as eT. otherwise, pod_type is the underlying type
used by std::complex | | typedef typename get_pod_type<eT>::result pod_type; //!< if eT is non-c
omplex, pod_type is same as eT. otherwise, pod_type is the underlying type
used by std::complex | |
| | | | |
|
| static const bool is_col = false; | | | |
| static const bool is_row = false; | | | |
| | | | |
| const uword n_rows; //!< number of rows in the matrix (read-only) | | const uword n_rows; //!< number of rows in the matrix (read-only) | |
| const uword n_cols; //!< number of columns in the matrix (read-only) | | const uword n_cols; //!< number of columns in the matrix (read-only) | |
| const uword n_elem; //!< number of elements in the matrix (read-only) | | const uword n_elem; //!< number of elements in the matrix (read-only) | |
| const uhword vec_state; //!< 0: matrix layout; 1: column vector layout; 2
: row vector layout | | const uhword vec_state; //!< 0: matrix layout; 1: column vector layout; 2
: row vector layout | |
| const uhword mem_state; | | const uhword mem_state; | |
| | | | |
| // mem_state = 0: normal matrix that can be resized; | | // mem_state = 0: normal matrix that can be resized; | |
| // mem_state = 1: use auxiliary memory until change in the number of elem
ents is requested; | | // mem_state = 1: use auxiliary memory until change in the number of elem
ents is requested; | |
| // mem_state = 2: use auxiliary memory and don't allow the number of elem
ents to be changed; | | // mem_state = 2: use auxiliary memory and don't allow the number of elem
ents to be changed; | |
| // mem_state = 3: fixed size (e.g. via template based size specification)
. | | // mem_state = 3: fixed size (e.g. via template based size specification)
. | |
| | | | |
| arma_aligned const eT* const mem; //!< pointer to the memory used by the
matrix (memory is read-only) | | arma_aligned const eT* const mem; //!< pointer to the memory used by the
matrix (memory is read-only) | |
| | | | |
| protected: | | protected: | |
| arma_align_mem eT mem_local[ arma_config::mat_prealloc ]; | | arma_align_mem eT mem_local[ arma_config::mat_prealloc ]; | |
| | | | |
| public: | | public: | |
| | | | |
|
| | | static const bool is_col = false; | |
| | | static const bool is_row = false; | |
| | | | |
| inline ~Mat(); | | inline ~Mat(); | |
| inline Mat(); | | inline Mat(); | |
| | | | |
| inline Mat(const uword in_rows, const uword in_cols); | | inline Mat(const uword in_rows, const uword in_cols); | |
| | | | |
| inline Mat(const char* text); | | inline Mat(const char* text); | |
| inline const Mat& operator=(const char* text); | | inline const Mat& operator=(const char* text); | |
| | | | |
| inline Mat(const std::string& text); | | inline Mat(const std::string& text); | |
| inline const Mat& operator=(const std::string& text); | | inline const Mat& operator=(const std::string& text); | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| compiler_setup.hpp | | compiler_setup.hpp | |
| | | | |
| skipping to change at line 178 | | skipping to change at line 178 | |
| #endif | | #endif | |
| | | | |
| #undef ARMA_GOOD_COMPILER | | #undef ARMA_GOOD_COMPILER | |
| #undef ARMA_HAVE_STD_ISFINITE | | #undef ARMA_HAVE_STD_ISFINITE | |
| #undef ARMA_HAVE_STD_SNPRINTF | | #undef ARMA_HAVE_STD_SNPRINTF | |
| #undef ARMA_HAVE_LOG1P | | #undef ARMA_HAVE_LOG1P | |
| #undef ARMA_HAVE_STD_ISINF | | #undef ARMA_HAVE_STD_ISINF | |
| #undef ARMA_HAVE_STD_ISNAN | | #undef ARMA_HAVE_STD_ISNAN | |
| #undef ARMA_HAVE_STD_TR1 | | #undef ARMA_HAVE_STD_TR1 | |
| | | | |
|
| #undef arma_inline | | // #undef arma_inline | |
| #define arma_inline inline __forceinline | | // #define arma_inline inline __forceinline | |
| | | | |
|
| #undef arma_aligned | | // // disable warnings for "__forceinline can't be inlined" | |
| #undef arma_align_mem | | // #pragma warning(disable: 4714) | |
| | | | |
|
| #define arma_aligned __declspec(align(16)) | | // disable warnings for "conditional expression is constant" | |
| #define arma_align_mem __declspec(align(16)) | | #pragma warning(disable: 4127) | |
| | | | |
|
| #define ARMA_HAVE_ALIGNED_ATTRIBUTE | | // TODO: use #pragma warning(push) and #pragma warning(pop) | |
| | | | |
| | | #if (_MANAGED == 1) || (_M_CEE == 1) | |
| | | | |
| | | // don't do any alignment when compiling in "managed code" mode | |
| | | | |
| | | #else | |
| | | // #undef arma_aligned | |
| | | // #define arma_aligned __declspec(align(16)) | |
| | | | |
| | | #undef arma_align_mem | |
| | | #define arma_align_mem __declspec(align(16)) | |
| | | | |
| | | #define ARMA_HAVE_ALIGNED_ATTRIBUTE | |
| | | | |
| | | // disable warnings: "structure was padded due to __declspec(align(16)) | |
| | | " | |
| | | #pragma warning(disable: 4324) | |
| | | | |
| | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
| #if defined(__CUDACC__) | | #if defined(__CUDACC__) | |
| #undef ARMA_HAVE_STD_ISFINITE | | #undef ARMA_HAVE_STD_ISFINITE | |
| #undef ARMA_HAVE_STD_SNPRINTF | | #undef ARMA_HAVE_STD_SNPRINTF | |
| #undef ARMA_HAVE_LOG1P | | #undef ARMA_HAVE_LOG1P | |
| #undef ARMA_HAVE_STD_ISINF | | #undef ARMA_HAVE_STD_ISINF | |
| #undef ARMA_HAVE_STD_ISNAN | | #undef ARMA_HAVE_STD_ISNAN | |
| #undef ARMA_HAVE_STD_TR1 | | #undef ARMA_HAVE_STD_TR1 | |
| | | | |
End of changes. 4 change blocks. |
| 7 lines changed or deleted | | 26 lines changed or added | |
|
| eglue_core_meat.hpp | | eglue_core_meat.hpp | |
| | | | |
| skipping to change at line 163 | | skipping to change at line 163 | |
| | | | |
| // NOTE: we're assuming that the matrix has already been set to the corre
ct size and there is no aliasing; | | // NOTE: we're assuming that the matrix has already been set to the corre
ct size and there is no aliasing; | |
| // size setting and alias checking is done by either the Mat contructor o
r operator=() | | // size setting and alias checking is done by either the Mat contructor o
r operator=() | |
| | | | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| if(prefer_at_accessor == false) | | if(prefer_at_accessor == false) | |
| { | | { | |
| const uword n_elem = (Proxy<T1>::is_fixed || Proxy<T2>::is_fixed) ? x.g
et_n_elem() : out.n_elem; | | const uword n_elem = (Proxy<T1>::is_fixed || Proxy<T2>::is_fixed) ? x.g
et_n_elem() : out.n_elem; | |
| | | | |
|
| if(memory::is_aligned(out_mem)) | | //if( memory::is_aligned(out_mem) ) | |
| | | if( memory::is_aligned(out_mem) && ((Proxy<T1>::is_fixed && Proxy<T2>:: | |
| | | is_fixed) ? (x.get_n_elem() >= 32) : true) ) | |
| { | | { | |
| memory::mark_as_aligned(out_mem); | | memory::mark_as_aligned(out_mem); | |
| | | | |
| if(x.P1.is_aligned() && x.P2.is_aligned()) | | if(x.P1.is_aligned() && x.P2.is_aligned()) | |
| { | | { | |
| typename Proxy<T1>::aligned_ea_type P1 = x.P1.get_aligned_ea(); | | typename Proxy<T1>::aligned_ea_type P1 = x.P1.get_aligned_ea(); | |
| typename Proxy<T2>::aligned_ea_type P2 = x.P2.get_aligned_ea(); | | typename Proxy<T2>::aligned_ea_type P2 = x.P2.get_aligned_ea(); | |
| | | | |
| if(is_same_type<eglue_type, eglue_plus >::value == true) { arm
a_applier_1a(=, +); } | | if(is_same_type<eglue_type, eglue_plus >::value == true) { arm
a_applier_1a(=, +); } | |
| else if(is_same_type<eglue_type, eglue_minus>::value == true) { arm
a_applier_1a(=, -); } | | else if(is_same_type<eglue_type, eglue_minus>::value == true) { arm
a_applier_1a(=, -); } | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 3 lines changed or added | |
|
| eop_aux.hpp | | eop_aux.hpp | |
|
| // Copyright (C) 2010-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2010-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2010-2012 Conrad Sanderson | | // Copyright (C) 2010-2013 Conrad Sanderson | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup eop_aux | | //! \addtogroup eop_aux | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct eop_aux_randu | | struct eop_aux_randu | |
| { | | { | |
| arma_inline | | arma_inline | |
| operator eT () | | operator eT () | |
| { | | { | |
|
| return eT(std::rand()) * ( eT(1) / eT(RAND_MAX) ); | | // make sure we are internally using at least floats | |
| | | typedef typename promote_type<eT,float>::result eTp; | |
| | | | |
| | | return eT( eTp(std::rand()) * ( eTp(1) / eTp(RAND_MAX) ) ); | |
| } | | } | |
| | | | |
| inline | | inline | |
| static | | static | |
| void | | void | |
| fill(eT* mem, const uword N) | | fill(eT* mem, const uword N) | |
| { | | { | |
| uword i,j; | | uword i,j; | |
| | | | |
| for(i=0, j=1; j < N; i+=2, j+=2) | | for(i=0, j=1; j < N; i+=2, j+=2) | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 132 | |
| { | | { | |
| tmp1 = eTp(2) * eTp(std::rand()) * (eTp(1) / eTp(RAND_MAX)) - eTp(1); | | tmp1 = eTp(2) * eTp(std::rand()) * (eTp(1) / eTp(RAND_MAX)) - eTp(1); | |
| tmp2 = eTp(2) * eTp(std::rand()) * (eTp(1) / eTp(RAND_MAX)) - eTp(1); | | tmp2 = eTp(2) * eTp(std::rand()) * (eTp(1) / eTp(RAND_MAX)) - eTp(1); | |
| | | | |
| w = tmp1*tmp1 + tmp2*tmp2; | | w = tmp1*tmp1 + tmp2*tmp2; | |
| } | | } | |
| while ( w >= eTp(1) ); | | while ( w >= eTp(1) ); | |
| | | | |
| const eTp k = std::sqrt( (eTp(-2) * std::log(w)) / w); | | const eTp k = std::sqrt( (eTp(-2) * std::log(w)) / w); | |
| | | | |
|
| out1 = tmp1*k; | | out1 = eT(tmp1*k); | |
| out2 = tmp2*k; | | out2 = eT(tmp2*k); | |
| } | | } | |
| | | | |
| inline | | inline | |
| static | | static | |
| void | | void | |
| fill(eT* mem, const uword N) | | fill(eT* mem, const uword N) | |
| { | | { | |
| uword i, j; | | uword i, j; | |
| | | | |
| for(i=0, j=1; j < N; i+=2, j+=2) | | for(i=0, j=1; j < N; i+=2, j+=2) | |
| | | | |
End of changes. 3 change blocks. |
| 5 lines changed or deleted | | 8 lines changed or added | |
|
| glue_cross_meat.hpp | | glue_cross_meat.hpp | |
|
| // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) | | // Copyright (C) 2010-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2010-2011 Conrad Sanderson | | // Copyright (C) 2010-2013 Conrad Sanderson | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup glue_cross | | //! \addtogroup glue_cross | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| void | | void | |
| glue_cross::apply(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue
_cross>& X) | | glue_cross::apply(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue
_cross>& X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| typedef typename Proxy<T1>::ea_type ea_type1; | | | |
| typedef typename Proxy<T2>::ea_type ea_type2; | | | |
| | | | |
|
| const Proxy<T1> A(X.A); | | const Proxy<T1> PA(X.A); | |
| const Proxy<T2> B(X.B); | | const Proxy<T2> PB(X.B); | |
| | | | |
|
| arma_debug_check( ((A.get_n_elem() != 3) || (B.get_n_elem() != 3)), "cros
s(): input vectors must have 3 elements" ); | | arma_debug_check( ((PA.get_n_elem() != 3) || (PB.get_n_elem() != 3)), "cr
oss(): input vectors must have 3 elements" ); | |
| | | | |
|
| out.set_size(A.get_n_rows(), A.get_n_cols()); | | const uword PA_n_rows = Proxy<T1>::is_row ? 1 : PA.get_n_rows(); | |
| | | const uword PA_n_cols = Proxy<T1>::is_col ? 1 : PA.get_n_cols(); | |
| eT* out_mem = out.memptr(); | | | |
| ea_type1 PA = A.get_ea(); | | out.set_size(PA_n_rows, PA_n_cols); | |
| ea_type2 PB = B.get_ea(); | | | |
| | | eT* out_mem = out.memptr(); | |
| const eT ax = PA[0]; | | | |
| const eT ay = PA[1]; | | if( (Proxy<T1>::prefer_at_accessor == false) && (Proxy<T2>::prefer_at_acc | |
| const eT az = PA[2]; | | essor == false) ) | |
| | | { | |
| const eT bx = PB[0]; | | typename Proxy<T1>::ea_type A = PA.get_ea(); | |
| const eT by = PB[1]; | | typename Proxy<T2>::ea_type B = PB.get_ea(); | |
| const eT bz = PB[2]; | | | |
| | | const eT ax = A[0]; | |
| out_mem[0] = ay*bz - az*by; | | const eT ay = A[1]; | |
| out_mem[1] = az*bx - ax*bz; | | const eT az = A[2]; | |
| out_mem[2] = ax*by - ay*bx; | | | |
| | | const eT bx = B[0]; | |
| | | const eT by = B[1]; | |
| | | const eT bz = B[2]; | |
| | | | |
| | | out_mem[0] = ay*bz - az*by; | |
| | | out_mem[1] = az*bx - ax*bz; | |
| | | out_mem[2] = ax*by - ay*bx; | |
| | | } | |
| | | else | |
| | | { | |
| | | const bool PA_is_col = Proxy<T1>::is_col ? true : (PA_n_cols == 1 | |
| | | ); | |
| | | const bool PB_is_col = Proxy<T2>::is_col ? true : (PB.get_n_cols() == 1 | |
| | | ); | |
| | | | |
| | | const eT ax = PA.at(0,0); | |
| | | const eT ay = PA_is_col ? PA.at(1,0) : PA.at(0,1); | |
| | | const eT az = PA_is_col ? PA.at(2,0) : PA.at(0,2); | |
| | | | |
| | | const eT bx = PB.at(0,0); | |
| | | const eT by = PB_is_col ? PB.at(1,0) : PB.at(0,1); | |
| | | const eT bz = PB_is_col ? PB.at(2,0) : PB.at(0,2); | |
| | | | |
| | | out_mem[0] = ay*bz - az*by; | |
| | | out_mem[1] = az*bx - ax*bz; | |
| | | out_mem[2] = ax*by - ay*bx; | |
| | | } | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 5 change blocks. |
| 25 lines changed or deleted | | 50 lines changed or added | |
|
| glue_mixed_meat.hpp | | glue_mixed_meat.hpp | |
|
| // Copyright (C) 2009-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2009-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2009-2012 Conrad Sanderson | | // Copyright (C) 2009-2013 Conrad Sanderson | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup glue_mixed | | //! \addtogroup glue_mixed | |
| //! @{ | | //! @{ | |
| | | | |
| //! matrix multiplication with different element types | | //! matrix multiplication with different element types | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| out_eT* out_mem = out.memptr(); | | out_eT* out_mem = out.memptr(); | |
| const uword n_elem = out.n_elem; | | const uword n_elem = out.n_elem; | |
| | | | |
| const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T
2>::prefer_at_accessor); | | const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T
2>::prefer_at_accessor); | |
| | | | |
| if(prefer_at_accessor == false) | | if(prefer_at_accessor == false) | |
| { | | { | |
| typename Proxy<T1>::ea_type AA = A.get_ea(); | | typename Proxy<T1>::ea_type AA = A.get_ea(); | |
| typename Proxy<T2>::ea_type BB = B.get_ea(); | | typename Proxy<T2>::ea_type BB = B.get_ea(); | |
| | | | |
|
| for(uword i=0; i<n_elem; ++i) | | if(memory::is_aligned(out_mem)) | |
| { | | { | |
|
| out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) + upgrade_val<eT1,eT2 | | memory::mark_as_aligned(out_mem); | |
| >::apply(BB[i]); | | | |
| | | for(uword i=0; i<n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) + upgrade_val<eT1,e | |
| | | T2>::apply(BB[i]); | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(uword i=0; i<n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) + upgrade_val<eT1,e | |
| | | T2>::apply(BB[i]); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| uword i = 0; | | uword i = 0; | |
| | | | |
| for(uword col=0; col < n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| for(uword row=0; row < n_rows; ++row) | | for(uword row=0; row < n_rows; ++row) | |
| { | | { | |
| out_mem[i] = upgrade_val<eT1,eT2>::apply(A.at(row,col)) + upgrade_val
<eT1,eT2>::apply(B.at(row,col)); | | out_mem[i] = upgrade_val<eT1,eT2>::apply(A.at(row,col)) + upgrade_val
<eT1,eT2>::apply(B.at(row,col)); | |
| | | | |
| skipping to change at line 123 | | skipping to change at line 135 | |
| out_eT* out_mem = out.memptr(); | | out_eT* out_mem = out.memptr(); | |
| const uword n_elem = out.n_elem; | | const uword n_elem = out.n_elem; | |
| | | | |
| const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T
2>::prefer_at_accessor); | | const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T
2>::prefer_at_accessor); | |
| | | | |
| if(prefer_at_accessor == false) | | if(prefer_at_accessor == false) | |
| { | | { | |
| typename Proxy<T1>::ea_type AA = A.get_ea(); | | typename Proxy<T1>::ea_type AA = A.get_ea(); | |
| typename Proxy<T2>::ea_type BB = B.get_ea(); | | typename Proxy<T2>::ea_type BB = B.get_ea(); | |
| | | | |
|
| for(uword i=0; i<n_elem; ++i) | | if(memory::is_aligned(out_mem)) | |
| | | { | |
| | | memory::mark_as_aligned(out_mem); | |
| | | | |
| | | for(uword i=0; i<n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) - upgrade_val<eT1,e | |
| | | T2>::apply(BB[i]); | |
| | | } | |
| | | } | |
| | | else | |
| { | | { | |
|
| out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) - upgrade_val<eT1,eT2 | | for(uword i=0; i<n_elem; ++i) | |
| >::apply(BB[i]); | | { | |
| | | out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) - upgrade_val<eT1,e | |
| | | T2>::apply(BB[i]); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| uword i = 0; | | uword i = 0; | |
| | | | |
| for(uword col=0; col < n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| for(uword row=0; row < n_rows; ++row) | | for(uword row=0; row < n_rows; ++row) | |
| { | | { | |
| out_mem[i] = upgrade_val<eT1,eT2>::apply(A.at(row,col)) - upgrade_val
<eT1,eT2>::apply(B.at(row,col)); | | out_mem[i] = upgrade_val<eT1,eT2>::apply(A.at(row,col)) - upgrade_val
<eT1,eT2>::apply(B.at(row,col)); | |
| | | | |
| skipping to change at line 176 | | skipping to change at line 200 | |
| out_eT* out_mem = out.memptr(); | | out_eT* out_mem = out.memptr(); | |
| const uword n_elem = out.n_elem; | | const uword n_elem = out.n_elem; | |
| | | | |
| const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T
2>::prefer_at_accessor); | | const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T
2>::prefer_at_accessor); | |
| | | | |
| if(prefer_at_accessor == false) | | if(prefer_at_accessor == false) | |
| { | | { | |
| typename Proxy<T1>::ea_type AA = A.get_ea(); | | typename Proxy<T1>::ea_type AA = A.get_ea(); | |
| typename Proxy<T2>::ea_type BB = B.get_ea(); | | typename Proxy<T2>::ea_type BB = B.get_ea(); | |
| | | | |
|
| for(uword i=0; i<n_elem; ++i) | | if(memory::is_aligned(out_mem)) | |
| { | | { | |
|
| out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) / upgrade_val<eT1,eT2 | | memory::mark_as_aligned(out_mem); | |
| >::apply(BB[i]); | | | |
| | | for(uword i=0; i<n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) / upgrade_val<eT1,e | |
| | | T2>::apply(BB[i]); | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(uword i=0; i<n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) / upgrade_val<eT1,e | |
| | | T2>::apply(BB[i]); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| uword i = 0; | | uword i = 0; | |
| | | | |
| for(uword col=0; col < n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| for(uword row=0; row < n_rows; ++row) | | for(uword row=0; row < n_rows; ++row) | |
| { | | { | |
| out_mem[i] = upgrade_val<eT1,eT2>::apply(A.at(row,col)) / upgrade_val
<eT1,eT2>::apply(B.at(row,col)); | | out_mem[i] = upgrade_val<eT1,eT2>::apply(A.at(row,col)) / upgrade_val
<eT1,eT2>::apply(B.at(row,col)); | |
| | | | |
| skipping to change at line 229 | | skipping to change at line 265 | |
| out_eT* out_mem = out.memptr(); | | out_eT* out_mem = out.memptr(); | |
| const uword n_elem = out.n_elem; | | const uword n_elem = out.n_elem; | |
| | | | |
| const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T
2>::prefer_at_accessor); | | const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T
2>::prefer_at_accessor); | |
| | | | |
| if(prefer_at_accessor == false) | | if(prefer_at_accessor == false) | |
| { | | { | |
| typename Proxy<T1>::ea_type AA = A.get_ea(); | | typename Proxy<T1>::ea_type AA = A.get_ea(); | |
| typename Proxy<T2>::ea_type BB = B.get_ea(); | | typename Proxy<T2>::ea_type BB = B.get_ea(); | |
| | | | |
|
| for(uword i=0; i<n_elem; ++i) | | if(memory::is_aligned(out_mem)) | |
| | | { | |
| | | memory::mark_as_aligned(out_mem); | |
| | | | |
| | | for(uword i=0; i<n_elem; ++i) | |
| | | { | |
| | | out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) * upgrade_val<eT1,e | |
| | | T2>::apply(BB[i]); | |
| | | } | |
| | | } | |
| | | else | |
| { | | { | |
|
| out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) * upgrade_val<eT1,eT2 | | for(uword i=0; i<n_elem; ++i) | |
| >::apply(BB[i]); | | { | |
| | | out_mem[i] = upgrade_val<eT1,eT2>::apply(AA[i]) * upgrade_val<eT1,e | |
| | | T2>::apply(BB[i]); | |
| | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| uword i = 0; | | uword i = 0; | |
| | | | |
| for(uword col=0; col < n_cols; ++col) | | for(uword col=0; col < n_cols; ++col) | |
| for(uword row=0; row < n_rows; ++row) | | for(uword row=0; row < n_rows; ++row) | |
| { | | { | |
| out_mem[i] = upgrade_val<eT1,eT2>::apply(A.at(row,col)) * upgrade_val
<eT1,eT2>::apply(B.at(row,col)); | | out_mem[i] = upgrade_val<eT1,eT2>::apply(A.at(row,col)) * upgrade_val
<eT1,eT2>::apply(B.at(row,col)); | |
| | | | |
End of changes. 9 change blocks. |
| 14 lines changed or deleted | | 66 lines changed or added | |
|