commit armadillo for openSUSE:Factory
Hello community, here is the log from the commit of package armadillo for openSUSE:Factory checked in at 2014-11-24 11:09:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/armadillo (Old) and /work/SRC/openSUSE:Factory/.armadillo.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "armadillo" Changes: -------- --- /work/SRC/openSUSE:Factory/armadillo/armadillo.changes 2014-11-19 20:30:58.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.armadillo.new/armadillo.changes 2014-11-24 11:10:19.000000000 +0100 @@ -1,0 +2,10 @@ +Thu Nov 20 19:12:24 UTC 2014 - badshah400@gmail.com + +- Update to version 4.550 (Singapore Sling Deluxe): + + Added matrix exponential function: expmat() + + Faster .log_p() and .avg_log_p() functions in the gmm_diag + class when compiling with OpenMP enabled + + Faster handling of in-place addition/subtraction of + expressions with an outer product. + +------------------------------------------------------------------- Old: ---- armadillo-4.500.1.tar.gz New: ---- armadillo-4.550.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ armadillo.spec ++++++ --- /var/tmp/diff_new_pack.If0TFj/_old 2014-11-24 11:10:20.000000000 +0100 +++ /var/tmp/diff_new_pack.If0TFj/_new 2014-11-24 11:10:20.000000000 +0100 @@ -19,7 +19,7 @@ %define soname libarmadillo4 Name: armadillo -Version: 4.500.1 +Version: 4.550.0 Release: 0 Summary: Fast C++ matrix library with interfaces to LAPACK and ATLAS License: MPL-2.0 ++++++ armadillo-4.500.1.tar.gz -> armadillo-4.550.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/CMakeLists.txt new/armadillo-4.550.0/CMakeLists.txt --- old/armadillo-4.500.1/CMakeLists.txt 2014-11-17 09:41:54.000000000 +0100 +++ new/armadillo-4.550.0/CMakeLists.txt 2014-11-21 05:52:24.000000000 +0100 @@ -13,8 +13,8 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR) set(ARMA_MAJOR 4) -set(ARMA_MINOR 500) -set(ARMA_PATCH 1) +set(ARMA_MINOR 550) +set(ARMA_PATCH 0) set(ARMADILLO_VERSION ${ARMA_MAJOR}.${ARMA_MINOR}.${ARMA_PATCH}) message(STATUS "Configuring Armadillo ${ARMADILLO_VERSION}") @@ -95,10 +95,12 @@ set(ARMA_USE_LAPACK true) message(STATUS "") - message(STATUS "*** If the MKL or ACML libraries are installed in") - message(STATUS "*** /opt or /usr/local, make sure the run-time linker can find them.") + message(STATUS "*** If the MKL or ACML libraries are installed in non-standard locations such as") + message(STATUS "*** /opt/intel/mkl, /opt/intel/composerxe/, /usr/local/intel/mkl") + message(STATUS "*** make sure the run-time linker can find them.") message(STATUS "*** On Linux systems this can be done by editing /etc/ld.so.conf") message(STATUS "*** or modifying the LD_LIBRARY_PATH environment variable.") + message(STATUS "") message(STATUS "*** On systems with SELinux enabled (eg. Fedora, RHEL),") message(STATUS "*** you may need to change the SELinux type of all MKL/ACML libraries") message(STATUS "*** to fix permission problems that may occur during run-time.") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/README.txt new/armadillo-4.550.0/README.txt --- old/armadillo-4.500.1/README.txt 2014-11-17 09:50:18.000000000 +0100 +++ new/armadillo-4.550.0/README.txt 2014-11-17 09:50:18.000000000 +0100 @@ -187,7 +187,7 @@ If you want to use Armadillo without installation, or you're getting linking errors, compile along these lines: - g++ example1.cpp -o example1 -O2 -I /home/blah/armadillo-4.500.1/include -DARMA_DONT_USE_WRAPPER -lblas -llapack + g++ example1.cpp -o example1 -O2 -I /home/blah/armadillo-4.550.0/include -DARMA_DONT_USE_WRAPPER -lblas -llapack The above command line assumes that you have unpacked the armadillo archive into /home/blah/ You will need to adjust this for later versions of Armadillo, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/cmake_aux/Modules/ARMA_FindMKL.cmake new/armadillo-4.550.0/cmake_aux/Modules/ARMA_FindMKL.cmake --- old/armadillo-4.500.1/cmake_aux/Modules/ARMA_FindMKL.cmake 2013-04-18 06:50:43.000000000 +0200 +++ new/armadillo-4.550.0/cmake_aux/Modules/ARMA_FindMKL.cmake 2014-11-18 09:53:49.000000000 +0100 @@ -3,47 +3,130 @@ # MKL_LIBRARIES, the libraries needed to use Intel's implementation of BLAS & LAPACK. # MKL_FOUND, If false, do not try to use MKL. -SET(MKL_NAMES ${MKL_NAMES} mkl_lapack) -SET(MKL_NAMES ${MKL_NAMES} mkl_intel_thread) -SET(MKL_NAMES ${MKL_NAMES} mkl_core) -SET(MKL_NAMES ${MKL_NAMES} guide) -SET(MKL_NAMES ${MKL_NAMES} mkl) -SET(MKL_NAMES ${MKL_NAMES} iomp5) -#SET(MKL_NAMES ${MKL_NAMES} pthread) - -IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(MKL_NAMES ${MKL_NAMES} mkl_intel_lp64) -ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(MKL_NAMES ${MKL_NAMES} mkl_intel) -ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) +set(MKL_NAMES ${MKL_NAMES} mkl_lapack) +set(MKL_NAMES ${MKL_NAMES} mkl_intel_thread) +set(MKL_NAMES ${MKL_NAMES} mkl_core) +set(MKL_NAMES ${MKL_NAMES} guide) +set(MKL_NAMES ${MKL_NAMES} mkl) +set(MKL_NAMES ${MKL_NAMES} iomp5) +#set(MKL_NAMES ${MKL_NAMES} pthread) + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(MKL_NAMES ${MKL_NAMES} mkl_intel_lp64) + set(MKL_ARCH intel64) +else() + set(MKL_NAMES ${MKL_NAMES} mkl_intel) + set(MKL_ARCH ia32) +endif() + +set(MKL_ROOT $ENV{MKLROOT} CACHE TYPE STRING) + +if(NOT MKL_ROOT) + set(MKL_ROOT "/opt/intel/mkl") +endif() -FOREACH (MKL_NAME ${MKL_NAMES}) - FIND_LIBRARY(${MKL_NAME}_LIBRARY + +foreach (MKL_NAME ${MKL_NAMES}) + find_library(${MKL_NAME}_LIBRARY NAMES ${MKL_NAME} - PATHS /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/intel/lib/intel64 /opt/intel/lib/ia32 /opt/intel/mkl/lib/lib64 /opt/intel/mkl/lib/intel64 /opt/intel/mkl/lib/ia32 /opt/intel/mkl/lib /opt/intel/*/mkl/lib/intel64 /opt/intel/*/mkl/lib/ia32/ /opt/mkl/*/lib/em64t /opt/mkl/*/lib/32 /opt/intel/mkl/*/lib/em64t /opt/intel/mkl/*/lib/32 + PATHS + ${CMAKE_SYSTEM_LIBRARY_PATH} + ${MKL_ROOT}/lib/${MKL_ARCH} + /usr/lib64 + /usr/lib + /usr/local/lib64 + /usr/local/lib + /opt/intel/composerxe/lib/intel64 + /opt/intel/composerxe/lib/ia32 + /opt/intel/composerxe/lib/mkl/lib/intel64 + /opt/intel/composerxe/lib/mkl/lib/ia32 + /usr/local/intel/composerxe/lib/intel64 + /usr/local/intel/composerxe/lib/ia32 + /usr/local/intel/composerxe/lib/mkl/lib/intel64 + /usr/local/intel/composerxe/lib/mkl/lib/ia32 + /opt/intel/lib + /opt/intel/lib/intel64 + /opt/intel/lib/em64t + /opt/intel/lib/lib64 + /opt/intel/lib/ia32 + /opt/intel/mkl/lib + /opt/intel/mkl/lib/intel64 + /opt/intel/mkl/lib/em64t + /opt/intel/mkl/lib/lib64 + /opt/intel/mkl/lib/ia32 + /opt/intel/mkl/*/lib + /opt/intel/mkl/*/lib/intel64 + /opt/intel/mkl/*/lib/em64t + /opt/intel/mkl/*/lib/lib64 + /opt/intel/mkl/*/lib/32 + /opt/intel/*/mkl/lib + /opt/intel/*/mkl/lib/intel64 + /opt/intel/*/mkl/lib/em64t + /opt/intel/*/mkl/lib/lib64 + /opt/intel/*/mkl/lib/ia32 + /opt/mkl/lib + /opt/mkl/lib/intel64 + /opt/mkl/lib/em64t + /opt/mkl/lib/lib64 + /opt/mkl/lib/ia32 + /opt/mkl/*/lib + /opt/mkl/*/lib/intel64 + /opt/mkl/*/lib/em64t + /opt/mkl/*/lib/lib64 + /opt/mkl/*/lib/32 + /usr/local/intel/lib + /usr/local/intel/lib/intel64 + /usr/local/intel/lib/em64t + /usr/local/intel/lib/lib64 + /usr/local/intel/lib/ia32 + /usr/local/intel/mkl/lib + /usr/local/intel/mkl/lib/intel64 + /usr/local/intel/mkl/lib/em64t + /usr/local/intel/mkl/lib/lib64 + /usr/local/intel/mkl/lib/ia32 + /usr/local/intel/mkl/*/lib + /usr/local/intel/mkl/*/lib/intel64 + /usr/local/intel/mkl/*/lib/em64t + /usr/local/intel/mkl/*/lib/lib64 + /usr/local/intel/mkl/*/lib/32 + /usr/local/intel/*/mkl/lib + /usr/local/intel/*/mkl/lib/intel64 + /usr/local/intel/*/mkl/lib/em64t + /usr/local/intel/*/mkl/lib/lib64 + /usr/local/intel/*/mkl/lib/ia32 + /usr/local/mkl/lib + /usr/local/mkl/lib/intel64 + /usr/local/mkl/lib/em64t + /usr/local/mkl/lib/lib64 + /usr/local/mkl/lib/ia32 + /usr/local/mkl/*/lib + /usr/local/mkl/*/lib/intel64 + /usr/local/mkl/*/lib/em64t + /usr/local/mkl/*/lib/lib64 + /usr/local/mkl/*/lib/32 ) - SET(TMP_LIBRARY ${${MKL_NAME}_LIBRARY}) + set(TMP_LIBRARY ${${MKL_NAME}_LIBRARY}) - IF(TMP_LIBRARY) - SET(MKL_LIBRARIES ${MKL_LIBRARIES} ${TMP_LIBRARY}) - ENDIF(TMP_LIBRARY) -ENDFOREACH(MKL_NAME) - -IF (MKL_LIBRARIES) - SET(MKL_FOUND "YES") -ELSE (MKL_LIBRARIES) - SET(MKL_FOUND "NO") -ENDIF (MKL_LIBRARIES) - -IF (MKL_FOUND) - IF (NOT MKL_FIND_QUIETLY) - MESSAGE(STATUS "Found MKL libraries: ${MKL_LIBRARIES}") - ENDIF (NOT MKL_FIND_QUIETLY) -ELSE (MKL_FOUND) - IF (MKL_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find MKL libraries") - ENDIF (MKL_FIND_REQUIRED) -ENDIF (MKL_FOUND) + if(TMP_LIBRARY) + set(MKL_LIBRARIES ${MKL_LIBRARIES} ${TMP_LIBRARY}) + endif() +endforeach() + +if(MKL_LIBRARIES) + set(MKL_FOUND "YES") +else() + set(MKL_FOUND "NO") +endif() + +if(MKL_FOUND) + if(NOT MKL_FIND_QUIETLY) + message(STATUS "Found MKL libraries: ${MKL_LIBRARIES}") + endif() +else() + if(MKL_FIND_REQUIRED) + message(FATAL_ERROR "Could not find MKL libraries") + endif() +endif() -# MARK_AS_ADVANCED(MKL_LIBRARY) +# mark_as_advanced(MKL_LIBRARY) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/docs.html new/armadillo-4.550.0/docs.html --- old/armadillo-4.500.1/docs.html 2014-10-30 05:32:38.000000000 +0100 +++ new/armadillo-4.550.0/docs.html 2014-11-21 05:52:24.000000000 +0100 @@ -101,8 +101,10 @@ </head> <body> + <a name="top"></a> -<a style="display:scroll; position:fixed; bottom:5px; right:5px;" href="#top"><font size=-1>[top]</font></a> +<!-- --> +<a style="display:scroll; position:fixed; bottom:5px; right:5px;" href="#top"><font size=-1>[top]</font></a> <center> <table style="text-align: left; width: 80%; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0"> @@ -114,7 +116,7 @@ <tbody> <tr> <td style="text-align: left; vertical-align: top;"> - <font size=+2><b>Reference for Armadillo 4.500</b></font> + <font size=+2><b>Reference for Armadillo 4.550</b></font> <br> </td> <td style="text-align: right; vertical-align: top;"> @@ -314,6 +316,7 @@ <a href="#cross">cross</a> · <a href="#cumsum">cumsum</a> · <a href="#diagmat">diagmat</a> · +<a href="#expmat">expmat</a> · <a href="#find">find</a> · <a href="#find_finite">find_finite</a> · <a href="#find_nonfinite">find_nonfinite</a> · @@ -6457,6 +6460,7 @@ <li><a href="#clamp">clamp()</a></li> <li><a href="#conj">conj()</a></li> <li><a href="#imag_real">imag() / real()</a></li> +<li><a href="#expmat">expmat()</a></li> <li><a href="#constants">pre-defined constants</a></li> </ul> </li> @@ -7752,6 +7756,40 @@ <hr class="greyline"> <br> +<a name="expmat"></a> +<b>expmat( X )</b> +<ul> +<li>Return the matrix exponential of square matrix <i>X</i></li> +<br> +<li>If <i>X</i> is not square, a <i>std::logic_error</i> exception is thrown</li> +<br> +<li><b>Caveat</b>: the matrix exponential operation is <b>not</b> the same as applying the <a href="#misc_fns">exp()</a> function to each element +</li> +<br> +<li> +Examples: +<ul> +<pre> +mat A = randu<mat>(5,5); + +mat B = expmat(A); +</pre> +</ul> +</li> +<br> +<li> +See also: +<ul> +<li><a href="#misc_fns">element-wise functions</a></li> +<li><a href="http://en.wikipedia.org/wiki/Matrix_exponential">matrix exponential in Wikipedia</a></li> +<li><a href="http://mathworld.wolfram.com/MatrixExponential.html">matrix exponential in MathWorld</a></li> +</ul> +</li> +<br> +</ul> +<hr class="greyline"> +<br> + <a name="find"></a> <b>find( X )</b> <br><b>find( X, k )</b> @@ -13317,6 +13355,15 @@ <br> <ul> +<a name="added_in_4550"></a> +<li>Added in 4.550: +<ul> +<li>added matrix exponential function: <a href="#expmat">expmat()</a></li> +<li>faster <i>.log_p()</i> and <i>.avg_log_p()</i> functions in the <a href="#gmm_diag">gmm_diag</a> class when compiling with OpenMP enabled</li> +<li>faster handling of in-place addition/subtraction of expressions with an outer product +</ul> +</li> +<br> <a name="added_in_4500"></a> <li>Added in 4.500: <ul> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo new/armadillo-4.550.0/include/armadillo --- old/armadillo-4.500.1/include/armadillo 2014-10-19 17:34:05.000000000 +0200 +++ new/armadillo-4.550.0/include/armadillo 2014-11-19 02:26:01.000000000 +0100 @@ -242,6 +242,7 @@ #include "armadillo_bits/op_all_bones.hpp" #include "armadillo_bits/op_normalise_bones.hpp" #include "armadillo_bits/op_clamp_bones.hpp" + #include "armadillo_bits/op_expmat_bones.hpp" #include "armadillo_bits/glue_times_bones.hpp" #include "armadillo_bits/glue_mixed_bones.hpp" @@ -442,6 +443,7 @@ #include "armadillo_bits/fn_cond.hpp" #include "armadillo_bits/fn_normalise.hpp" #include "armadillo_bits/fn_clamp.hpp" + #include "armadillo_bits/fn_expmat.hpp" #include "armadillo_bits/fn_speye.hpp" #include "armadillo_bits/fn_spones.hpp" @@ -557,6 +559,7 @@ #include "armadillo_bits/op_all_meat.hpp" #include "armadillo_bits/op_normalise_meat.hpp" #include "armadillo_bits/op_clamp_meat.hpp" + #include "armadillo_bits/op_expmat_meat.hpp" #include "armadillo_bits/glue_times_meat.hpp" #include "armadillo_bits/glue_mixed_meat.hpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/Proxy.hpp new/armadillo-4.550.0/include/armadillo_bits/Proxy.hpp --- old/armadillo-4.500.1/include/armadillo_bits/Proxy.hpp 2014-09-02 09:32:08.000000000 +0200 +++ new/armadillo-4.550.0/include/armadillo_bits/Proxy.hpp 2014-11-18 05:16:24.000000000 +0100 @@ -1318,6 +1318,54 @@ +template<typename T1> +class Proxy< Op<T1, op_vectorise_cube_col> > + { + public: + + typedef typename T1::elem_type elem_type; + typedef typename get_pod_type<elem_type>::result pod_type; + typedef Mat<elem_type> stored_type; + typedef const elem_type* ea_type; + typedef const Mat<elem_type>& aligned_ea_type; + + static const bool prefer_at_accessor = false; + static const bool has_subview = true; + static const bool is_fixed = false; + static const bool fake_mat = true; + + static const bool is_row = false; + static const bool is_col = true; + + arma_aligned const unwrap_cube<T1> U; + arma_aligned const Mat<elem_type> Q; + + inline explicit Proxy(const Op<T1, op_vectorise_cube_col>& A) + : U(A.m) + , Q(const_cast<elem_type*>(U.M.memptr()), U.M.n_elem, 1, false, false) + { + arma_extra_debug_sigprint(); + } + + 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_elem() const { return Q.n_elem; } + + arma_inline elem_type operator[] (const uword i) const { return Q[i]; } + arma_inline elem_type at (const uword row, const uword) const { return Q[row]; } + arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } + + arma_inline ea_type get_ea() const { return Q.memptr(); } + arma_inline aligned_ea_type get_aligned_ea() const { return Q; } + + template<typename eT2> + arma_inline bool is_alias(const Mat<eT2>&) const { return false; } + + arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } + }; + + + template<typename T1, typename T2, typename glue_type> class Proxy< Glue<T1, T2, glue_type> > { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/arma_version.hpp new/armadillo-4.550.0/include/armadillo_bits/arma_version.hpp --- old/armadillo-4.500.1/include/armadillo_bits/arma_version.hpp 2014-11-17 09:41:54.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/arma_version.hpp 2014-11-21 05:52:24.000000000 +0100 @@ -12,9 +12,9 @@ #define ARMA_VERSION_MAJOR 4 -#define ARMA_VERSION_MINOR 500 -#define ARMA_VERSION_PATCH 1 -#define ARMA_VERSION_NAME "Singapore Sling" +#define ARMA_VERSION_MINOR 550 +#define ARMA_VERSION_PATCH 0 +#define ARMA_VERSION_NAME "Singapore Sling Deluxe" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/config.hpp new/armadillo-4.550.0/include/armadillo_bits/config.hpp --- old/armadillo-4.500.1/include/armadillo_bits/config.hpp 2014-11-02 02:47:17.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/config.hpp 2014-11-18 04:30:56.000000000 +0100 @@ -31,7 +31,7 @@ // #define ARMA_USE_WRAPPER //// Comment out the above line if you're getting linking errors when compiling your programs, -//// or if you prefer to directly link with LAPACK, BLAS or ARPACK. +//// or if you prefer to directly link with LAPACK, BLAS or ARPACK instead of the Armadillo runtime library. //// You will then need to link your programs directly with -llapack -lblas instead of -larmadillo // #define ARMA_BLAS_CAPITALS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/config.hpp.cmake new/armadillo-4.550.0/include/armadillo_bits/config.hpp.cmake --- old/armadillo-4.500.1/include/armadillo_bits/config.hpp.cmake 2014-11-02 02:47:17.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/config.hpp.cmake 2014-11-18 04:30:56.000000000 +0100 @@ -31,7 +31,7 @@ #cmakedefine ARMA_USE_WRAPPER //// Comment out the above line if you're getting linking errors when compiling your programs, -//// or if you prefer to directly link with LAPACK, BLAS or ARPACK. +//// or if you prefer to directly link with LAPACK, BLAS or ARPACK instead of the Armadillo runtime library. //// You will then need to link your programs directly with -llapack -lblas instead of -larmadillo // #define ARMA_BLAS_CAPITALS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/fn_expmat.hpp new/armadillo-4.550.0/include/armadillo_bits/fn_expmat.hpp --- old/armadillo-4.500.1/include/armadillo_bits/fn_expmat.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/fn_expmat.hpp 2014-11-19 06:36:59.000000000 +0100 @@ -0,0 +1,23 @@ +// Copyright (C) 2014 Conrad Sanderson +// Copyright (C) 2014 NICTA (www.nicta.com.au) +// +// 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 +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + +template<typename T1> +inline +typename +enable_if2 + < + is_real<typename T1::pod_type>::value, + const Op<T1,op_expmat> + >::result +expmat(const Base<typename T1::elem_type,T1>& A) + { + arma_extra_debug_sigprint(); + + return Op<T1,op_expmat>( A.get_ref() ); + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/fn_vectorise.hpp new/armadillo-4.550.0/include/armadillo_bits/fn_vectorise.hpp --- old/armadillo-4.500.1/include/armadillo_bits/fn_vectorise.hpp 2013-08-01 10:47:00.000000000 +0200 +++ new/armadillo-4.550.0/include/armadillo_bits/fn_vectorise.hpp 2014-11-18 05:16:24.000000000 +0100 @@ -1,5 +1,5 @@ -// Copyright (C) 2013 Conrad Sanderson -// Copyright (C) 2013 NICTA (www.nicta.com.au) +// Copyright (C) 2013-2014 Conrad Sanderson +// Copyright (C) 2013-2014 NICTA (www.nicta.com.au) // // 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 @@ -46,5 +46,18 @@ } + +//! experimental: vectorisation of cubes +template<typename T1> +inline +const Op<T1, op_vectorise_cube_col> +vectorise(const BaseCube<typename T1::elem_type, T1>& X) + { + arma_extra_debug_sigprint(); + + return Op<T1, op_vectorise_cube_col>(X.get_ref()); + } + + //! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/glue_times_meat.hpp new/armadillo-4.550.0/include/armadillo_bits/glue_times_meat.hpp --- old/armadillo-4.500.1/include/armadillo_bits/glue_times_meat.hpp 2014-05-02 08:05:11.000000000 +0200 +++ new/armadillo-4.550.0/include/armadillo_bits/glue_times_meat.hpp 2014-11-07 05:25:21.000000000 +0100 @@ -473,6 +473,17 @@ typedef typename T1::elem_type eT; typedef typename get_pod_type<eT>::result T; + if( (is_outer_product<T1>::value) || (has_op_inv<T1>::value) || (has_op_inv<T2>::value) ) + { + // partial workaround for corner cases + + const Mat<eT> tmp(X); + + if(sign > sword(0)) { out += tmp; } else { out -= tmp; } + + return; + } + const partial_unwrap_check<T1> tmp1(X.A, out); const partial_unwrap_check<T2> tmp2(X.B, out); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/gmm_diag_bones.hpp new/armadillo-4.550.0/include/armadillo_bits/gmm_diag_bones.hpp --- old/armadillo-4.500.1/include/armadillo_bits/gmm_diag_bones.hpp 2014-09-01 03:14:30.000000000 +0200 +++ new/armadillo-4.550.0/include/armadillo_bits/gmm_diag_bones.hpp 2014-11-21 11:57:06.000000000 +0100 @@ -48,15 +48,17 @@ #if defined(_OPENMP) struct arma_omp_state { - const int dynamic_state; + const int orig_dynamic_state; - inline arma_omp_state() : dynamic_state(omp_get_dynamic()) {} - inline ~arma_omp_state() { omp_set_dynamic(dynamic_state); } + inline arma_omp_state() : orig_dynamic_state(omp_get_dynamic()) { omp_set_dynamic(0); } + inline ~arma_omp_state() { omp_set_dynamic(orig_dynamic_state); } }; - +#else + struct arma_omp_state {}; #endif + template<typename eT> class gmm_diag { @@ -142,7 +144,9 @@ inline void init(const uword in_n_dim, const uword in_n_gaus); inline void init_constants(); - + + inline umat internal_gen_boundaries(const uword N) const; + inline eT internal_scalar_log_p(const eT* x ) const; inline eT internal_scalar_log_p(const eT* x, const uword gaus_id) const; @@ -172,9 +176,9 @@ inline bool em_iterate(const Mat<eT>& X, const uword max_iter, const eT var_floor, const bool verbose); - inline void em_update_params(const Mat<eT>& X, const field<uvec>& t_boundary, field< Mat<eT> >& t_acc_means, field< Mat<eT> >& t_acc_dcovs, field< Col<eT> >& t_acc_norm_lhoods, field< Col<eT> >& t_gaus_log_lhoods, Col<eT>& t_progress_log_lhoods); + inline void em_update_params(const Mat<eT>& X, const umat& boundaries, field< Mat<eT> >& t_acc_means, field< Mat<eT> >& t_acc_dcovs, field< Col<eT> >& t_acc_norm_lhoods, field< Col<eT> >& t_gaus_log_lhoods, Col<eT>& t_progress_log_lhoods); - inline void em_generate_acc(const Mat<eT>& X, const uvec& boundary, Mat<eT>& acc_means, Mat<eT>& acc_dcovs, Col<eT>& acc_norm_lhoods, Col<eT>& gaus_log_lhoods, eT& progress_log_lhood) const; + inline void em_generate_acc(const Mat<eT>& X, const uword start_index, const uword end_index, Mat<eT>& acc_means, Mat<eT>& acc_dcovs, Col<eT>& acc_norm_lhoods, Col<eT>& gaus_log_lhoods, eT& progress_log_lhood) const; inline void em_fix_params(const eT var_floor); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/gmm_diag_meat.hpp new/armadillo-4.550.0/include/armadillo_bits/gmm_diag_meat.hpp --- old/armadillo-4.500.1/include/armadillo_bits/gmm_diag_meat.hpp 2014-10-07 15:00:29.000000000 +0200 +++ new/armadillo-4.550.0/include/armadillo_bits/gmm_diag_meat.hpp 2014-11-21 11:57:06.000000000 +0100 @@ -826,6 +826,56 @@ template<typename eT> +inline +umat +gmm_diag<eT>::internal_gen_boundaries(const uword N) const + { + arma_extra_debug_sigprint(); + + #if defined(_OPENMP) + // const uword n_cores = 0; + const uword n_cores = uword(omp_get_num_procs()); + const uword n_threads = (n_cores > 0) ? ( (n_cores <= N) ? n_cores : 1 ) : 1; + #else + // static const uword n_cores = 0; + static const uword n_threads = 1; + #endif + + // get_stream_err2() << "gmm_diag::internal_gen_boundaries(): n_cores: " << n_cores << '\n'; + // get_stream_err2() << "gmm_diag::internal_gen_boundaries(): n_threads: " << n_threads << '\n'; + + umat boundaries(2, n_threads); + + if(N > 0) + { + const uword chunk_size = N / n_threads; + + uword count = 0; + + for(uword t=0; t<n_threads; t++) + { + boundaries.at(0,t) = count; + + count += chunk_size; + + boundaries.at(1,t) = count-1; + } + + boundaries.at(1,n_threads-1) = N - 1; + } + else + { + boundaries.zeros(); + } + + // get_stream_err2() << "gmm_diag::internal_gen_boundaries(): boundaries: " << '\n' << boundaries << '\n'; + + return boundaries; + } + + + +template<typename eT> arma_hot inline eT @@ -914,11 +964,40 @@ Row<eT> out(N); - eT* out_mem = out.memptr(); - - for(uword i=0; i < N; ++i) + if(N > 0) { - out_mem[i] = internal_scalar_log_p( X.colptr(i) ); + #if defined(_OPENMP) + { + const arma_omp_state save_omp_state; + + const umat boundaries = internal_gen_boundaries(N); + + const uword n_threads = boundaries.n_cols; + + #pragma omp parallel for + for(uword t=0; t < n_threads; ++t) + { + const uword start_index = boundaries.at(0,t); + const uword end_index = boundaries.at(1,t); + + eT* out_mem = out.memptr(); + + for(uword i=start_index; i <= end_index; ++i) + { + out_mem[i] = internal_scalar_log_p( X.colptr(i) ); + } + } + } + #else + { + eT* out_mem = out.memptr(); + + for(uword i=0; i < N; ++i) + { + out_mem[i] = internal_scalar_log_p( X.colptr(i) ); + } + } + #endif } return out; @@ -941,11 +1020,40 @@ Row<eT> out(N); - eT* out_mem = out.memptr(); - - for(uword i=0; i < N; ++i) + if(N > 0) { - out_mem[i] = internal_scalar_log_p( X.colptr(i), gaus_id ); + #if defined(_OPENMP) + { + const arma_omp_state save_omp_state; + + const umat boundaries = internal_gen_boundaries(N); + + const uword n_threads = boundaries.n_cols; + + #pragma omp parallel for + for(uword t=0; t < n_threads; ++t) + { + const uword start_index = boundaries.at(0,t); + const uword end_index = boundaries.at(1,t); + + eT* out_mem = out.memptr(); + + for(uword i=start_index; i <= end_index; ++i) + { + out_mem[i] = internal_scalar_log_p( X.colptr(i), gaus_id ); + } + } + } + #else + { + eT* out_mem = out.memptr(); + + for(uword i=0; i < N; ++i) + { + out_mem[i] = internal_scalar_log_p( X.colptr(i), gaus_id ); + } + } + #endif } return out; @@ -962,17 +1070,63 @@ arma_extra_debug_sigprint(); arma_debug_check( (X.n_rows != means.n_rows), "gmm_diag::avg_log_p(): incompatible dimensions" ); + + const uword N = X.n_cols; - running_mean_scalar<eT> running_mean; + if(N == 0) { return (-Datum<eT>::inf); } - const uword N = X.n_cols; - for(uword i=0; i<N; ++i) + #if defined(_OPENMP) { - running_mean( internal_scalar_log_p( X.colptr(i) ) ); + const arma_omp_state save_omp_state; + + const umat boundaries = internal_gen_boundaries(N); + + const uword n_threads = boundaries.n_cols; + + field< running_mean_scalar<eT> > t_running_means(n_threads); + + + #pragma omp parallel for + for(uword t=0; t < n_threads; ++t) + { + const uword start_index = boundaries.at(0,t); + const uword end_index = boundaries.at(1,t); + + running_mean_scalar<eT>& current_running_mean = t_running_means[t]; + + for(uword i=start_index; i <= end_index; ++i) + { + current_running_mean( internal_scalar_log_p( X.colptr(i) ) ); + } + } + + + eT avg = eT(0); + + for(uword t=0; t < n_threads; ++t) + { + running_mean_scalar<eT>& current_running_mean = t_running_means[t]; + + const eT w = eT(current_running_mean.count()) / eT(N); + + avg += w * current_running_mean.mean(); + } + + return avg; } - - return ( (N > 0) ? running_mean.mean() : (-Datum<eT>::inf) ); + #else + { + running_mean_scalar<eT> running_mean; + + for(uword i=0; i<N; ++i) + { + running_mean( internal_scalar_log_p( X.colptr(i) ) ); + } + + return running_mean.mean(); + } + #endif } @@ -988,16 +1142,64 @@ arma_debug_check( (X.n_rows != means.n_rows), "gmm_diag::avg_log_p(): incompatible dimensions" ); arma_debug_check( (gaus_id >= means.n_cols), "gmm_diag::avg_log_p(): specified gaussian is out of range" ); - running_mean_scalar<eT> running_mean; - const uword N = X.n_cols; - for(uword i=0; i<N; ++i) + if(N == 0) { return (-Datum<eT>::inf); } + + + #if defined(_OPENMP) + { + const arma_omp_state save_omp_state; + + const umat boundaries = internal_gen_boundaries(N); + + const uword n_threads = boundaries.n_cols; + + field< running_mean_scalar<eT> > t_running_means(n_threads); + + + #pragma omp parallel for + for(uword t=0; t < n_threads; ++t) + { + const uword start_index = boundaries.at(0,t); + const uword end_index = boundaries.at(1,t); + + running_mean_scalar<eT>& current_running_mean = t_running_means[t]; + + for(uword i=start_index; i <= end_index; ++i) + { + current_running_mean( internal_scalar_log_p( X.colptr(i), gaus_id) ); + } + } + + + eT avg = eT(0); + + for(uword t=0; t < n_threads; ++t) + { + running_mean_scalar<eT>& current_running_mean = t_running_means[t]; + + const eT w = eT(current_running_mean.count()) / eT(N); + + avg += w * current_running_mean.mean(); + } + + return avg; + } + #else { - running_mean( internal_scalar_log_p( X.colptr(i), gaus_id ) ); + running_mean_scalar<eT> running_mean; + + const uword N = X.n_cols; + + for(uword i=0; i<N; ++i) + { + running_mean( internal_scalar_log_p( X.colptr(i), gaus_id ) ); + } + + return running_mean.mean(); } - - return ( (N > 0) ? running_mean.mean() : (-Datum<eT>::inf) ); + #endif } @@ -1376,41 +1578,19 @@ #if defined(_OPENMP) const arma_omp_state save_omp_state; - omp_set_dynamic(0); + const umat boundaries = internal_gen_boundaries(X.n_cols); - //const uword n_cores = 0; - const uword n_cores = uword(omp_get_num_procs()); - const uword n_threads = (n_cores > 0) ? ( (n_cores <= X.n_cols) ? n_cores : 1 ) : 1; + const uword n_threads = boundaries.n_cols; field< field< running_mean_vec<eT> > > t_running_means(n_threads); for(uword t=0; t < n_threads; ++t) { t_running_means[t].set_size(N_gaus); } - field< uvec > t_boundary(n_threads); - - const uword chunk_size = X.n_cols / n_threads; - - uword vec_count = 0; - - for(uword t=0; t<n_threads; t++) - { - t_boundary[t].set_size(2); - - t_boundary[t][0] = vec_count; - - vec_count += chunk_size; - - t_boundary[t][1] = vec_count-1; - } - - t_boundary[n_threads-1][1] = X.n_cols - 1; - vec tmp_mean(N_dims); if(verbose) { - get_stream_err2() << "gmm_diag::learn(): k-means: n_threads: " << n_threads << '\n'; - get_stream_err2() << "gmm_diag::learn(): k-means: chunk_size: " << chunk_size << '\n'; + get_stream_err2() << "gmm_diag::learn(): k-means: n_threads: " << n_threads << '\n'; } #endif @@ -1430,11 +1610,9 @@ #pragma omp parallel for for(uword t=0; t < n_threads; ++t) { - const uvec& boundary = t_boundary[t]; - field< running_mean_vec<eT> >& current_running_means = t_running_means[t]; - km_update_stats<dist_id>(X, boundary[0], boundary[1], old_means, current_running_means); + km_update_stats<dist_id>(X, boundaries.at(0,t), boundaries.at(1,t), old_means, current_running_means); } @@ -1642,21 +1820,11 @@ #if defined(_OPENMP) const arma_omp_state save_omp_state; - - omp_set_dynamic(0); - - // const uword n_cores = 0; - const uword n_cores = uword(omp_get_num_procs()); - const uword n_threads = (n_cores > 0) ? ( (n_cores <= X.n_cols) ? n_cores : 1 ) : 1; - #else - // static const uword n_cores = 0; - static const uword n_threads = 1; #endif - // get_stream_err2() << "n_cores: " << n_cores << '\n'; - // get_stream_err2() << "n_threads: " << n_threads << '\n'; + const umat boundaries = internal_gen_boundaries(X.n_cols); - field< uvec > t_boundary(n_threads); + const uword n_threads = boundaries.n_cols; field< Mat<eT> > t_acc_means(n_threads); field< Mat<eT> > t_acc_dcovs(n_threads); @@ -1668,8 +1836,6 @@ for(uword t=0; t<n_threads; t++) { - t_boundary[t].set_size(2); - t_acc_means[t].set_size(N_dims, N_gaus); t_acc_dcovs[t].set_size(N_dims, N_gaus); @@ -1677,29 +1843,11 @@ t_gaus_log_lhoods[t].set_size(N_gaus); } - const uword chunk_size = X.n_cols / n_threads; - - uword count = 0; - - for(uword t=0; t<n_threads; t++) - { - t_boundary[t][0] = count; - - count += chunk_size; - - t_boundary[t][1] = count-1; - } - - t_boundary[n_threads-1][1] = X.n_cols - 1; - - // get_stream_err2() << "t_boundary.n_elem: " << t_boundary.n_elem << '\n'; - // t_boundary.print("t_boundary:"); #if defined(_OPENMP) if(verbose) { - get_stream_err2() << "gmm_diag::learn(): EM: n_threads: " << n_threads << '\n'; - get_stream_err2() << "gmm_diag::learn(): EM: chunk_size: " << chunk_size << '\n'; + get_stream_err2() << "gmm_diag::learn(): EM: n_threads: " << n_threads << '\n'; } #endif @@ -1709,7 +1857,7 @@ { init_constants(); - em_update_params(X, t_boundary, t_acc_means, t_acc_dcovs, t_acc_norm_lhoods, t_gaus_log_lhoods, t_progress_log_lhood); + em_update_params(X, boundaries, t_acc_means, t_acc_dcovs, t_acc_norm_lhoods, t_gaus_log_lhoods, t_progress_log_lhood); em_fix_params(var_floor); @@ -1754,7 +1902,7 @@ gmm_diag<eT>::em_update_params ( const Mat<eT>& X, - const field< uvec >& t_boundary, + const umat& boundaries, field< Mat<eT> >& t_acc_means, field< Mat<eT> >& t_acc_dcovs, field< Col<eT> >& t_acc_norm_lhoods, @@ -1764,7 +1912,7 @@ { arma_extra_debug_sigprint(); - const uword n_threads = t_boundary.n_elem; + const uword n_threads = boundaries.n_cols; // em_generate_acc() is the "map" operation, which produces partial accumulators for means, diagonal covariances and hefts @@ -1774,19 +1922,18 @@ #pragma omp parallel for for(uword t=0; t<n_threads; t++) { - const uvec& boundary = t_boundary[t]; - Mat<eT>& acc_means = t_acc_means[t]; - Mat<eT>& acc_dcovs = t_acc_dcovs[t]; - Col<eT>& acc_norm_lhoods = t_acc_norm_lhoods[t]; - Col<eT>& gaus_log_lhoods = t_gaus_log_lhoods[t]; - eT& progress_log_lhood = t_progress_log_lhood[t]; + Mat<eT>& acc_means = t_acc_means[t]; + Mat<eT>& acc_dcovs = t_acc_dcovs[t]; + Col<eT>& acc_norm_lhoods = t_acc_norm_lhoods[t]; + Col<eT>& gaus_log_lhoods = t_gaus_log_lhoods[t]; + eT& progress_log_lhood = t_progress_log_lhood[t]; - em_generate_acc(X, boundary, acc_means, acc_dcovs, acc_norm_lhoods, gaus_log_lhoods, progress_log_lhood); + em_generate_acc(X, boundaries.at(0,t), boundaries.at(1,t), acc_means, acc_dcovs, acc_norm_lhoods, gaus_log_lhoods, progress_log_lhood); } } #else { - em_generate_acc(X, t_boundary[0], t_acc_means[0], t_acc_dcovs[0], t_acc_norm_lhoods[0], t_gaus_log_lhoods[0], t_progress_log_lhood[0]); + em_generate_acc(X, boundaries.at(0,0), boundaries.at(1,0), t_acc_means[0], t_acc_dcovs[0], t_acc_norm_lhoods[0], t_gaus_log_lhoods[0], t_progress_log_lhood[0]); } #endif @@ -1842,7 +1989,8 @@ gmm_diag<eT>::em_generate_acc ( const Mat<eT>& X, - const uvec& boundary, + const uword start_index, + const uword end_index, Mat<eT>& acc_means, Mat<eT>& acc_dcovs, Col<eT>& acc_norm_lhoods, @@ -1867,8 +2015,6 @@ const eT* log_hefts_mem = log_hefts.memptr(); eT* gaus_log_lhoods_mem = gaus_log_lhoods.memptr(); - const uword start_index = boundary[0]; - const uword end_index = boundary[1]; for(uword i=start_index; i <= end_index; i++) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/op_expmat_bones.hpp new/armadillo-4.550.0/include/armadillo_bits/op_expmat_bones.hpp --- old/armadillo-4.500.1/include/armadillo_bits/op_expmat_bones.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/op_expmat_bones.hpp 2014-11-19 02:26:01.000000000 +0100 @@ -0,0 +1,25 @@ +// Copyright (C) 2014 Conrad Sanderson +// Copyright (C) 2014 NICTA (www.nicta.com.au) +// +// 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 +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + +//! \addtogroup op_expmat +//! @{ + + + +class op_expmat + { + public: + + template<typename T1> + inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_expmat>& expr); + }; + + + +//! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/op_expmat_meat.hpp new/armadillo-4.550.0/include/armadillo_bits/op_expmat_meat.hpp --- old/armadillo-4.500.1/include/armadillo_bits/op_expmat_meat.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/op_expmat_meat.hpp 2014-11-19 06:36:59.000000000 +0100 @@ -0,0 +1,85 @@ +// Copyright (C) 2014 Conrad Sanderson +// Copyright (C) 2014 NICTA (www.nicta.com.au) +// +// 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 +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + +//! \addtogroup op_expmat +//! @{ + + +//! implementation based on: +//! Cleve Moler, Charles Van Loan. +//! Nineteen Dubious Ways to Compute the Exponential of a Matrix, Twenty-Five Years Later. +//! SIAM Review, Vol. 45, No. 1, 2003, pp. 3-49. +//! http://dx.doi.org/10.1137/S00361445024180 + +template<typename T1> +inline +void +op_expmat::apply(Mat<typename T1::elem_type>& out, const Op<T1, op_expmat>& expr) + { + arma_extra_debug_sigprint(); + + typedef typename T1::elem_type eT; + typedef typename T1::pod_type T; + + + if(is_op_diagmat<T1>::value) + { + out = expr.m; // force the evaluation of diagmat() + + const uword n_rows = out.n_rows; + + for(uword i=0; i<n_rows; ++i) + { + out.at(i,i) = std::exp( out.at(i,i) ); + } + } + else + { + const unwrap<T1> tmp(expr.m); + const Mat<eT>& A = tmp.M; + + arma_debug_check( (A.is_square() == false), "expmat(): given matrix is not square sized" ); + + const uword s = (std::max)(uword(0), uword(eop_aux::log2(norm(A, "inf"))) + uword(1) + uword(1)); + + const Mat<eT> AA = A / std::pow(double(2), s); + + T c = T(0.5); + + Mat<eT> E(AA.n_rows, AA.n_rows, fill::eye); E += c * AA; + Mat<eT> D(AA.n_rows, AA.n_rows, fill::eye); D -= c * AA; + + Mat<eT> X = AA; + + bool positive = true; + + const uword N = 6; + + for(uword i = 2; i <= N; ++i) + { + c = c * T(N - i + 1) / T(i * (2*N - i + 1)); + + X = AA * X; + + E += c * X; + + if(positive) { D += c * X; } else { D -= c * X; } + + positive = (positive) ? false : true; + } + + out = solve(D, E); + + for(uword i=0; i < s; ++i) { out = out * out; } + } + } + + + +//! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/op_vectorise_bones.hpp new/armadillo-4.550.0/include/armadillo_bits/op_vectorise_bones.hpp --- old/armadillo-4.500.1/include/armadillo_bits/op_vectorise_bones.hpp 2013-12-25 18:01:20.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/op_vectorise_bones.hpp 2014-11-18 05:16:24.000000000 +0100 @@ -1,5 +1,5 @@ -// Copyright (C) 2013 Conrad Sanderson -// Copyright (C) 2013 NICTA (www.nicta.com.au) +// Copyright (C) 2013-2014 Conrad Sanderson +// Copyright (C) 2013-2014 NICTA (www.nicta.com.au) // // 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 @@ -42,5 +42,14 @@ }; + +class op_vectorise_cube_col + { + public: + + template<typename T1> inline static void apply( Mat<typename T1::elem_type>& out, const Op<T1,op_vectorise_cube_col>& in); + }; + + //! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/op_vectorise_meat.hpp new/armadillo-4.550.0/include/armadillo_bits/op_vectorise_meat.hpp --- old/armadillo-4.500.1/include/armadillo_bits/op_vectorise_meat.hpp 2013-12-25 18:01:20.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/op_vectorise_meat.hpp 2014-11-18 05:16:24.000000000 +0100 @@ -206,4 +206,73 @@ +// + + + +//! experimental: vectorisation of cubes +template<typename T1> +inline +void +op_vectorise_cube_col::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_vectorise_cube_col>& in) + { + arma_extra_debug_sigprint(); + + typedef typename T1::elem_type eT; + + ProxyCube<T1> P(in.m); + + const uword N = P.get_n_elem(); + + out.set_size(N, 1); + + if(is_Cube<typename ProxyCube<T1>::stored_type>::value == true) + { + const unwrap_cube<typename ProxyCube<T1>::stored_type> tmp(P.Q); + + arrayops::copy(out.memptr(), tmp.M.memptr(), N); + } + else + { + eT* outmem = out.memptr(); + + if(ProxyCube<T1>::prefer_at_accessor == false) + { + typename ProxyCube<T1>::ea_type A = P.get_ea(); + + uword i,j; + + for(i=0, j=1; j < N; i+=2, j+=2) + { + const eT tmp_i = A[i]; + const eT tmp_j = A[j]; + + outmem[i] = tmp_i; + outmem[j] = tmp_j; + } + + if(i < N) + { + outmem[i] = A[i]; + } + } + else + { + const uword n_rows = P.get_n_rows(); + const uword n_cols = P.get_n_cols(); + const uword n_slices = P.get_n_slices(); + + for(uword slice=0; slice < n_slices; ++slice) + for(uword col=0; col < n_cols; ++col ) + for(uword row=0; row < n_rows; ++row ) + { + *outmem = P.at(row,col,slice); + outmem++; + } + } + } + } + + + //! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-4.500.1/include/armadillo_bits/traits.hpp new/armadillo-4.550.0/include/armadillo_bits/traits.hpp --- old/armadillo-4.500.1/include/armadillo_bits/traits.hpp 2014-03-14 17:51:29.000000000 +0100 +++ new/armadillo-4.550.0/include/armadillo_bits/traits.hpp 2014-11-07 05:25:21.000000000 +0100 @@ -1290,4 +1290,32 @@ +template<typename T1> +struct is_outer_product + { static const bool value = false; }; + +template<typename T1, typename T2> +struct is_outer_product< Glue<T1,T2,glue_times> > + { static const bool value = (resolves_to_colvector<T1>::value && resolves_to_rowvector<T2>::value); }; + + + +template<typename T1> +struct has_op_inv + { static const bool value = false; }; + +template<typename T1> +struct has_op_inv< Op<T1,op_inv> > + { static const bool value = true; }; + +template<typename T1, typename T2> +struct has_op_inv< Glue<Op<T1,op_inv>, T2, glue_times> > + { static const bool value = true; }; + +template<typename T1, typename T2> +struct has_op_inv< Glue<T1, Op<T2,op_inv>, glue_times> > + { static const bool value = true; }; + + + //! @} -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de