[Rcpp-commits] r3609 - in pkg/RcppArmadillo: . inst inst/include/armadillo_bits
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed May 16 01:54:18 CEST 2012
Author: edd
Date: 2012-05-16 01:54:18 +0200 (Wed, 16 May 2012)
New Revision: 3609
Modified:
pkg/RcppArmadillo/ChangeLog
pkg/RcppArmadillo/DESCRIPTION
pkg/RcppArmadillo/inst/NEWS
pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trace.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_htrans_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp
Log:
RcppArmadillo 0.3.1.94 with Armadillo 3.1.94
Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/ChangeLog 2012-05-15 23:54:18 UTC (rev 3609)
@@ -1,3 +1,9 @@
+2012-05-15 Dirk Eddelbuettel <edd at debian.org>
+
+ * DESCRIPTION: Release 0.3.1.94
+
+ * inst/include/*: Upgraded to new (beta) release 3.1.94 of Armadillo
+
2012-05-10 Dirk Eddelbuettel <edd at debian.org>
* DESCRIPTION: Release 0.3.1.92
Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/DESCRIPTION 2012-05-15 23:54:18 UTC (rev 3609)
@@ -1,7 +1,7 @@
Package: RcppArmadillo
Type: Package
Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.3.1.92
+Version: 0.3.1.94
Date: $Date$
Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
Maintainer: Romain Francois, Dirk Eddelbuettel and Doug Bates <RcppArmadillo-authors at r-enthusiasts.com>
@@ -21,7 +21,7 @@
(due to speed and/or integration capabilities), rather than another language.
.
The RcppArmadillo package includes the header files from the templated
- Armadillo library (currently version 3.1.92). Thus users do not need to
+ Armadillo library (currently version 3.1.94). Thus users do not need to
install Armadillo itself in order to use RcppArmadillo.
.
This Armadillo integration provides a nice illustration of the
Modified: pkg/RcppArmadillo/inst/NEWS
===================================================================
--- pkg/RcppArmadillo/inst/NEWS 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/NEWS 2012-05-15 23:54:18 UTC (rev 3609)
@@ -1,6 +1,15 @@
+0.3.1.94 2012-05-15
+
+ o Upgraded to Armadillo release 3.1.94 "v3.2 beta 2"
+
+ * added unique(), for finding unique elements of a matrix
+ * faster eigen decomposition via "divide and conquer" algorithm
+ * faster transpose of vectors and compound expressions
+ * faster handling of tiny fixed size vectors (≤ 4 elements)
+
0.3.1.92 2012-05-10
- o Upgraded to Armadillo release 3.0.2 "v3.2 beta 2"
+ o Upgraded to Armadillo release 3.1.92 "v3.2 beta 2"
* added unique(), for finding unique elements of a matrix
* faster eigen decomposition via optional use of "divide and
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -50,7 +50,7 @@
template<typename elem_type, typename derived>
struct Base_eval_expr
{
- Mat<elem_type> eval() const;
+ Mat<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
};
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -870,7 +870,7 @@
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
- arma_inline ea_type get_ea() const { return Q; }
+ arma_inline ea_type get_ea() const { return Q; }
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (Q.P1.is_alias(X) || Q.P2.is_alias(X)); }
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -18,8 +18,8 @@
#define ARMA_VERSION_MAJOR 3
#define ARMA_VERSION_MINOR 1
-#define ARMA_VERSION_PATCH 92
-#define ARMA_VERSION_NAME "v3.2 beta 2"
+#define ARMA_VERSION_PATCH 94
+#define ARMA_VERSION_NAME "v3.2 beta 4"
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -179,27 +179,14 @@
//
// solve
- template<typename eT>
- inline static bool solve (Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const bool slow = false);
-
- template<typename eT>
- inline static bool solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);
-
- template<typename eT>
- inline static bool solve_ud(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);
-
-
- //
- // solve_new
-
template<typename eT, typename T1>
- inline static bool solve_new (Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X, const bool slow = false);
+ inline static bool solve (Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X, const bool slow = false);
template<typename eT, typename T1>
- inline static bool solve_new_od(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X);
+ inline static bool solve_od(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X);
template<typename eT, typename T1>
- inline static bool solve_new_ud(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X);
+ inline static bool solve_ud(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X);
//
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -2504,235 +2504,10 @@
//! Solve a system of linear equations.
//! Assumes that A.n_rows = A.n_cols and B.n_rows = A.n_rows
-template<typename eT>
-inline
-bool
-auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const bool slow)
- {
- arma_extra_debug_sigprint();
-
- const uword A_n_rows = A.n_rows;
- const uword B_n_cols = B.n_cols;
-
- if(A.is_empty() || B.is_empty())
- {
- out.zeros(A.n_cols, B_n_cols);
- return true;
- }
- else
- {
- bool status = false;
-
- if( (A_n_rows <= 4) && (slow == false) )
- {
- Mat<eT> A_inv;
-
- status = auxlib::inv_noalias_tinymat(A_inv, A, A_n_rows);
-
- if(status == true)
- {
- out.set_size(A_n_rows, B_n_cols);
-
- gemm_emul<false,false,false,false>::apply(out, A_inv, B);
-
- return true;
- }
- }
-
- if( (A_n_rows > 4) || (status == false) )
- {
- #if defined(ARMA_USE_ATLAS)
- {
- out = B;
-
- podarray<int> ipiv(A_n_rows + 2); // +2 for paranoia: old versions of Atlas might be trashing memory
-
- int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows, B_n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows);
-
- return (info == 0);
- }
- #elif defined(ARMA_USE_LAPACK)
- {
- out = B;
-
- blas_int n = blas_int(A_n_rows); // assuming A is square
- blas_int lda = blas_int(A_n_rows);
- blas_int ldb = blas_int(A_n_rows);
- blas_int nrhs = blas_int(B_n_cols);
- blas_int info = 0;
-
- podarray<blas_int> ipiv(A_n_rows + 2); // +2 for paranoia: some versions of Lapack might be trashing memory
-
- arma_extra_debug_print("lapack::gesv()");
- lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr(), &ldb, &info);
-
- arma_extra_debug_print("lapack::gesv() -- finished");
-
- return (info == 0);
- }
- #else
- {
- arma_stop("solve(): use of ATLAS or LAPACK needs to be enabled");
- return false;
- }
- #endif
- }
- }
-
- return true;
- }
-
-
-
-//! Solve an over-determined system.
-//! Assumes that A.n_rows > A.n_cols and B.n_rows = A.n_rows
-template<typename eT>
-inline
-bool
-auxlib::solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B)
- {
- arma_extra_debug_sigprint();
-
- #if defined(ARMA_USE_LAPACK)
- {
- const uword A_n_rows = A.n_rows;
- const uword A_n_cols = A.n_cols;
-
- const uword B_n_rows = B.n_rows;
- const uword B_n_cols = B.n_cols;
-
- out.set_size(A_n_cols, B_n_cols);
-
- if(A.is_empty() || B.is_empty())
- {
- out.zeros();
- return true;
- }
-
- char trans = 'N';
-
- blas_int m = blas_int(A_n_rows);
- blas_int n = blas_int(A_n_cols);
- blas_int lda = blas_int(A_n_rows);
- blas_int ldb = blas_int(A_n_rows);
- blas_int nrhs = blas_int(B_n_cols);
- blas_int lwork = 2*((std::max)(blas_int(1), n + (std::max)(n, nrhs)));
- blas_int info = 0;
-
- Mat<eT> tmp = B;
-
- podarray<eT> work( static_cast<uword>(lwork) );
-
- // NOTE: the dgels() function in the lapack library supplied by ATLAS 3.6 seems to have problems
- arma_extra_debug_print("lapack::gels()");
- lapack::gels<eT>( &trans, &m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, work.memptr(), &lwork, &info );
-
- arma_extra_debug_print("lapack::gels() -- finished");
-
- for(uword col=0; col<B_n_cols; ++col)
- {
- arrayops::copy( out.colptr(col), tmp.colptr(col), A_n_cols );
- }
-
- return (info == 0);
- }
- #else
- {
- arma_ignore(out);
- arma_ignore(A);
- arma_ignore(B);
- arma_stop("solve(): use of LAPACK needs to be enabled");
- return false;
- }
- #endif
- }
-
-
-
-//! Solve an under-determined system.
-//! Assumes that A.n_rows < A.n_cols and B.n_rows = A.n_rows
-template<typename eT>
-inline
-bool
-auxlib::solve_ud(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B)
- {
- arma_extra_debug_sigprint();
-
- #if defined(ARMA_USE_LAPACK)
- {
- const uword A_n_rows = A.n_rows;
- const uword A_n_cols = A.n_cols;
-
- const uword B_n_rows = B.n_rows;
- const uword B_n_cols = B.n_cols;
-
- out.set_size(A_n_cols, B_n_cols);
-
- if(A.is_empty() || B.is_empty())
- {
- out.zeros();
- return true;
- }
-
- char trans = 'N';
-
- blas_int m = blas_int(A_n_rows);
- blas_int n = blas_int(A_n_cols);
- blas_int lda = blas_int(A_n_rows);
- blas_int ldb = blas_int(A_n_cols);
- blas_int nrhs = blas_int(B_n_cols);
- blas_int lwork = 2*((std::max)(blas_int(1), m + (std::max)(m,nrhs)));
- blas_int info = 0;
-
- Mat<eT> tmp(A_n_cols, B_n_cols);
- tmp.zeros();
-
- for(uword col=0; col<B_n_cols; ++col)
- {
- eT* tmp_colmem = tmp.colptr(col);
-
- arrayops::copy( tmp_colmem, B.colptr(col), B_n_rows );
-
- for(uword row=B_n_rows; row<A_n_cols; ++row)
- {
- tmp_colmem[row] = eT(0);
- }
- }
-
- podarray<eT> work( static_cast<uword>(lwork) );
-
- // NOTE: the dgels() function in the lapack library supplied by ATLAS 3.6 seems to have problems
- arma_extra_debug_print("lapack::gels()");
- lapack::gels<eT>( &trans, &m, &n, &nrhs, A.memptr(), &lda, tmp.memptr(), &ldb, work.memptr(), &lwork, &info );
-
- arma_extra_debug_print("lapack::gels() -- finished");
-
- for(uword col=0; col<B_n_cols; ++col)
- {
- arrayops::copy( out.colptr(col), tmp.colptr(col), A_n_cols );
- }
-
- return (info == 0);
- }
- #else
- {
- arma_ignore(out);
- arma_ignore(A);
- arma_ignore(B);
- arma_stop("solve(): use of LAPACK needs to be enabled");
- return false;
- }
- #endif
- }
-
-
-
-//! Solve a system of linear equations.
-//! Assumes that A.n_rows = A.n_cols and B.n_rows = A.n_rows
template<typename eT, typename T1>
inline
bool
-auxlib::solve_new(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X, const bool slow)
+auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X, const bool slow)
{
arma_extra_debug_sigprint();
@@ -2828,7 +2603,7 @@
template<typename eT, typename T1>
inline
bool
-auxlib::solve_new_od(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X)
+auxlib::solve_od(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X)
{
arma_extra_debug_sigprint();
@@ -2895,10 +2670,14 @@
template<typename eT, typename T1>
inline
bool
-auxlib::solve_new_ud(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X)
+auxlib::solve_ud(Mat<eT>& out, Mat<eT>& A, const Base<eT,T1>& X)
{
arma_extra_debug_sigprint();
+ // TODO: this function provides the same results as Octave 3.4.2.
+ // TODO: however, these results are different than Matlab 7.12.0.635.
+ // TODO: figure out whether both Octave and Matlab are correct, or only one of them
+
#if defined(ARMA_USE_LAPACK)
{
const unwrap<T1> Y( X.get_ref() );
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -12,49 +12,33 @@
-// #define ARMA_64BIT_WORD
-//// Uncomment the above line if you require matrices/vectors capable of holding more than 4 billion elements.
-//// Your machine and compiler must have support for 64 bit integers (eg. via "long" or "long long")
-
-// #define ARMA_USE_CXX11
-//// Uncomment the above line if you have a C++ compiler that supports the C++11 standard
-//// This will enable additional features, such as use of initialiser lists
-
#if !defined(ARMA_USE_LAPACK)
// #define ARMA_USE_LAPACK
-//// Uncomment the above line if you have LAPACK or a fast replacement for LAPACK,
+//// Uncomment the above line if you have LAPACK or a high-speed replacement for LAPACK,
//// such as Intel's MKL, AMD's ACML, or the Accelerate framework.
//// LAPACK is required for matrix decompositions (eg. SVD) and matrix inverse.
#endif
#if !defined(ARMA_USE_BLAS)
// #define ARMA_USE_BLAS
-//// Uncomment the above line if you have BLAS or a fast replacement for BLAS,
+//// Uncomment the above line if you have BLAS or a high-speed replacement for BLAS,
//// such as GotoBLAS, Intel's MKL, AMD's ACML, or the Accelerate framework.
//// BLAS is used for matrix multiplication.
//// Without BLAS, matrix multiplication will still work, but might be slower.
#endif
-// #define ARMA_BLAS_LONG
-//// Uncomment the above line if your BLAS and LAPACK libraries use "long" instead of "int"
+// #define ARMA_BLAS_CAPITALS
+//// Uncomment the above line if your BLAS and LAPACK libraries have capitalised function names (eg. ACML on 64-bit Windows)
-// #define ARMA_BLAS_LONG_LONG
-//// Uncomment the above line if your BLAS and LAPACK libraries use "long long" instead of "int"
-
#define ARMA_BLAS_UNDERSCORE
//// Uncomment the above line if your BLAS and LAPACK libraries have function names with a trailing underscore.
//// Conversely, comment it out if the function names don't have a trailing underscore.
-// #define ARMA_BLAS_CAPITALS
-//// Uncomment the above line if your BLAS and LAPACK libraries have capitalised function names (eg. ACML on 64-bit Windows)
+// #define ARMA_BLAS_LONG
+//// Uncomment the above line if your BLAS and LAPACK libraries use "long" instead of "int"
-#if !defined(ARMA_MAT_PREALLOC)
- #define ARMA_MAT_PREALLOC 16
-#endif
-//// This is the number of preallocated elements used by matrices and vectors;
-//// it must be an integer that is at least 1.
-//// If you mainly use lots of very small vectors (eg. <= 4 elements),
-//// change the number to the size of your vectors.
+// #define ARMA_BLAS_LONG_LONG
+//// Uncomment the above line if your BLAS and LAPACK libraries use "long long" instead of "int"
// #define ARMA_USE_TBB_ALLOC
//// Uncomment the above line if you want to use Intel TBB scalable_malloc() and scalable_free() instead of standard new[] and delete[]
@@ -68,6 +52,33 @@
//// uncomment the above define and specify the appropriate include directory.
//// Make sure the directory has a trailing /
+// #define ARMA_64BIT_WORD
+//// Uncomment the above line if you require matrices/vectors capable of holding more than 4 billion elements.
+//// Your machine and compiler must have support for 64 bit integers (eg. via "long" or "long long")
+
+// #define ARMA_USE_CXX11
+//// Uncomment the above line if you have a C++ compiler that supports the C++11 standard
+//// This will enable additional features, such as use of initialiser lists
+
+#if !defined(ARMA_MAT_PREALLOC)
+ #define ARMA_MAT_PREALLOC 16
+#endif
+//// This is the number of preallocated elements used by matrices and vectors;
+//// it must be an integer that is at least 1.
+//// If you mainly use lots of very small vectors (eg. <= 4 elements),
+//// change the number to the size of your vectors.
+
+// #define ARMA_NO_DEBUG
+//// Uncomment the above line if you want to disable all run-time checks.
+//// This will result in faster code, but you first need to make sure that your code runs correctly!
+//// We strongly recommend to have the run-time checks enabled during development,
+//// as this greatly aids in finding mistakes in your code, and hence speeds up development.
+//// We recommend that run-time checks be disabled _only_ for the shipped version of your program.
+
+// #define ARMA_EXTRA_DEBUG
+//// Uncomment the above line if you want to see the function traces of how Armadillo evaluates expressions.
+//// This is mainly useful for debugging of the library.
+
// #define ARMA_USE_BOOST
// #define ARMA_USE_BOOST_DATE
// #define ARMA_USE_WRAPPER
@@ -88,13 +99,7 @@
// #define ARMA_HAVE_LOG1P
// #define ARMA_HAVE_GETTIMEOFDAY
-// #define ARMA_EXTRA_DEBUG
-// #define ARMA_NO_DEBUG
-#if defined(ARMA_DONT_USE_ATLAS)
- #undef ARMA_USE_ATLAS
- #undef ARMA_ATLAS_INCLUDE_DIR
-#endif
#if defined(ARMA_DONT_USE_LAPACK)
#undef ARMA_USE_LAPACK
@@ -104,6 +109,11 @@
#undef ARMA_USE_BLAS
#endif
+#if defined(ARMA_DONT_USE_ATLAS)
+ #undef ARMA_USE_ATLAS
+ #undef ARMA_ATLAS_INCLUDE_DIR
+#endif
+
#if defined(ARMA_DONT_PRINT_LOGIC_ERRORS)
#undef ARMA_PRINT_LOGIC_ERRORS
#endif
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -158,8 +158,8 @@
if(prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed || Proxy<T2>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P1 = x.P1.get_ea();
typename Proxy<T2>::ea_type P2 = x.P2.get_ea();
@@ -208,8 +208,8 @@
if(prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed || Proxy<T2>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P1 = x.P1.get_ea();
typename Proxy<T2>::ea_type P2 = x.P2.get_ea();
@@ -255,8 +255,8 @@
if(prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed || Proxy<T2>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P1 = x.P1.get_ea();
typename Proxy<T2>::ea_type P2 = x.P2.get_ea();
@@ -302,8 +302,8 @@
if(prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed || Proxy<T2>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P1 = x.P1.get_ea();
typename Proxy<T2>::ea_type P2 = x.P2.get_ea();
@@ -349,8 +349,8 @@
if(prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed || Proxy<T2>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P1 = x.P1.get_ea();
typename Proxy<T2>::ea_type P2 = x.P2.get_ea();
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -140,8 +140,8 @@
if(Proxy<T1>::prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly can cause a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P = x.P.get_ea();
@@ -181,8 +181,8 @@
if(Proxy<T1>::prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly can cause a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P = x.P.get_ea();
@@ -219,8 +219,8 @@
if(Proxy<T1>::prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly can cause a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P = x.P.get_ea();
@@ -257,8 +257,8 @@
if(Proxy<T1>::prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly can cause a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P = x.P.get_ea();
@@ -295,8 +295,8 @@
if(Proxy<T1>::prefer_at_accessor == false)
{
- const uword n_elem = out.n_elem;
- //const uword n_elem = x.get_n_elem(); // for fixed-sized matrices this causes a mis-optimisation (slowdown) of the loop under GCC 4.4
+ // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly can cause a mis-optimisation (slowdown) of the loop under GCC 4.4
+ const uword n_elem = (Proxy<T1>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;
typename Proxy<T1>::ea_type P = x.P.get_ea();
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_norm.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -436,14 +436,8 @@
{
arma_extra_debug_sigprint();
- typedef typename T1::elem_type eT;
- typedef typename T1::pod_type T;
-
- const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
- const Mat<eT>& X = tmp.M;
-
// TODO: this can be sped up with a dedicated implementation
- return as_scalar( max( sum(abs(X)), 1) );
+ return as_scalar( max( sum(abs(P.Q), 0), 1) );
}
@@ -455,14 +449,12 @@
{
arma_extra_debug_sigprint();
- typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
- const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
- const Mat<eT>& X = tmp.M;
+ // TODO: is the SVD based approach only valid for square matrices?
Col<T> S;
- svd(S, X);
+ svd(S, P.Q);
return (S.n_elem > 0) ? max(S) : T(0);
}
@@ -476,14 +468,8 @@
{
arma_extra_debug_sigprint();
- typedef typename T1::elem_type eT;
- typedef typename T1::pod_type T;
-
- const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
- const Mat<eT>& X = tmp.M;
-
// TODO: this can be sped up with a dedicated implementation
- return as_scalar( max( sum(abs(X),1) ) );
+ return as_scalar( max( sum(abs(P.Q), 1), 0) );
}
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -35,12 +35,12 @@
typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
- uword X_n_rows;
- uword X_n_cols;
+ uword X_n_rows;
+ uword X_n_cols;
Col<T> s;
- const bool status = auxlib::svd(s, X, X_n_rows, X_n_cols);
- const uword n_elem = s.n_elem;
+ const bool status = auxlib::svd(s, X, X_n_rows, X_n_cols);
+ const uword n_elem = s.n_elem;
if(status == true)
{
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trace.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trace.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trace.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -27,11 +27,11 @@
typedef typename T1::elem_type eT;
const Proxy<T1> A(X.get_ref());
-
+
arma_debug_check( (A.get_n_rows() != A.get_n_cols()), "trace(): matrix must be square sized" );
const uword N = A.get_n_rows();
- eT val = eT(0);
+ eT val = eT(0);
for(uword i=0; i<N; ++i)
{
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -30,18 +30,18 @@
if(A_n_rows == A_n_cols)
{
- status = auxlib::solve_new(out, A, X, slow);
+ status = auxlib::solve(out, A, X, slow);
}
else
if(A_n_rows > A_n_cols)
{
arma_extra_debug_print("solve(): detected over-determined system");
- status = auxlib::solve_new_od(out, A, X);
+ status = auxlib::solve_od(out, A, X);
}
else
{
arma_extra_debug_print("solve(): detected under-determined system");
- status = auxlib::solve_new_ud(out, A, X);
+ status = auxlib::solve_ud(out, A, X);
}
if(status == false)
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/op_htrans_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/op_htrans_meat.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/op_htrans_meat.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -389,13 +389,10 @@
const Proxy<T1> P(X);
- if(
- (is_Mat<typename Proxy<T1>::stored_type>::value || is_Mat_fixed<typename Proxy<T1>::stored_type>::value)
- &&
- (Proxy<T1>::fake_mat == false) // can't rely on simple alias checking for matrices constructed out of auxiliary memory
- )
+ // allow detection of in-place transpose
+ if( (is_Mat<typename Proxy<T1>::stored_type>::value == true) && (Proxy<T1>::fake_mat == false) )
{
- const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q); // need this unwrap to keep stupid compilers happy
+ const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
op_htrans2::apply(out, tmp.M, val);
}
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp 2012-05-15 13:06:58 UTC (rev 3608)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp 2012-05-15 23:54:18 UTC (rev 3609)
@@ -209,13 +209,10 @@
const Proxy<T1> P(X);
- if(
- (is_Mat<typename Proxy<T1>::stored_type>::value || is_Mat_fixed<typename Proxy<T1>::stored_type>::value)
- &&
- (Proxy<T1>::fake_mat == false) // can't rely on simple alias checking for matrices constructed out of auxiliary memory
- )
+ // allow detection of in-place transpose
+ if( (is_Mat<typename Proxy<T1>::stored_type>::value == true) && (Proxy<T1>::fake_mat == false) )
{
- const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q); // need this unwrap to keep stupid compilers happy
+ const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
op_strans::apply(out, tmp.M);
}
More information about the Rcpp-commits
mailing list