[Rcpp-commits] r1902 - in pkg/RcppArmadillo: . inst/include inst/include/armadillo_bits
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 3 20:41:48 CEST 2010
Author: romain
Date: 2010-08-03 20:41:46 +0200 (Tue, 03 Aug 2010)
New Revision: 1902
Added:
pkg/RcppArmadillo/inst/include/armadillo_bits/injector_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/injector_proto.hpp
Modified:
pkg/RcppArmadillo/DESCRIPTION
pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h
pkg/RcppArmadillo/inst/include/armadillo
pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eop_cube_core_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eop_cube_core_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/field_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trig.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/forward_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_princomp_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_reshape_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/podarray_proto.hpp
Log:
dump of svn version of armadillo
Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/DESCRIPTION 2010-08-03 18:41:46 UTC (rev 1902)
@@ -1,7 +1,7 @@
Package: RcppArmadillo
Type: Package
Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.2.4
+Version: 0.2.4.1
Date: $Date$
Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
Maintainer: Romain, Dirk and Doug <RcppArmadillo-authors at r-enthusiasts.com>
@@ -28,7 +28,7 @@
capabilities of the Rcpp package for seamless R and C++ integration.
License: GPL (>= 2)
LazyLoad: yes
-Depends: R (>= 2.10.0), Rcpp (>= 0.8.4)
+Depends: R (>= 2.10.0), Rcpp (>= 0.8.5)
LinkingTo: Rcpp
Suggests: inline, RUnit
SystemRequirements: GNU make
Modified: pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h
===================================================================
--- pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/RcppArmadilloForward.h 2010-08-03 18:41:46 UTC (rev 1902)
@@ -23,6 +23,7 @@
#define RcppArmadillo__RcppArmadilloForward__h
#include <RcppCommon.h>
+
#include <armadillo>
/* forward declarations */
Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo 2010-08-03 18:41:46 UTC (rev 1902)
@@ -18,9 +18,6 @@
#define ARMA_INCLUDES
-#include "armadillo_bits/config.hpp"
-#include "armadillo_bits/compiler_setup.hpp"
-
#include <cstdlib>
#include <cstring>
#include <climits>
@@ -36,6 +33,10 @@
#include <vector>
+#include "armadillo_bits/config.hpp"
+#include "armadillo_bits/compiler_setup.hpp"
+
+
#if defined(ARMA_HAVE_GETTIMEOFDAY)
#include <sys/time.h>
#undef ARMA_USE_BOOST_DATE
@@ -136,6 +137,8 @@
#include "armadillo_bits/Base.hpp"
#include "armadillo_bits/BaseCube.hpp"
+ #include "armadillo_bits/injector_proto.hpp"
+
#include "armadillo_bits/Mat_proto.hpp"
#include "armadillo_bits/Col_proto.hpp"
#include "armadillo_bits/Row_proto.hpp"
@@ -365,6 +368,8 @@
#include "armadillo_bits/podarray_meat.hpp"
#include "armadillo_bits/auxlib_meat.hpp"
+ #include "armadillo_bits/injector_meat.hpp"
+
#include "armadillo_bits/Mat_meat.hpp"
#include "armadillo_bits/Col_meat.hpp"
#include "armadillo_bits/Row_meat.hpp"
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -408,6 +408,16 @@
template<typename eT>
+inline
+mat_injector< Col<eT> >
+Col<eT>::operator<<(const eT val)
+ {
+ return mat_injector< Col<eT> >(*this, val);
+ }
+
+
+
+template<typename eT>
arma_inline
eT&
Col<eT>::row(const u32 row_num)
@@ -766,6 +776,20 @@
+template<typename eT>
+inline
+void
+Col<eT>::reshape(const u32 in_rows, const u32 in_cols, const u32 dim)
+ {
+ arma_extra_debug_sigprint();
+
+ Mat<eT>::reshape(in_rows, in_cols, dim);
+
+ arma_debug_check( (in_cols > 1), "Col::set_size(): incompatible dimensions" );
+ }
+
+
+
//! change the number of n_rows (this function re-implements mat::copy_size() in order to check the number of columns)
template<typename eT>
template<typename eT2>
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -65,6 +65,8 @@
inline Col(const diagview<eT>& X);
inline const Col& operator=(const diagview<eT>& X);
inline const Col& operator*=(const diagview<eT>& X);
+
+ inline mat_injector<Col> operator<<(const eT val);
arma_inline eT& row(const u32 row_num);
arma_inline eT row(const u32 row_num) const;
@@ -98,6 +100,7 @@
inline void set_size(const u32 n_elem);
inline void set_size(const u32 n_rows, const u32 n_cols);
+ inline void reshape(const u32 n_rows, const u32 n_cols, const u32 dim = 0);
template<typename eT2>
inline void copy_size(const Mat<eT2>& m);
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -1617,6 +1617,19 @@
+//! change the cube to have user specified dimensions (data is preserved)
+template<typename eT>
+inline
+void
+Cube<eT>::reshape(const u32 in_rows, const u32 in_cols, const u32 in_slices, const u32 dim)
+ {
+ arma_extra_debug_sigprint();
+
+ *this = arma::reshape(*this, in_rows, in_cols, in_slices, dim);
+ }
+
+
+
//! change the cube (without preserving data) to have the same dimensions as the given cube
template<typename eT>
template<typename eT2>
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -147,6 +147,7 @@
inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
inline void set_size(const u32 in_rows, const u32 in_cols, const u32 in_slices);
+ inline void reshape(const u32 in_rows, const u32 in_cols, const u32 in_slices, const u32 dim = 0);
template<typename eT2> inline void copy_size(const Cube<eT2>& m);
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -1035,6 +1035,26 @@
+template<typename eT>
+inline
+mat_injector< Mat<eT> >
+Mat<eT>::operator<<(const eT val)
+ {
+ return mat_injector< Mat<eT> >(*this, val);
+ }
+
+
+
+template<typename eT>
+inline
+mat_injector< Mat<eT> >
+Mat<eT>::operator<<(const injector_helper x)
+ {
+ return mat_injector< Mat<eT> >(*this, x);
+ }
+
+
+
//! creation of subview (row vector)
template<typename eT>
arma_inline
@@ -2496,15 +2516,28 @@
template<typename eT>
inline
void
-Mat<eT>::set_size(const u32 in_n_rows, const u32 in_n_cols)
+Mat<eT>::set_size(const u32 in_rows, const u32 in_cols)
{
arma_extra_debug_sigprint();
- init(in_n_rows, in_n_cols);
+ init(in_rows, in_cols);
}
+//! change the matrix to have user specified dimensions (data is preserved)
+template<typename eT>
+inline
+void
+Mat<eT>::reshape(const u32 in_rows, const u32 in_cols, const u32 dim)
+ {
+ arma_extra_debug_sigprint();
+
+ *this = arma::reshape(*this, in_rows, in_cols, dim);
+ }
+
+
+
//! change the matrix (without preserving data) to have the same dimensions as the given matrix
template<typename eT>
template<typename eT2>
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -97,6 +97,11 @@
inline const Mat& operator%=(const diagview<eT>& X);
inline const Mat& operator/=(const diagview<eT>& X);
+
+ inline mat_injector<Mat> operator<<(const eT val);
+ inline mat_injector<Mat> operator<<(const injector_helper x);
+
+
arma_inline subview_row<eT> row(const u32 row_num);
arma_inline const subview_row<eT> row(const u32 row_num) const;
@@ -212,6 +217,7 @@
inline void copy_size(const Mat<eT2>& m);
inline void set_size(const u32 in_rows, const u32 in_cols);
+ inline void reshape(const u32 in_rows, const u32 in_cols, const u32 dim = 0);
arma_hot inline void fill(const eT val);
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -381,6 +381,16 @@
template<typename eT>
+inline
+mat_injector< Row<eT> >
+Row<eT>::operator<<(const eT val)
+ {
+ return mat_injector< Row<eT> >(*this, val);
+ }
+
+
+
+template<typename eT>
arma_inline
eT&
Row<eT>::col(const u32 col_num)
@@ -740,6 +750,20 @@
template<typename eT>
+inline
+void
+Row<eT>::reshape(const u32 in_rows, const u32 in_cols, const u32 dim)
+ {
+ arma_extra_debug_sigprint();
+
+ Mat<eT>::reshape(in_rows, in_cols, dim);
+
+ arma_debug_check( (in_rows > 1), "Row::set_size(): incompatible dimensions" );
+ }
+
+
+
+template<typename eT>
template<typename eT2>
inline
void
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -66,6 +66,8 @@
inline explicit Row(const diagview<eT>& X);
inline const Row& operator=(const diagview<eT>& X);
inline const Row& operator*=(const diagview<eT>& X);
+
+ inline mat_injector<Row> operator<<(const eT val);
arma_inline eT& col(const u32 col_num);
arma_inline eT col(const u32 col_num) const;
@@ -99,6 +101,7 @@
inline void set_size(const u32 N);
inline void set_size(const u32 n_rows, const u32 n_cols);
+ inline void reshape(const u32 n_rows, const u32 n_cols, const u32 dim = 0);
template<typename eT2>
inline void copy_size(const Mat<eT2>& m);
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -19,18 +19,25 @@
+#define ARMA_VERSION_MAJOR 0
+#define ARMA_VERSION_MINOR 9
+#define ARMA_VERSION_PATCH 58
+#define ARMA_VERSION_NAME "Killer Bush Turkey"
+// http://en.wikipedia.org/wiki/Australian_Brush-turkey
+
+
struct arma_version
{
- static const unsigned int major = 0;
- static const unsigned int minor = 9;
- static const unsigned int patch = 52;
+ static const unsigned int major = ARMA_VERSION_MAJOR;
+ static const unsigned int minor = ARMA_VERSION_MINOR;
+ static const unsigned int patch = ARMA_VERSION_PATCH;
static
inline
std::string
as_string()
{
- const char* nickname = "Monkey Wrench";
+ const char* nickname = ARMA_VERSION_NAME;
std::stringstream ss;
ss << arma_version::major
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -1,9 +1,9 @@
// Copyright (C) 2010 NICTA and the authors listed below
// http://nicta.com.au
-//
+//
// Authors:
// - Conrad Sanderson (conradsand at ieee dot org)
-//
+//
// This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness
// for any purpose. You can redistribute this file
@@ -115,11 +115,11 @@
// complex acosh
// complex asinh
// complex atanh
-//
-//
+//
+//
// If TR1 not present and Boost math not present,
// we have our own rudimentary versions of:
-//
+//
// real acosh
// real asinh
// real atanh
@@ -223,7 +223,7 @@
}
-#if !defined(ARMA_OLD_MINGW)
+
template<typename eT>
arma_inline
eT
@@ -336,7 +336,6 @@
#endif
}
-#endif
#undef arma_boost_wrap
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -1,9 +1,9 @@
// Copyright (C) 2010 NICTA and the authors listed below
// http://nicta.com.au
-//
+//
// Authors:
// - Conrad Sanderson (conradsand at ieee dot org)
-//
+//
// This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness
// for any purpose. You can redistribute this file
@@ -25,59 +25,55 @@
#define arma_deprecated
#if defined(__GNUG__)
-
+
#if (__GNUC__ < 4)
#error "*** Need a newer compiler ***"
#endif
-
+
#define ARMA_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-
+
#define ARMA_GOOD_COMPILER
#undef ARMA_HAVE_STD_TR1
-
+
#undef arma_pure
#undef arma_const
#undef arma_inline
#undef arma_aligned
#undef arma_warn_unused
#undef arma_deprecated
-
+
#define arma_pure __attribute__((pure))
#define arma_const __attribute__((const))
#define arma_inline inline __attribute__((always_inline))
#define arma_aligned __attribute__((aligned))
#define arma_warn_unused __attribute__((warn_unused_result))
#define arma_deprecated __attribute__((deprecated))
-
+
#if (ARMA_GCC_VERSION >= 40200)
- #define ARMA_HAVE_STD_TR1
+ #if defined(_GLIBCXX_USE_C99_MATH_TR1) && defined(_GLIBCXX_USE_C99_COMPLEX_TR1)
+ #define ARMA_HAVE_STD_TR1
+ #endif
#endif
-
+
#if (ARMA_GCC_VERSION >= 40300)
#undef arma_hot
#undef arma_cold
-
+
#define arma_hot __attribute__((hot))
#define arma_cold __attribute__((cold))
#endif
-
- #if (ARMA_GCC_VERSION < 40300)
- #if defined __MINGW32_VERSION
- #define ARMA_OLD_MINGW
- #endif
- #endif
-
+
#undef ARMA_GCC_VERSION
-
+
#elif defined(__INTEL_COMPILER)
-
+
#if (__INTEL_COMPILER < 1000)
#error "*** Need a newer compiler ***"
#endif
-
+
#define ARMA_GOOD_COMPILER
#undef ARMA_HAVE_STD_TR1
-
+
#if (__INTEL_COMPILER <= 1110)
#undef ARMA_HAVE_STD_ISFINITE
#endif
@@ -86,9 +82,9 @@
#if defined(_MSC_VER)
-
+
#pragma message ("*** WARNING: This compiler may have an incomplete implementation of the C++ standard ***")
-
+
#undef ARMA_GOOD_COMPILER
#undef ARMA_HAVE_STD_ISFINITE
#undef ARMA_HAVE_STD_SNPRINTF
@@ -96,10 +92,10 @@
#undef ARMA_HAVE_STD_ISINF
#undef ARMA_HAVE_STD_ISNAN
#undef ARMA_HAVE_STD_TR1
-
+
#undef arma_inline
#define arma_inline inline __forceinline
-
+
#endif
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/config.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -38,8 +38,8 @@
#define ARMA_HAVE_STD_ISNAN
#define ARMA_HAVE_STD_SNPRINTF
-#define ARMA_HAVE_LOG1P
-#define ARMA_HAVE_GETTIMEOFDAY
+// #define ARMA_HAVE_LOG1P
+// #define ARMA_HAVE_GETTIMEOFDAY
// #define ARMA_EXTRA_DEBUG
// #define ARMA_NO_DEBUG
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -1,9 +1,9 @@
// Copyright (C) 2010 NICTA and the authors listed below
// http://nicta.com.au
-//
+//
// Authors:
// - Conrad Sanderson (conradsand at ieee dot org)
-//
+//
// This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness
// for any purpose. You can redistribute this file
@@ -30,7 +30,7 @@
};
-
+
template<typename T>
struct eop_aux_randu< std::complex<T> >
{
@@ -53,20 +53,20 @@
// {
// const u32 N = 12; // N must be >= 12 and an even number
// const u32 N2 = N/2;
- //
+ //
// eT acc = eT(0);
- //
+ //
// for(u32 i=0; i<N2; ++i)
// {
// const eT tmp1 = eT(std::rand()) / eT(RAND_MAX);
// const eT tmp2 = eT(std::rand()) / eT(RAND_MAX);
// acc += tmp1+tmp2;
// }
- //
+ //
// return acc - eT(N2);
// }
-
-
+
+
// polar form of the Box-Muller transformation
// http://en.wikipedia.org/wiki/Box-Muller_transformation
// http://en.wikipedia.org/wiki/Marsaglia_polar_method
@@ -75,11 +75,11 @@
{
// make sure we are internally using at least floats
typedef typename promote_type<eT,float>::result eTp;
-
+
eTp tmp1;
eTp tmp2;
eTp w;
-
+
do
{
tmp1 = eTp(2) * eTp(std::rand()) / eTp(RAND_MAX) - eTp(1);
@@ -87,11 +87,11 @@
w = tmp1*tmp1 + tmp2*tmp2;
}
while ( w >= eTp(1) );
-
+
return eT( tmp1 * std::sqrt( (eTp(-2) * std::log(w)) / w) );
}
-
-
+
+
// other methods:
// http://en.wikipedia.org/wiki/Ziggurat_algorithm
//
@@ -122,32 +122,30 @@
class eop_aux
{
public:
-
+
template<typename eT> arma_inline static typename arma_integral_only<eT>::result acos (const eT& x) { return std::acos(double(x)); }
template<typename eT> arma_inline static typename arma_integral_only<eT>::result asin (const eT& x) { return std::asin(double(x)); }
template<typename eT> arma_inline static typename arma_integral_only<eT>::result atan (const eT& x) { return std::atan(double(x)); }
-
+
template<typename eT> arma_inline static typename arma_float_only<eT>::result acos (const eT& x) { return std::acos(x); }
template<typename eT> arma_inline static typename arma_float_only<eT>::result asin (const eT& x) { return std::asin(x); }
template<typename eT> arma_inline static typename arma_float_only<eT>::result atan (const eT& x) { return std::atan(x); }
-
+
template<typename eT> arma_inline static typename arma_cx_only<eT>::result acos (const eT& x) { return arma_acos(x); }
template<typename eT> arma_inline static typename arma_cx_only<eT>::result asin (const eT& x) { return arma_asin(x); }
template<typename eT> arma_inline static typename arma_cx_only<eT>::result atan (const eT& x) { return arma_atan(x); }
-
-#if !defined(ARMA_OLD_MINGW)
+
template<typename eT> arma_inline static typename arma_integral_only<eT>::result acosh (const eT& x) { return arma_acosh(double(x)); }
template<typename eT> arma_inline static typename arma_integral_only<eT>::result asinh (const eT& x) { return arma_asinh(double(x)); }
template<typename eT> arma_inline static typename arma_integral_only<eT>::result atanh (const eT& x) { return arma_atanh(double(x)); }
-
+
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result acosh (const eT& x) { return arma_acosh(x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result asinh (const eT& x) { return arma_asinh(x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result atanh (const eT& x) { return arma_atanh(x); }
-#endif
-
+
template<typename eT> arma_inline static eT conj(const eT& x) { return x; }
template<typename T> arma_inline static std::complex<T> conj(const std::complex<T>& x) { return std::conj(x); }
-
+
template<typename eT> arma_inline static typename arma_integral_only<eT>::result sqrt (const eT& x) { return std::sqrt (double(x)); }
template<typename eT> arma_inline static typename arma_integral_only<eT>::result log10 (const eT& x) { return std::log10(double(x)); }
template<typename eT> arma_inline static typename arma_integral_only<eT>::result log (const eT& x) { return std::log (double(x)); }
@@ -158,7 +156,7 @@
template<typename eT> arma_inline static typename arma_integral_only<eT>::result cosh (const eT& x) { return std::cosh (double(x)); }
template<typename eT> arma_inline static typename arma_integral_only<eT>::result sinh (const eT& x) { return std::sinh (double(x)); }
template<typename eT> arma_inline static typename arma_integral_only<eT>::result tanh (const eT& x) { return std::tanh (double(x)); }
-
+
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result sqrt (const eT& x) { return std::sqrt (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result log10 (const eT& x) { return std::log10(x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result log (const eT& x) { return std::log (x); }
@@ -169,9 +167,9 @@
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result cosh (const eT& x) { return std::cosh (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result sinh (const eT& x) { return std::sinh (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<eT>::result tanh (const eT& x) { return std::tanh (x); }
-
-
-
+
+
+
template<typename T1, typename T2>
arma_inline
static
@@ -180,9 +178,9 @@
{
return std::pow(base, exponent);
}
-
-
-
+
+
+
template<typename T1, typename T2>
arma_inline
static
@@ -191,31 +189,31 @@
{
return T1( std::pow( double(base), double(exponent) ) );
}
-
-
-
+
+
+
template<typename T1>
arma_inline
static
typename arma_float_or_cx_only<T1>::result
pow_int(const T1 base, const int exponent)
- {
+ {
return std::pow(base, exponent);
}
-
-
-
+
+
+
template<typename T1>
arma_inline
static
typename arma_integral_only<T1>::result
pow_int(const T1 base, const int exponent)
- {
+ {
return T1( std::pow( double(base), exponent) );
}
-
-
-
+
+
+
template<typename eT>
arma_inline
static
@@ -224,9 +222,9 @@
{
return eT(0);
}
-
-
-
+
+
+
template<typename eT>
inline
static
@@ -234,22 +232,22 @@
direct_eps(const eT& x)
{
//arma_extra_debug_sigprint();
-
+
// acording to IEEE Standard for Floating-Point Arithmetic (IEEE 754)
// the mantissa length for double is 53 bits = std::numeric_limits<double>::digits
// the mantissa length for float is 24 bits = std::numeric_limits<float >::digits
-
+
//return std::pow( std::numeric_limits<eT>::radix, (std::floor(std::log10(std::abs(x))/std::log10(std::numeric_limits<eT>::radix))-(std::numeric_limits<eT>::digits-1)) );
-
+
const eT radix_eT = eT(std::numeric_limits<eT>::radix);
const eT digits_m1_eT = eT(std::numeric_limits<eT>::digits - 1);
-
+
// return std::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/std::log10(radix_eT)) - digits_m1_eT) );
return eop_aux::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/std::log10(radix_eT)) - digits_m1_eT) );
}
-
-
-
+
+
+
template<typename T>
inline
static
@@ -257,32 +255,32 @@
direct_eps(const std::complex<T>& x)
{
//arma_extra_debug_sigprint();
-
+
//return std::pow( std::numeric_limits<T>::radix, (std::floor(std::log10(std::abs(x))/std::log10(std::numeric_limits<T>::radix))-(std::numeric_limits<T>::digits-1)) );
-
+
const T radix_T = T(std::numeric_limits<T>::radix);
const T digits_m1_T = T(std::numeric_limits<T>::digits - 1);
-
+
return std::pow( radix_T, T(std::floor(std::log10(std::abs(x))/std::log10(radix_T)) - digits_m1_T) );
}
-
-
-
+
+
+
//! work around a bug in GCC 4.4
template<typename eT> arma_inline static
typename arma_unsigned_integral_only<eT>::result arma_abs(const eT& x) { return x; }
-
+
template<typename eT> arma_inline static
typename arma_signed_integral_only<eT>::result arma_abs(const eT& x) { return std::abs(x); }
-
+
template<typename eT> arma_inline static
typename arma_float_only<eT>::result arma_abs(const eT& x) { return std::abs(x); }
-
+
template<typename T> arma_inline static
typename arma_float_only<T>::result arma_abs(const std::complex<T>& x) { return std::abs(x); }
-
-
-
+
+
+
template<typename eT, typename eop_type>
arma_inline
static
@@ -299,7 +297,7 @@
else if(is_same_type<eop_type, eop_cube_ones_full>::value == true) { return eT(1); }
else { return eT(0); }
}
-
+
};
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp 2010-08-02 14:39:37 UTC (rev 1901)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp 2010-08-03 18:41:46 UTC (rev 1902)
@@ -1,9 +1,9 @@
// Copyright (C) 2010 NICTA and the authors listed below
// http://nicta.com.au
-//
+//
// Authors:
// - Conrad Sanderson (conradsand at ieee dot org)
-//
+//
// This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness
// for any purpose. You can redistribute this file
@@ -27,7 +27,7 @@
eop_core<eop_type>::get_elem(const eOp<T1, eop_type>& x, const u32 i)
{
typedef typename T1::elem_type eT;
-
+
if(is_generator<eop_type>::value == true) { return eop_aux::generate<eT,eop_type>(); }
else if(is_same_type<eop_type, eop_ones_diag>::value == true) { return ((i % x.P.n_rows) == (i / x.P.n_rows)) ? eT(1) : eT(0); }
else { return eop_core<eop_type>::process(x, x.P[i]); }
@@ -43,7 +43,7 @@
eop_core<eop_type>::get_elem(const eOp<T1, eop_type>& x, const u32 row, const u32 col)
{
typedef typename T1::elem_type eT;
-
+
if(is_generator<eop_type>::value == true) { return eop_aux::generate<eT,eop_type>(); }
else if(is_same_type<eop_type, eop_ones_diag>::value == true) { return (row == col) ? eT(1) : eT(0); }
else { return eop_core<eop_type>::process(x, x.P.at(row, col)); }
@@ -59,9 +59,9 @@
eop_core<eop_type>::process(const eOp<T1, eop_type>& x, const typename T1::elem_type val)
{
typedef typename T1::elem_type eT;
-
+
// the optimiser will keep only one return statement
-
+
if(is_same_type<eop_type, eop_neg >::value == true) { return -val; }
else if(is_same_type<eop_type, eop_scalar_plus >::value == true) { return val + x.aux; }
else if(is_same_type<eop_type, eop_scalar_minus_pre >::value == true) { return x.aux - val; }
@@ -85,11 +85,9 @@
else if(is_same_type<eop_type, eop_cosh >::value == true) { return eop_aux::cosh(val); }
else if(is_same_type<eop_type, eop_sinh >::value == true) { return eop_aux::sinh(val); }
else if(is_same_type<eop_type, eop_tanh >::value == true) { return eop_aux::tanh(val); }
-#if !defined(ARMA_OLD_MINGW)
else if(is_same_type<eop_type, eop_acosh >::value == true) { return eop_aux::acosh(val); }
else if(is_same_type<eop_type, eop_asinh >::value == true) { return eop_aux::asinh(val); }
else if(is_same_type<eop_type, eop_atanh >::value == true) { return eop_aux::atanh(val); }
-#endif
else if(is_same_type<eop_type, eop_eps >::value == true) { return eop_aux::direct_eps(val); }
else if(is_same_type<eop_type, eop_abs >::value == true) { return eop_aux::arma_abs(val); }
else if(is_same_type<eop_type, eop_conj >::value == true) { return eop_aux::conj(val); }
@@ -97,7 +95,7 @@
else if(is_same_type<eop_type, eop_pow_int >::value == true)
{
const int exponent = (x.aux_u32_b == 0) ? int(x.aux_u32_a) : -int(x.aux_u32_a);
-
+
return eop_aux::pow_int(val, exponent);
}
else
@@ -117,7 +115,7 @@
eop_core<eop_type>::apply(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
{
arma_extra_debug_sigprint();
-
+
if(is_Mat<T1>::value == true)
{
eop_core<eop_type>::apply_unwrap(out, x);
@@ -138,20 +136,20 @@
eop_core<eop_type>::apply_proxy(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
{
arma_extra_debug_sigprint();
-
+
// eop_type::apply_proxy() function is not allowed to unwrap things
// (in order to get the input into a common format).
// the proxy class is already providing objects with element access
-
+
typedef typename T1::elem_type eT;
-
+
const Proxy<T1>& P = x.P;
-
+
out.set_size(P.n_rows, P.n_cols);
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_generator<eop_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -166,9 +164,9 @@
for(u32 col=0; col<P.n_rows; ++col)
{
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0); }
-
+
out.at(col,col) = eT(1);
-
+
for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) = eT(0); }
}
}
@@ -192,22 +190,22 @@
eop_core<eop_type>::apply_unwrap(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const Proxy<T1>& P = x.P;
-
+
// cout << "*** P.n_rows = " << P.n_rows << endl;
// cout << "*** P.n_cols = " << P.n_cols << endl;
-
+
out.set_size(P.n_rows, P.n_cols);
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
const Mat<eT>& A = tmp.M;
-
+
if(is_generator<eop_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -222,16 +220,16 @@
for(u32 col=0; col<P.n_rows; ++col)
{
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0); }
-
+
out.at(col,col) = eT(1);
-
+
for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) = eT(0); }
}
}
else
{
const eT* A_mem = A.memptr();
-
+
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = eop_core<eop_type>::process(x, A_mem[i]);
@@ -250,16 +248,16 @@
eop_core<eop_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const Proxy<T1>& P = x.P;
-
+
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, "matrix addition");
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_generator<eop_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -296,16 +294,16 @@
eop_core<eop_type>::apply_inplace_minus(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const Proxy<T1>& P = x.P;
-
+
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, "matrix subtraction");
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_generator<eop_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -342,16 +340,16 @@
eop_core<eop_type>::apply_inplace_schur(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const Proxy<T1>& P = x.P;
-
+
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, "element-wise matrix multiplication");
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_generator<eop_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -389,16 +387,16 @@
eop_core<eop_type>::apply_inplace_div(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const Proxy<T1>& P = x.P;
-
+
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, "element-wise matrix division");
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_generator<eop_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_proto.hpp
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 1902
More information about the Rcpp-commits
mailing list