[Rcpp-commits] r1873 - in pkg/RcppArmadillo/inst: . include/armadillo_bits
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jul 28 16:28:49 CEST 2010
Author: edd
Date: 2010-07-28 16:28:49 +0200 (Wed, 28 Jul 2010)
New Revision: 1873
Modified:
pkg/RcppArmadillo/inst/ChangeLog
pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.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/fn_trig.hpp
Log:
added small compiler test for MinGW 4.2 (i.e. win32 only) which is used to hide asinh, acosh and atanh which upset this older g++ version
Modified: pkg/RcppArmadillo/inst/ChangeLog
===================================================================
--- pkg/RcppArmadillo/inst/ChangeLog 2010-07-27 12:08:03 UTC (rev 1872)
+++ pkg/RcppArmadillo/inst/ChangeLog 2010-07-28 14:28:49 UTC (rev 1873)
@@ -1,7 +1,12 @@
-2010-07-27 Dirk Eddelbuettel <edd at debian.org>
+2010-07-28 <deddelbuettel at WTSTAT-08>
* DESCRIPTION: Release 0.2.4
+ * inst/include/armadillo_bits: Added small patch to not use asinh,
+ acosh and atanh on win32 as the (older) MinGW compiler cannot cope.
+ This problem will go away once R 2.12 is released as it requires
+ gcc / g++ 4.5.
+
2010-07-25 Dirk Eddelbuettel <edd at debian.org>
* inst/include/* : upgrade to armadillo 0.9.52 "Monkey Wrench"
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp 2010-07-27 12:08:03 UTC (rev 1872)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/cmath_wrap.hpp 2010-07-28 14:28:49 UTC (rev 1873)
@@ -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,6 +336,7 @@
#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-07-27 12:08:03 UTC (rev 1872)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp 2010-07-28 14:28:49 UTC (rev 1873)
@@ -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,53 +25,59 @@
#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
#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
@@ -80,9 +86,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
@@ -90,10 +96,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/eop_aux.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp 2010-07-27 12:08:03 UTC (rev 1872)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_aux.hpp 2010-07-28 14:28:49 UTC (rev 1873)
@@ -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,30 +122,32 @@
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)); }
@@ -156,7 +158,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); }
@@ -167,9 +169,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
@@ -178,9 +180,9 @@
{
return std::pow(base, exponent);
}
-
-
-
+
+
+
template<typename T1, typename T2>
arma_inline
static
@@ -189,31 +191,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
@@ -222,9 +224,9 @@
{
return eT(0);
}
-
-
-
+
+
+
template<typename eT>
inline
static
@@ -232,22 +234,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
@@ -255,32 +257,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
@@ -297,7 +299,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-07-27 12:08:03 UTC (rev 1872)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp 2010-07-28 14:28:49 UTC (rev 1873)
@@ -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,9 +85,11 @@
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); }
@@ -95,7 +97,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
@@ -115,7 +117,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);
@@ -136,20 +138,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)
@@ -164,9 +166,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); }
}
}
@@ -190,22 +192,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)
@@ -220,16 +222,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]);
@@ -248,16 +250,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)
@@ -294,16 +296,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)
@@ -340,16 +342,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)
@@ -387,16 +389,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
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_proto.hpp 2010-07-27 12:08:03 UTC (rev 1872)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_core_proto.hpp 2010-07-28 14:28:49 UTC (rev 1873)
@@ -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
@@ -23,27 +23,27 @@
class eop_core
{
public:
-
+
arma_inline static const char* error_msg() { return ""; }
-
+
arma_inline static bool size_ok(const u32 n_rows, const u32 n_cols) { return true; }
-
+
template<typename T1> arma_hot arma_inline static typename T1::elem_type get_elem(const eOp<T1, eop_type>& x, const u32 i);
template<typename T1> arma_hot arma_inline static typename T1::elem_type get_elem(const eOp<T1, eop_type>& x, const u32 row, const u32 col);
-
+
template<typename T1> arma_hot arma_inline static typename T1::elem_type process(const eOp<T1, eop_type>& x, const typename T1::elem_type val);
template<typename T1> arma_hot arma_inline static void apply(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
-
+
template<typename T1> arma_hot inline static void apply_proxy (Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_unwrap(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
-
+
template<typename T1> arma_hot inline static void apply_inplace_plus (Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_minus(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_schur(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_div (Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
-
+
};
@@ -71,9 +71,11 @@
class eop_cosh : public eop_core<eop_cosh> {};
class eop_sinh : public eop_core<eop_sinh> {};
class eop_tanh : public eop_core<eop_tanh> {};
+#if !defined(ARMA_OLD_MINGW)
class eop_acosh : public eop_core<eop_acosh> {};
class eop_asinh : public eop_core<eop_asinh> {};
class eop_atanh : public eop_core<eop_atanh> {};
+#endif
class eop_eps : public eop_core<eop_eps> {};
class eop_abs : public eop_core<eop_abs> {};
class eop_conj : public eop_core<eop_conj> {};
@@ -83,9 +85,9 @@
class eop_ones_diag : public eop_core<eop_ones_diag>
{
public:
-
+
arma_inline static const char* error_msg() { return "eye(): given size is not square"; }
-
+
arma_inline static bool size_ok(const u32 n_rows, const u32 n_cols) { return (n_rows == n_cols); }
};
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/eop_cube_core_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/eop_cube_core_meat.hpp 2010-07-27 12:08:03 UTC (rev 1872)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/eop_cube_core_meat.hpp 2010-07-28 14:28:49 UTC (rev 1873)
@@ -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_cube_core<eop_cube_type>::get_elem(const eOpCube<T1, eop_cube_type>& x, const u32 i)
{
typedef typename T1::elem_type eT;
-
+
if(is_cube_generator<eop_cube_type>::value == true) { return eop_aux::generate<eT,eop_cube_type>(); }
else { return eop_cube_core<eop_cube_type>::process(x, x.P[i]); }
}
@@ -42,7 +42,7 @@
eop_cube_core<eop_cube_type>::get_elem(const eOpCube<T1, eop_cube_type>& x, const u32 row, const u32 col, const u32 slice)
{
typedef typename T1::elem_type eT;
-
+
if(is_cube_generator<eop_cube_type>::value == true) { return eop_aux::generate<eT,eop_cube_type>(); }
else { return eop_cube_core<eop_cube_type>::process(x, x.P.at(row,col,slice)); }
}
@@ -57,9 +57,9 @@
eop_cube_core<eop_cube_type>::process(const eOpCube<T1, eop_cube_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_cube_type, eop_cube_neg >::value == true) { return -val; }
else if(is_same_type<eop_cube_type, eop_cube_scalar_plus >::value == true) { return val + x.aux; }
else if(is_same_type<eop_cube_type, eop_cube_scalar_minus_pre >::value == true) { return x.aux - val; }
@@ -77,15 +77,21 @@
else if(is_same_type<eop_cube_type, eop_cube_cos >::value == true) { return eop_aux::cos(val); }
else if(is_same_type<eop_cube_type, eop_cube_cosh >::value == true) { return eop_aux::cosh(val); }
else if(is_same_type<eop_cube_type, eop_cube_acos >::value == true) { return eop_aux::acos(val); }
+#if !defined(ARMA_OLD_MINGW)
else if(is_same_type<eop_cube_type, eop_cube_acosh >::value == true) { return eop_aux::acosh(val); }
+#endif
else if(is_same_type<eop_cube_type, eop_cube_sin >::value == true) { return eop_aux::sin(val); }
else if(is_same_type<eop_cube_type, eop_cube_sinh >::value == true) { return eop_aux::sinh(val); }
else if(is_same_type<eop_cube_type, eop_cube_asin >::value == true) { return eop_aux::asin(val); }
+#if !defined(ARMA_OLD_MINGW)
else if(is_same_type<eop_cube_type, eop_cube_asinh >::value == true) { return eop_aux::asinh(val); }
+#endif
else if(is_same_type<eop_cube_type, eop_cube_tan >::value == true) { return eop_aux::tan(val); }
else if(is_same_type<eop_cube_type, eop_cube_tanh >::value == true) { return eop_aux::tanh(val); }
else if(is_same_type<eop_cube_type, eop_cube_atan >::value == true) { return eop_aux::atan(val); }
+#if !defined(ARMA_OLD_MINGW)
else if(is_same_type<eop_cube_type, eop_cube_atanh >::value == true) { return eop_aux::atanh(val); }
+#endif
else if(is_same_type<eop_cube_type, eop_cube_eps >::value == true) { return eop_aux::direct_eps(val);}
else if(is_same_type<eop_cube_type, eop_cube_abs >::value == true) { return eop_aux::arma_abs(val); }
else if(is_same_type<eop_cube_type, eop_cube_conj >::value == true) { return eop_aux::conj(val); }
@@ -93,7 +99,7 @@
else if(is_same_type<eop_cube_type, eop_cube_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
@@ -113,7 +119,7 @@
eop_cube_core<eop_cube_type>::apply(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_cube_type>& x)
{
arma_extra_debug_sigprint();
-
+
if(is_Cube<T1>::value == true)
{
eop_cube_core<eop_cube_type>::apply_unwrap(out, x);
@@ -134,20 +140,20 @@
eop_cube_core<eop_cube_type>::apply_proxy(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_cube_type>& x)
{
arma_extra_debug_sigprint();
-
+
// eop_cube_type::apply() 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 ProxyCube<T1>& P = x.P;
-
+
out.set_size(P.n_rows, P.n_cols, P.n_slices);
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_cube_generator<eop_cube_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -174,16 +180,16 @@
eop_cube_core<eop_cube_type>::apply_unwrap(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_cube_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const ProxyCube<T1>& P = x.P;
-
+
out.set_size(P.n_rows, P.n_cols, P.n_slices);
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_cube_generator<eop_cube_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -194,10 +200,10 @@
else
{
const unwrap_cube<typename ProxyCube<T1>::stored_type> tmp(P.Q);
-
+
const Cube<eT>& A = tmp.M;
const eT* A_mem = A.memptr();
-
+
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = eop_cube_core<eop_cube_type>::process(x, A_mem[i]);
@@ -215,16 +221,16 @@
eop_cube_core<eop_cube_type>::apply_inplace_plus(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_cube_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const ProxyCube<T1>& P = x.P;
-
+
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "cube addition");
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_cube_generator<eop_cube_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -251,16 +257,16 @@
eop_cube_core<eop_cube_type>::apply_inplace_minus(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_cube_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const ProxyCube<T1>& P = x.P;
-
+
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "cube subtraction");
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_cube_generator<eop_cube_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -287,16 +293,16 @@
eop_cube_core<eop_cube_type>::apply_inplace_schur(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_cube_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const ProxyCube<T1>& P = x.P;
-
+
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "element-wise cube multiplication");
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_cube_generator<eop_cube_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i)
@@ -323,16 +329,16 @@
eop_cube_core<eop_cube_type>::apply_inplace_div(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_cube_type>& x)
{
arma_extra_debug_sigprint();
-
+
typedef typename T1::elem_type eT;
-
+
const ProxyCube<T1>& P = x.P;
-
+
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "element-wise cube division");
-
+
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
-
+
if(is_cube_generator<eop_cube_type>::value == true)
{
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 1873
More information about the Rcpp-commits
mailing list