| Col_bones.hpp | | Col_bones.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-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 Col | | //! \addtogroup Col | |
| //! @{ | | //! @{ | |
| | | | |
| //! Class for column vectors (matrices with only one column) | | //! Class for column vectors (matrices with only one column) | |
| | | | |
| | | | |
| skipping to change at line 171 | | skipping to change at line 171 | |
| inline const Col& operator=(const std::string& text); | | inline const Col& operator=(const std::string& text); | |
| inline const Col& operator=(const subview_cube<eT>& X); | | inline const Col& operator=(const subview_cube<eT>& X); | |
| | | | |
| using Col<eT>::operator(); | | using Col<eT>::operator(); | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| inline fixed(const std::initializer_list<eT>& list); | | inline fixed(const std::initializer_list<eT>& list); | |
| inline const Col& operator=(const std::initializer_list<eT>& list); | | inline const Col& operator=(const std::initializer_list<eT>& list); | |
| #endif | | #endif | |
| | | | |
|
| | | arma_inline const Op< typename Col<eT>::template fixed<fixed_n_elem>, op_ | |
| | | htrans > t() const; | |
| | | arma_inline const Op< typename Col<eT>::template fixed<fixed_n_elem>, op_ | |
| | | htrans > ht() const; | |
| | | arma_inline const Op< typename Col<eT>::template fixed<fixed_n_elem>, op_ | |
| | | strans > st() const; | |
| | | | |
| arma_inline arma_warn_unused eT& operator[] (const uword i); | | arma_inline arma_warn_unused eT& operator[] (const uword i); | |
| arma_inline arma_warn_unused eT operator[] (const uword i) const; | | arma_inline arma_warn_unused eT operator[] (const uword i) const; | |
| arma_inline arma_warn_unused eT& at (const uword i); | | arma_inline arma_warn_unused eT& at (const uword i); | |
| arma_inline arma_warn_unused eT at (const uword i) const; | | arma_inline arma_warn_unused eT at (const uword i) const; | |
| arma_inline arma_warn_unused eT& operator() (const uword i); | | arma_inline arma_warn_unused eT& operator() (const uword i); | |
| arma_inline arma_warn_unused eT operator() (const uword i) const; | | arma_inline arma_warn_unused eT operator() (const uword i) const; | |
| | | | |
| arma_inline arma_warn_unused eT& at (const uword in_row, const uw
ord in_col); | | arma_inline arma_warn_unused eT& at (const uword in_row, const uw
ord in_col); | |
| arma_inline arma_warn_unused eT at (const uword in_row, const uw
ord in_col) const; | | arma_inline arma_warn_unused eT at (const uword in_row, const uw
ord in_col) const; | |
| arma_inline arma_warn_unused eT& operator() (const uword in_row, const uw
ord in_col); | | arma_inline arma_warn_unused eT& operator() (const uword in_row, const uw
ord in_col); | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 9 lines changed or added | |
|
| Mat_bones.hpp | | Mat_bones.hpp | |
| | | | |
| skipping to change at line 550 | | skipping to change at line 550 | |
| inline fixed(const std::string& text); | | inline fixed(const std::string& text); | |
| | | | |
| using Mat<eT>::operator=; | | using Mat<eT>::operator=; | |
| using Mat<eT>::operator(); | | using Mat<eT>::operator(); | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| inline fixed(const std::initializer_list<eT>& list); | | inline fixed(const std::initializer_list<eT>& list); | |
| inline const Mat& operator=(const std::initializer_list<eT>& list); | | inline const Mat& operator=(const std::initializer_list<eT>& list); | |
| #endif | | #endif | |
| | | | |
|
| | | arma_inline const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixe | |
| | | d_n_cols>, op_htrans > t() const; | |
| | | arma_inline const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixe | |
| | | d_n_cols>, op_htrans > ht() const; | |
| | | arma_inline const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixe | |
| | | d_n_cols>, op_strans > st() const; | |
| | | | |
| arma_inline arma_warn_unused eT& operator[] (const uword i); | | arma_inline arma_warn_unused eT& operator[] (const uword i); | |
| arma_inline arma_warn_unused eT operator[] (const uword i) const; | | arma_inline arma_warn_unused eT operator[] (const uword i) const; | |
| arma_inline arma_warn_unused eT& at (const uword i); | | arma_inline arma_warn_unused eT& at (const uword i); | |
| arma_inline arma_warn_unused eT at (const uword i) const; | | arma_inline arma_warn_unused eT at (const uword i) const; | |
| arma_inline arma_warn_unused eT& operator() (const uword i); | | arma_inline arma_warn_unused eT& operator() (const uword i); | |
| arma_inline arma_warn_unused eT operator() (const uword i) const; | | arma_inline arma_warn_unused eT operator() (const uword i) const; | |
| | | | |
| arma_inline arma_warn_unused eT& at (const uword in_row, const uw
ord in_col); | | arma_inline arma_warn_unused eT& at (const uword in_row, const uw
ord in_col); | |
| arma_inline arma_warn_unused eT at (const uword in_row, const uw
ord in_col) const; | | arma_inline arma_warn_unused eT at (const uword in_row, const uw
ord in_col) const; | |
| arma_inline arma_warn_unused eT& operator() (const uword in_row, const uw
ord in_col); | | arma_inline arma_warn_unused eT& operator() (const uword in_row, const uw
ord in_col); | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 7 lines changed or added | |
|
| Mat_meat.hpp | | Mat_meat.hpp | |
| | | | |
| skipping to change at line 5639 | | skipping to change at line 5639 | |
| for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } | | for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } | |
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| arma_inline | | arma_inline | |
|
| | | const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>, op_ | |
| | | htrans > | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::t() const | |
| | | { | |
| | | return Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>, | |
| | | op_htrans >(*this); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | arma_inline | |
| | | const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>, op_ | |
| | | htrans > | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::ht() const | |
| | | { | |
| | | return Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>, | |
| | | op_htrans >(*this); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | arma_inline | |
| | | const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>, op_ | |
| | | strans > | |
| | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::st() const | |
| | | { | |
| | | return Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>, | |
| | | op_strans >(*this); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| eT& | | eT& | |
| Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator[] (const uword ii) | | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator[] (const uword ii) | |
| { | | { | |
| return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; | | return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<uword fixed_n_rows, uword fixed_n_cols> | | template<uword fixed_n_rows, uword fixed_n_cols> | |
| arma_inline | | arma_inline | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 33 lines changed or added | |
|
| Row_bones.hpp | | Row_bones.hpp | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 169 | |
| inline const Row& operator=(const std::string& text); | | inline const Row& operator=(const std::string& text); | |
| inline const Row& operator=(const subview_cube<eT>& X); | | inline const Row& operator=(const subview_cube<eT>& X); | |
| | | | |
| using Row<eT>::operator(); | | using Row<eT>::operator(); | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| inline fixed(const std::initializer_list<eT>& list); | | inline fixed(const std::initializer_list<eT>& list); | |
| inline const Row& operator=(const std::initializer_list<eT>& list); | | inline const Row& operator=(const std::initializer_list<eT>& list); | |
| #endif | | #endif | |
| | | | |
|
| | | arma_inline const Op< typename Row<eT>::template fixed<fixed_n_elem>, op_ | |
| | | htrans > t() const; | |
| | | arma_inline const Op< typename Row<eT>::template fixed<fixed_n_elem>, op_ | |
| | | htrans > ht() const; | |
| | | arma_inline const Op< typename Row<eT>::template fixed<fixed_n_elem>, op_ | |
| | | strans > st() const; | |
| | | | |
| arma_inline arma_warn_unused eT& operator[] (const uword i); | | arma_inline arma_warn_unused eT& operator[] (const uword i); | |
| arma_inline arma_warn_unused eT operator[] (const uword i) const; | | arma_inline arma_warn_unused eT operator[] (const uword i) const; | |
| arma_inline arma_warn_unused eT& at (const uword i); | | arma_inline arma_warn_unused eT& at (const uword i); | |
| arma_inline arma_warn_unused eT at (const uword i) const; | | arma_inline arma_warn_unused eT at (const uword i) const; | |
| arma_inline arma_warn_unused eT& operator() (const uword i); | | arma_inline arma_warn_unused eT& operator() (const uword i); | |
| arma_inline arma_warn_unused eT operator() (const uword i) const; | | arma_inline arma_warn_unused eT operator() (const uword i) const; | |
| | | | |
| arma_inline arma_warn_unused eT& at (const uword in_row, const uw
ord in_col); | | arma_inline arma_warn_unused eT& at (const uword in_row, const uw
ord in_col); | |
| arma_inline arma_warn_unused eT at (const uword in_row, const uw
ord in_col) const; | | arma_inline arma_warn_unused eT at (const uword in_row, const uw
ord in_col) const; | |
| arma_inline arma_warn_unused eT& operator() (const uword in_row, const uw
ord in_col); | | arma_inline arma_warn_unused eT& operator() (const uword in_row, const uw
ord in_col); | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 7 lines changed or added | |
|
| config.hpp | | config.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-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/. | |
| | | | |
| #if !defined(ARMA_USE_LAPACK) | | #if !defined(ARMA_USE_LAPACK) | |
| #define ARMA_USE_LAPACK | | #define ARMA_USE_LAPACK | |
| //// Uncomment the above line if you have LAPACK or a high-speed replacemen
t for LAPACK, | | //// Uncomment the above line if you have LAPACK or a high-speed replacemen
t for LAPACK, | |
| //// such as Intel MKL, AMD ACML, or the Accelerate framework. | | //// such as Intel MKL, AMD ACML, or the Accelerate framework. | |
| //// LAPACK is required for matrix decompositions (eg. SVD) and matrix inve
rse. | | //// LAPACK is required for matrix decompositions (eg. SVD) and matrix inve
rse. | |
| | | | |
| skipping to change at line 131 | | skipping to change at line 131 | |
| #define ARMA_HAVE_GETTIMEOFDAY | | #define ARMA_HAVE_GETTIMEOFDAY | |
| | | | |
| #if defined(ARMA_DONT_USE_LAPACK) | | #if defined(ARMA_DONT_USE_LAPACK) | |
| #undef ARMA_USE_LAPACK | | #undef ARMA_USE_LAPACK | |
| #endif | | #endif | |
| | | | |
| #if defined(ARMA_DONT_USE_BLAS) | | #if defined(ARMA_DONT_USE_BLAS) | |
| #undef ARMA_USE_BLAS | | #undef ARMA_USE_BLAS | |
| #endif | | #endif | |
| | | | |
|
| | | #if defined(ARMA_DONT_USE_WRAPPER) | |
| | | #undef ARMA_USE_WRAPPER | |
| | | #endif | |
| | | | |
| #if defined(ARMA_DONT_USE_ATLAS) | | #if defined(ARMA_DONT_USE_ATLAS) | |
| #undef ARMA_USE_ATLAS | | #undef ARMA_USE_ATLAS | |
| #undef ARMA_ATLAS_INCLUDE_DIR | | #undef ARMA_ATLAS_INCLUDE_DIR | |
| #endif | | #endif | |
| | | | |
|
| | | #if defined(ARMA_DONT_USE_CXX11) | |
| | | #undef ARMA_USE_CXX11 | |
| | | #endif | |
| | | | |
| | | #if defined(ARMA_DONT_USE_HDF5) | |
| | | #undef ARMA_USE_HDF5 | |
| | | #endif | |
| | | | |
| | | #if defined(ARMA_DONT_USE_BOOST) | |
| | | #undef ARMA_USE_BOOST | |
| | | #undef ARMA_USE_BOOST_DATE | |
| | | #endif | |
| | | | |
| #if defined(ARMA_DONT_PRINT_LOGIC_ERRORS) | | #if defined(ARMA_DONT_PRINT_LOGIC_ERRORS) | |
| #undef ARMA_PRINT_LOGIC_ERRORS | | #undef ARMA_PRINT_LOGIC_ERRORS | |
| #endif | | #endif | |
| | | | |
| #if defined(ARMA_DONT_PRINT_RUNTIME_ERRORS) | | #if defined(ARMA_DONT_PRINT_RUNTIME_ERRORS) | |
| #undef ARMA_PRINT_RUNTIME_ERRORS | | #undef ARMA_PRINT_RUNTIME_ERRORS | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 19 lines changed or added | |
|
| op_strans_bones.hpp | | op_strans_bones.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-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 op_strans | | //! \addtogroup op_strans | |
| //! @{ | | //! @{ | |
| | | | |
|
| //! 'matrix transpose' operation | | //! 'matrix transpose' operation (simple transpose, ie. without taking the
conjugate of the elements) | |
| | | | |
| class op_strans | | class op_strans | |
| { | | { | |
| public: | | public: | |
| | | | |
| template<const bool do_flip, const uword row, const uword col> | | template<const bool do_flip, const uword row, const uword col> | |
| struct pos | | struct pos | |
| { | | { | |
| static const uword n2 = (do_flip == false) ? (row + col*2) : (col + row
*2); | | static const uword n2 = (do_flip == false) ? (row + col*2) : (col + row
*2); | |
| static const uword n3 = (do_flip == false) ? (row + col*3) : (col + row
*3); | | static const uword n3 = (do_flip == false) ? (row + col*3) : (col + row
*3); | |
| static const uword n4 = (do_flip == false) ? (row + col*4) : (col + row
*4); | | static const uword n4 = (do_flip == false) ? (row + col*4) : (col + row
*4); | |
| }; | | }; | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot inline static void apply_noalias_tinysq(Mat<eT>& out, const Mat< | | arma_hot inline static void apply_noalias_tinysq(Mat<eT>& out, const TA& | |
| eT>& A); | | A); | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A) | | arma_hot inline static void apply_noalias(Mat<eT>& out, const TA& A); | |
| ; | | | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot inline static void apply(Mat<eT>& out, const Mat<eT>& A); | | arma_hot inline static void apply(Mat<eT>& out, const TA& A); | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_hot inline static void apply_proxy(Mat<typename T1::elem_type>& out,
const T1& X); | | arma_hot inline static void apply_proxy(Mat<typename T1::elem_type>& out,
const T1& X); | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const
Op<T1,op_strans>& in); | | arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const
Op<T1,op_strans>& in); | |
| }; | | }; | |
| | | | |
| class op_strans2 | | class op_strans2 | |
| { | | { | |
| public: | | public: | |
| | | | |
| template<const bool do_flip, const uword row, const uword col> | | template<const bool do_flip, const uword row, const uword col> | |
| struct pos | | struct pos | |
| { | | { | |
| static const uword n2 = (do_flip == false) ? (row + col*2) : (col + row
*2); | | static const uword n2 = (do_flip == false) ? (row + col*2) : (col + row
*2); | |
| static const uword n3 = (do_flip == false) ? (row + col*3) : (col + row
*3); | | static const uword n3 = (do_flip == false) ? (row + col*3) : (col + row
*3); | |
| static const uword n4 = (do_flip == false) ? (row + col*4) : (col + row
*4); | | static const uword n4 = (do_flip == false) ? (row + col*4) : (col + row
*4); | |
| }; | | }; | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot inline static void apply_noalias_tinysq(Mat<eT>& out, const Mat< | | arma_hot inline static void apply_noalias_tinysq(Mat<eT>& out, const TA& | |
| eT>& A, const eT val); | | A, const eT val); | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A, | | arma_hot inline static void apply_noalias(Mat<eT>& out, const TA& A, cons | |
| const eT val); | | t eT val); | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot inline static void apply(Mat<eT>& out, const Mat<eT>& A, const e | | arma_hot inline static void apply(Mat<eT>& out, const TA& A, const eT val | |
| T val); | | ); | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| arma_hot inline static void apply_proxy(Mat<typename T1::elem_type>& out,
const T1& X, const typename T1::elem_type val); | | arma_hot inline static void apply_proxy(Mat<typename T1::elem_type>& out,
const T1& X, const typename T1::elem_type val); | |
|
| | | | |
| | | // NOTE: there is no direct handling of Op<T1,op_strans2>, as op_strans2: | |
| | | :apply_proxy() is currently only called by op_htrans2 for non-complex numbe | |
| | | rs | |
| }; | | }; | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 9 change blocks. |
| 20 lines changed or deleted | | 23 lines changed or added | |
|
| op_strans_meat.hpp | | op_strans_meat.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-2013 Conrad Sanderson | |
| // Copyright (C) 2012 Ryan Curtin | | // Copyright (C) 2012 Ryan Curtin | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup op_strans | | //! \addtogroup op_strans | |
| //! @{ | | //! @{ | |
| | | | |
| //! for tiny square matrices (size <= 4x4) | | //! for tiny square matrices (size <= 4x4) | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_strans::apply_noalias_tinysq(Mat<eT>& out, const Mat<eT>& A) | | op_strans::apply_noalias_tinysq(Mat<eT>& out, const TA& A) | |
| { | | { | |
|
| const eT* Am = A.memptr(); | | const eT* Am = A.memptr(); | |
| eT* outm = out.memptr(); | | eT* outm = out.memptr(); | |
| | | | |
| switch(A.n_rows) | | switch(A.n_rows) | |
| { | | { | |
| case 1: | | case 1: | |
| { | | { | |
| outm[0] = Am[0]; | | outm[0] = Am[0]; | |
| } | | } | |
| break; | | break; | |
| | | | |
| | | | |
| skipping to change at line 87 | | skipping to change at line 87 | |
| } | | } | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| ; | | ; | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| //! Immediate transpose of a dense matrix | | //! Immediate transpose of a dense matrix | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_strans::apply_noalias(Mat<eT>& out, const Mat<eT>& A) | | op_strans::apply_noalias(Mat<eT>& out, const TA& A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const uword A_n_cols = A.n_cols; | | const uword A_n_cols = A.n_cols; | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| out.set_size(A_n_cols, A_n_rows); | | out.set_size(A_n_cols, A_n_rows); | |
| | | | |
|
| if( (A_n_cols == 1) || (A_n_rows == 1) ) | | if( (TA::is_row) || (TA::is_col) || (A_n_cols == 1) || (A_n_rows == 1) ) | |
| { | | { | |
|
| arrayops::copy( out.memptr(), A.mem, A.n_elem ); | | arrayops::copy( out.memptr(), A.memptr(), A.n_elem ); | |
| } | | } | |
| else | | else | |
| { | | { | |
| if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) ) | | if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) ) | |
| { | | { | |
| op_strans::apply_noalias_tinysq(out, A); | | op_strans::apply_noalias_tinysq(out, A); | |
| } | | } | |
| else | | else | |
| { | | { | |
| for(uword k=0; k < A_n_cols; ++k) | | for(uword k=0; k < A_n_cols; ++k) | |
| | | | |
| skipping to change at line 136 | | skipping to change at line 136 | |
| | | | |
| if(i < A_n_rows) | | if(i < A_n_rows) | |
| { | | { | |
| out.at(k, i) = colptr[i]; | | out.at(k, i) = colptr[i]; | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_strans::apply(Mat<eT>& out, const Mat<eT>& A) | | op_strans::apply(Mat<eT>& out, const TA& A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| if(&out != &A) | | if(&out != &A) | |
| { | | { | |
| op_strans::apply_noalias(out, A); | | op_strans::apply_noalias(out, A); | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| const uword n_rows = out.n_rows; | | const uword n_rows = A.n_rows; | |
| const uword n_cols = out.n_cols; | | const uword n_cols = A.n_cols; | |
| | | | |
| if(n_rows == n_cols) | | if(n_rows == n_cols) | |
| { | | { | |
| arma_extra_debug_print("op_strans::apply(): doing in-place transpose
of a square matrix"); | | arma_extra_debug_print("op_strans::apply(): doing in-place transpose
of a square matrix"); | |
| | | | |
| const uword N = n_rows; | | const uword N = n_rows; | |
| | | | |
| for(uword k=0; k < N; ++k) | | for(uword k=0; k < N; ++k) | |
| { | | { | |
| eT* colptr = out.colptr(k); | | eT* colptr = out.colptr(k); | |
| | | | |
| skipping to change at line 337 | | skipping to change at line 337 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| op_strans::apply_proxy(out, in.m); | | op_strans::apply_proxy(out, in.m); | |
| } | | } | |
| | | | |
| // | | // | |
| // op_strans2 | | // op_strans2 | |
| | | | |
| //! for tiny square matrices (size <= 4x4) | | //! for tiny square matrices (size <= 4x4) | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_strans2::apply_noalias_tinysq(Mat<eT>& out, const Mat<eT>& A, const eT v
al) | | op_strans2::apply_noalias_tinysq(Mat<eT>& out, const TA& A, const eT val) | |
| { | | { | |
|
| const eT* Am = A.memptr(); | | const eT* Am = A.memptr(); | |
| eT* outm = out.memptr(); | | eT* outm = out.memptr(); | |
| | | | |
| switch(A.n_rows) | | switch(A.n_rows) | |
| { | | { | |
| case 1: | | case 1: | |
| { | | { | |
| outm[0] = val * Am[0]; | | outm[0] = val * Am[0]; | |
| } | | } | |
| break; | | break; | |
| | | | |
| | | | |
| skipping to change at line 410 | | skipping to change at line 410 | |
| outm[pos<false,3,3>::n4] = val * Am[pos<true,3,3>::n4]; | | outm[pos<false,3,3>::n4] = val * Am[pos<true,3,3>::n4]; | |
| } | | } | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| ; | | ; | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_strans2::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const eT val) | | op_strans2::apply_noalias(Mat<eT>& out, const TA& A, const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const uword A_n_cols = A.n_cols; | | const uword A_n_cols = A.n_cols; | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| out.set_size(A_n_cols, A_n_rows); | | out.set_size(A_n_cols, A_n_rows); | |
| | | | |
|
| if( (A_n_cols == 1) || (A_n_rows == 1) ) | | if( (TA::is_col) || (TA::is_row) || (A_n_cols == 1) || (A_n_rows == 1) ) | |
| { | | { | |
| const uword N = A.n_elem; | | const uword N = A.n_elem; | |
| | | | |
|
| const eT* A_mem = A.memptr(); | | const eT* A_mem = A.memptr(); | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| 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) | |
| { | | { | |
| const eT tmp_i = A_mem[i]; | | const eT tmp_i = A_mem[i]; | |
| const eT tmp_j = A_mem[j]; | | const eT tmp_j = A_mem[j]; | |
| | | | |
| out_mem[i] = val * tmp_i; | | out_mem[i] = val * tmp_i; | |
| out_mem[j] = val * tmp_j; | | out_mem[j] = val * tmp_j; | |
| | | | |
| skipping to change at line 477 | | skipping to change at line 477 | |
| | | | |
| if(i < A_n_rows) | | if(i < A_n_rows) | |
| { | | { | |
| out.at(k, i) = val * colptr[i]; | | out.at(k, i) = val * colptr[i]; | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
|
| template<typename eT> | | template<typename eT, typename TA> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
|
| op_strans2::apply(Mat<eT>& out, const Mat<eT>& A, const eT val) | | op_strans2::apply(Mat<eT>& out, const TA& A, const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| if(&out != &A) | | if(&out != &A) | |
| { | | { | |
| op_strans2::apply_noalias(out, A, val); | | op_strans2::apply_noalias(out, A, val); | |
| } | | } | |
| else | | else | |
| { | | { | |
| const uword n_rows = out.n_rows; | | const uword n_rows = out.n_rows; | |
| | | | |
End of changes. 20 change blocks. |
| 22 lines changed or deleted | | 22 lines changed or added | |
|
| op_sum_meat.hpp | | op_sum_meat.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-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 op_sum | | //! \addtogroup op_sum | |
| //! @{ | | //! @{ | |
| | | | |
| //! \brief | | //! \brief | |
| //! Immediate sum of elements of a matrix along a specified dimension (eith
er rows or columns). | | //! Immediate sum of elements of a matrix along a specified dimension (eith
er rows or columns). | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
| | | | |
| const uword dim = in.aux_uword_a; | | const uword dim = in.aux_uword_a; | |
| arma_debug_check( (dim > 1), "sum(): incorrect usage. dim must be 0 or 1"
); | | arma_debug_check( (dim > 1), "sum(): incorrect usage. dim must be 0 or 1"
); | |
| | | | |
| const Proxy<T1> P(in.m); | | const Proxy<T1> P(in.m); | |
| | | | |
|
| | | typedef typename Proxy<T1>::stored_type P_stored_type; | |
| | | | |
| const bool is_alias = P.is_alias(out); | | const bool is_alias = P.is_alias(out); | |
| | | | |
|
| if( (is_Mat< typename Proxy<T1>::stored_type>::value == true) || is_alias
) | | if( (is_Mat<P_stored_type>::value == true) || is_alias ) | |
| { | | { | |
|
| const unwrap_check< typename Proxy<T1>::stored_type > tmp(P.Q, is_alias
); | | const unwrap_check<P_stored_type> tmp(P.Q, is_alias); | |
| | | | |
|
| const Mat<eT>& X = tmp.M; | | const typename unwrap_check<P_stored_type>::stored_type& X = tmp.M; | |
| | | | |
| const uword X_n_rows = X.n_rows; | | const uword X_n_rows = X.n_rows; | |
| const uword X_n_cols = X.n_cols; | | const uword X_n_cols = X.n_cols; | |
| | | | |
| if(dim == 0) // traverse across rows (i.e. find the sum in each column
) | | if(dim == 0) // traverse across rows (i.e. find the sum in each column
) | |
| { | | { | |
| out.set_size(1, X_n_cols); | | out.set_size(1, X_n_cols); | |
| | | | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 7 lines changed or added | |
|
| unwrap.hpp | | unwrap.hpp | |
| | | | |
| skipping to change at line 325 | | skipping to change at line 325 | |
| }; | | }; | |
| | | | |
| // | | // | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct unwrap_check_default | | struct unwrap_check_default | |
| { | | { | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
|
| | | typedef Mat<eT> stored_type; | |
| | | | |
| inline | | inline | |
| unwrap_check_default(const T1& A, const Mat<eT>&) | | unwrap_check_default(const T1& A, const Mat<eT>&) | |
| : M(A) | | : M(A) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| inline | | inline | |
| unwrap_check_default(const T1& A, const bool) | | unwrap_check_default(const T1& A, const bool) | |
| | | | |
| skipping to change at line 347 | | skipping to change at line 348 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| const Mat<eT> M; | | const Mat<eT> M; | |
| }; | | }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct unwrap_check_fixed | | struct unwrap_check_fixed | |
| { | | { | |
| typedef typename T1::elem_type eT; | | typedef typename T1::elem_type eT; | |
|
| | | typedef T1 stored_type; | |
| | | | |
| inline | | inline | |
| unwrap_check_fixed(const T1& A, const Mat<eT>& B) | | unwrap_check_fixed(const T1& A, const Mat<eT>& B) | |
|
| : M_local( (&A == &B) ? new Mat<eT>(A) : 0 ) | | : M_local( (&A == &B) ? new T1(A) : 0 ) | |
| , M ( (&A == &B) ? *M_local : A ) | | , M ( (&A == &B) ? *M_local : A ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| inline | | inline | |
| unwrap_check_fixed(const T1& A, const bool is_alias) | | unwrap_check_fixed(const T1& A, const bool is_alias) | |
|
| : M_local( is_alias ? new Mat<eT>(A) : 0 ) | | : M_local( is_alias ? new T1(A) : 0 ) | |
| , M ( is_alias ? *M_local : A ) | | , M ( is_alias ? *M_local : A ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| inline | | inline | |
| ~unwrap_check_fixed() | | ~unwrap_check_fixed() | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| if(M_local) { delete M_local; } | | if(M_local) { delete M_local; } | |
| } | | } | |
| | | | |
| // the order below is important | | // the order below is important | |
|
| const Mat<eT>* M_local; | | const T1* M_local; | |
| const Mat<eT>& M; | | const T1& M; | |
| }; | | }; | |
| | | | |
| template<typename T1, bool condition> | | template<typename T1, bool condition> | |
| struct unwrap_check_redirect {}; | | struct unwrap_check_redirect {}; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct unwrap_check_redirect<T1, false> { typedef unwrap_check_default<T1>
result; }; | | struct unwrap_check_redirect<T1, false> { typedef unwrap_check_default<T1>
result; }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct unwrap_check_redirect<T1, true> { typedef unwrap_check_fixed<T1>
result; }; | | struct unwrap_check_redirect<T1, true> { typedef unwrap_check_fixed<T1>
result; }; | |
| | | | |
| skipping to change at line 403 | | skipping to change at line 405 | |
| | | | |
| inline unwrap_check(const T1& A, const bool is_alias) | | inline unwrap_check(const T1& A, const bool is_alias) | |
| : unwrap_check_redirect< T1, is_Mat_fixed<T1>::value >::result(A, is_al
ias) | | : unwrap_check_redirect< T1, is_Mat_fixed<T1>::value >::result(A, is_al
ias) | |
| { | | { | |
| } | | } | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct unwrap_check< Mat<eT> > | | struct unwrap_check< Mat<eT> > | |
| { | | { | |
|
| | | typedef Mat<eT> stored_type; | |
| | | | |
| inline | | inline | |
| unwrap_check(const Mat<eT>& A, const Mat<eT>& B) | | unwrap_check(const Mat<eT>& A, const Mat<eT>& B) | |
| : M_local( (&A == &B) ? new Mat<eT>(A) : 0 ) | | : M_local( (&A == &B) ? new Mat<eT>(A) : 0 ) | |
| , M ( (&A == &B) ? (*M_local) : A ) | | , M ( (&A == &B) ? (*M_local) : A ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| unwrap_check(const Mat<eT>& A, const bool is_alias) | | unwrap_check(const Mat<eT>& A, const bool is_alias) | |
| : M_local( is_alias ? new Mat<eT>(A) : 0 ) | | : M_local( is_alias ? new Mat<eT>(A) : 0 ) | |
| | | | |
| skipping to change at line 434 | | skipping to change at line 438 | |
| } | | } | |
| | | | |
| // the order below is important | | // the order below is important | |
| const Mat<eT>* M_local; | | const Mat<eT>* M_local; | |
| const Mat<eT>& M; | | const Mat<eT>& M; | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct unwrap_check< Row<eT> > | | struct unwrap_check< Row<eT> > | |
| { | | { | |
|
| | | typedef Row<eT> stored_type; | |
| | | | |
| inline | | inline | |
| unwrap_check(const Row<eT>& A, const Mat<eT>& B) | | unwrap_check(const Row<eT>& A, const Mat<eT>& B) | |
| : M_local( (&A == &B) ? new Row<eT>(A) : 0 ) | | : M_local( (&A == &B) ? new Row<eT>(A) : 0 ) | |
| , M ( (&A == &B) ? (*M_local) : A ) | | , M ( (&A == &B) ? (*M_local) : A ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| unwrap_check(const Row<eT>& A, const bool is_alias) | | unwrap_check(const Row<eT>& A, const bool is_alias) | |
| : M_local( is_alias ? new Row<eT>(A) : 0 ) | | : M_local( is_alias ? new Row<eT>(A) : 0 ) | |
| | | | |
| skipping to change at line 465 | | skipping to change at line 471 | |
| } | | } | |
| | | | |
| // the order below is important | | // the order below is important | |
| const Row<eT>* M_local; | | const Row<eT>* M_local; | |
| const Row<eT>& M; | | const Row<eT>& M; | |
| }; | | }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct unwrap_check< Col<eT> > | | struct unwrap_check< Col<eT> > | |
| { | | { | |
|
| | | typedef Col<eT> stored_type; | |
| | | | |
| inline | | inline | |
| unwrap_check(const Col<eT>& A, const Mat<eT>& B) | | unwrap_check(const Col<eT>& A, const Mat<eT>& B) | |
| : M_local( (&A == &B) ? new Col<eT>(A) : 0 ) | | : M_local( (&A == &B) ? new Col<eT>(A) : 0 ) | |
| , M ( (&A == &B) ? (*M_local) : A ) | | , M ( (&A == &B) ? (*M_local) : A ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| } | | } | |
| | | | |
| unwrap_check(const Col<eT>& A, const bool is_alias) | | unwrap_check(const Col<eT>& A, const bool is_alias) | |
| : M_local( is_alias ? new Col<eT>(A) : 0 ) | | : M_local( is_alias ? new Col<eT>(A) : 0 ) | |
| | | | |
End of changes. 8 change blocks. |
| 6 lines changed or deleted | | 14 lines changed or added | |
|