[Rcpp-commits] r3564 - in pkg/RcppArmadillo: . inst inst/include/armadillo_bits
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Apr 4 21:05:53 CEST 2012
Author: edd
Date: 2012-04-04 21:05:53 +0200 (Wed, 04 Apr 2012)
New Revision: 3564
Modified:
pkg/RcppArmadillo/ChangeLog
pkg/RcppArmadillo/DESCRIPTION
pkg/RcppArmadillo/inst/NEWS
pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp
Log:
RcppArmadillo 2.99.4 with Armadillo 2.99.4
Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/ChangeLog 2012-04-04 19:05:53 UTC (rev 3564)
@@ -1,3 +1,9 @@
+2012-04-04 Dirk Eddelbuettel <edd at debian.org>
+
+ * DESCRIPTION: Release 0.2.40
+
+ * inst/include/*: Upgraded to new test release 2.99.4 of Armadillo
+
2012-04-02 Dirk Eddelbuettel <edd at debian.org>
* DESCRIPTION: Release 0.2.39
Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/DESCRIPTION 2012-04-04 19:05:53 UTC (rev 3564)
@@ -1,7 +1,7 @@
Package: RcppArmadillo
Type: Package
Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.2.39
+Version: 0.2.40
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 2.99.3). Thus users do not need to
+ Armadillo library (currently version 2.99.4). 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-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/NEWS 2012-04-04 19:05:53 UTC (rev 3564)
@@ -1,3 +1,9 @@
+0.2.40 2012-04-04
+
+ o Upgraded to Armadillo release 2.99.4 "Antarctic Chilli Ranch (Beta 4)"
+
+ * fixes for handling expressions with fixed size matrices
+
0.2.39 2012-04-02
o Upgraded to Armadillo release 2.99.3 "Antarctic Chilli Ranch (Beta 3)"
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -122,6 +122,14 @@
public:
+ typedef fixed<fixed_n_elem> Col_fixed_type;
+
+ typedef eT elem_type;
+ typedef typename get_pod_type<eT>::result pod_type;
+
+ static const bool is_col = true;
+ static const bool is_row = false;
+
static const uword n_rows = fixed_n_elem;
static const uword n_cols = 1;
static const uword n_elem = fixed_n_elem;
@@ -166,6 +174,9 @@
arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col) const;
+ arma_inline arma_warn_unused eT* memptr();
+ arma_inline arma_warn_unused const eT* memptr() const;
+
arma_hot inline const Col<eT>& fill(const eT val);
arma_hot inline const Col<eT>& zeros();
arma_hot inline const Col<eT>& ones();
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -1169,6 +1169,30 @@
template<typename eT>
template<uword fixed_n_elem>
+arma_inline
+arma_warn_unused
+eT*
+Col<eT>::fixed<fixed_n_elem>::memptr()
+ {
+ return (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
+ }
+
+
+
+template<typename eT>
+template<uword fixed_n_elem>
+arma_inline
+arma_warn_unused
+const eT*
+Col<eT>::fixed<fixed_n_elem>::memptr() const
+ {
+ return (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
+ }
+
+
+
+template<typename eT>
+template<uword fixed_n_elem>
arma_hot
inline
const Col<eT>&
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -484,11 +484,18 @@
public:
+ typedef fixed<fixed_n_rows, fixed_n_cols> Mat_fixed_type;
+
+ typedef eT elem_type;
+ typedef typename get_pod_type<eT>::result pod_type;
+
+ static const bool is_col = (fixed_n_cols == 1) ? true : false;
+ static const bool is_row = (fixed_n_rows == 1) ? true : false;
+
static const uword n_rows = fixed_n_rows;
static const uword n_cols = fixed_n_cols;
static const uword n_elem = fixed_n_elem;
-
arma_inline fixed();
arma_inline fixed(const fixed<fixed_n_rows, fixed_n_cols>& X);
@@ -531,7 +538,9 @@
arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col) const;
-
+ arma_inline arma_warn_unused eT* memptr();
+ arma_inline arma_warn_unused const eT* memptr() const;
+
arma_hot inline const Mat<eT>& fill(const eT val);
arma_hot inline const Mat<eT>& zeros();
arma_hot inline const Mat<eT>& ones();
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -6062,6 +6062,30 @@
template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols>
+arma_inline
+arma_warn_unused
+eT*
+Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::memptr()
+ {
+ return (use_extra) ? mem_local_extra : mem_local;
+ }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols>
+arma_inline
+arma_warn_unused
+const eT*
+Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::memptr() const
+ {
+ return (use_extra) ? mem_local_extra : mem_local;
+ }
+
+
+
+template<typename eT>
+template<uword fixed_n_rows, uword fixed_n_cols>
arma_hot
inline
const Mat<eT>&
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -15,22 +15,80 @@
//! @{
+// ea_type is the "element accessor" type,
+// which can provide access to elements via operator[]
+
+
template<typename T1>
-class Proxy
+struct Proxy_Mat_fixed
{
- public:
- inline Proxy(const T1&)
+ typedef typename T1::elem_type elem_type;
+ typedef typename get_pod_type<elem_type>::result pod_type;
+ typedef T1 stored_type;
+ typedef const elem_type* ea_type;
+
+ static const bool prefer_at_accessor = false;
+ static const bool has_subview = false;
+
+ static const bool is_row = T1::is_row;
+ static const bool is_col = T1::is_col;
+
+ arma_aligned const T1& Q;
+
+ inline explicit Proxy_Mat_fixed(const T1& A)
+ : Q(A)
{
+ arma_extra_debug_sigprint();
+ }
+
+ arma_inline static uword get_n_rows() { return T1::n_rows; }
+ arma_inline static uword get_n_cols() { return T1::n_cols; }
+ arma_inline static uword get_n_elem() { return T1::n_elem; }
+
+ 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.memptr(); }
+
+ template<typename eT2>
+ arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
+ };
+
+
+
+template<typename T1>
+struct Proxy_extra_empty
+ {
+ inline Proxy_extra_empty(const T1&)
+ {
arma_type_check(( is_arma_type<T1>::value == false ));
}
};
+template<typename T1, bool condition>
+struct Proxy_extra {};
-// ea_type is the "element accessor" type,
-// which can provide access to elements via operator[]
+template<typename T1>
+struct Proxy_extra<T1, true> { typedef Proxy_Mat_fixed<T1> result; };
+template<typename T1>
+struct Proxy_extra<T1, false> { typedef Proxy_extra_empty<T1> result; };
+
+
+template<typename T1>
+class Proxy : public Proxy_extra<T1, is_Mat_fixed<T1>::value >::result
+ {
+ public:
+ inline Proxy(const T1& A)
+ : Proxy_extra<T1, is_Mat_fixed<T1>::value >::result(A)
+ {
+ }
+ };
+
+
+
template<typename eT>
class Proxy< Mat<eT> >
{
@@ -148,46 +206,6 @@
-// // TODO: how to allow general Mat<eT> instead of specific Mat<double> ?
-// template<uword fixed_n_rows, uword fixed_n_cols>
-// class Proxy< Mat<double>::fixed<fixed_n_rows,fixed_n_cols> >
-// {
-// public:
-//
-// typedef double eT;
-//
-// typedef eT elem_type;
-// typedef typename get_pod_type<elem_type>::result pod_type;
-// typedef Mat<eT>::fixed<fixed_n_rows,fixed_n_cols> stored_type;
-// typedef const eT* ea_type;
-//
-// static const bool prefer_at_accessor = false;
-// static const bool has_subview = false;
-//
-// static const bool is_row = false;
-// static const bool is_col = false;
-//
-// arma_aligned const Mat<eT>::fixed<fixed_n_rows,fixed_n_cols>& Q;
-//
-// inline explicit Proxy(const Mat<eT>::fixed<fixed_n_rows,fixed_n_cols>& A)
-// : Q(A)
-// {
-// arma_extra_debug_sigprint();
-// }
-//
-// arma_inline uword get_n_rows() const { return fixed_n_rows; }
-// arma_inline uword get_n_cols() const { return fixed_n_cols; }
-// arma_inline uword get_n_elem() const { return fixed_n_rows*fixed_n_cols; }
-//
-// 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.memptr(); }
-// arma_inline bool is_alias(const Mat<eT>& X) const { return (&Q == &X); }
-// };
-
-
-
template<typename T1, typename gen_type>
class Proxy< Gen<T1, gen_type > >
{
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -121,6 +121,14 @@
public:
+ typedef fixed<fixed_n_elem> Row_fixed_type;
+
+ typedef eT elem_type;
+ typedef typename get_pod_type<eT>::result pod_type;
+
+ static const bool is_col = false;
+ static const bool is_row = true;
+
static const uword n_rows = 1;
static const uword n_cols = fixed_n_elem;
static const uword n_elem = fixed_n_elem;
@@ -165,6 +173,9 @@
arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col) const;
+ arma_inline arma_warn_unused eT* memptr();
+ arma_inline arma_warn_unused const eT* memptr() const;
+
arma_hot inline const Row<eT>& fill(const eT val);
arma_hot inline const Row<eT>& zeros();
arma_hot inline const Row<eT>& ones();
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -1107,6 +1107,30 @@
template<typename eT>
template<uword fixed_n_elem>
+arma_inline
+arma_warn_unused
+eT*
+Row<eT>::fixed<fixed_n_elem>::memptr()
+ {
+ return (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
+ }
+
+
+
+template<typename eT>
+template<uword fixed_n_elem>
+arma_inline
+arma_warn_unused
+const eT*
+Row<eT>::fixed<fixed_n_elem>::memptr() const
+ {
+ return (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
+ }
+
+
+
+template<typename eT>
+template<uword fixed_n_elem>
arma_hot
inline
const Row<eT>&
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -18,8 +18,8 @@
#define ARMA_VERSION_MAJOR 2
#define ARMA_VERSION_MINOR 99
-#define ARMA_VERSION_PATCH 3
-#define ARMA_VERSION_NAME "Antarctic Chilli Ranch (Beta 3)"
+#define ARMA_VERSION_PATCH 4
+#define ARMA_VERSION_NAME "Antarctic Chilli Ranch (Beta 4)"
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -1173,7 +1173,7 @@
eigval.set_size( static_cast<uword>(n_rows) );
podarray<eT> work( static_cast<uword>(lwork) );
- blas_int info;
+ blas_int info = 0;
arma_extra_debug_print("lapack::syev()");
lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr(), work.memptr(), &lwork, &info);
@@ -1226,7 +1226,7 @@
podarray<eT> work( static_cast<uword>(lwork) );
podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows - 2)) );
- blas_int info;
+ blas_int info = 0;
arma_extra_debug_print("lapack::heev()");
lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(), work.memptr(), &lwork, rwork.memptr(), &info);
@@ -1278,7 +1278,7 @@
eigval.set_size( static_cast<uword>(n_rows) );
podarray<eT> work( static_cast<uword>(lwork) );
- blas_int info;
+ blas_int info = 0;
arma_extra_debug_print("lapack::syev()");
lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.memptr(), work.memptr(), &lwork, &info);
@@ -1336,7 +1336,7 @@
podarray<eT> work( static_cast<uword>(lwork) );
podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows - 2)) );
- blas_int info;
+ blas_int info = 0;
arma_extra_debug_print("lapack::heev()");
lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.memptr(), work.memptr(), &lwork, rwork.memptr(), &info);
@@ -1434,7 +1434,7 @@
podarray<T> wi(A_n_rows);
Mat<T> A_copy = A;
- blas_int info;
+ blas_int info = 0;
arma_extra_debug_print("lapack::geev()");
lapack::geev(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr(), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, work.memptr(), &lwork, &info);
@@ -1541,7 +1541,7 @@
podarray<eT> work( static_cast<uword>(lwork) );
podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows)) ); // was 2,3
- blas_int info;
+ blas_int info = 0;
arma_extra_debug_print("lapack::cx_geev()");
lapack::cx_geev(&jobvl, &jobvr, &n_rows, A.memptr(), &lda, eigval.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, work.memptr(), &lwork, rwork.memptr(), &info);
@@ -1639,7 +1639,7 @@
blas_int work_len = (std::max)(blas_int(1),n);
blas_int work_len_tmp;
blas_int k = (std::min)(m,n);
- blas_int info;
+ blas_int info = 0;
podarray<eT> tau( static_cast<uword>(k) );
podarray<eT> work( static_cast<uword>(work_len) );
@@ -1749,13 +1749,13 @@
blas_int ldu = U.n_rows;
blas_int ldvt = V.n_rows;
blas_int lwork = 2 * (std::max)(blas_int(1), (std::max)( (3*(std::min)(m,n) + (std::max)(m,n)), 5*(std::min)(m,n) ) );
- blas_int info;
+ blas_int info = 0;
S.set_size( static_cast<uword>((std::min)(m, n)) );
podarray<eT> work( static_cast<uword>(lwork) );
-
-
+
+
// let gesvd_() calculate the optimum size of the workspace
blas_int lwork_tmp = -1;
@@ -1844,7 +1844,7 @@
blas_int ldu = U.n_rows;
blas_int ldvt = V.n_rows;
blas_int lwork = 2 * (std::max)(blas_int(1), 2*(std::min)(m,n)+(std::max)(m,n) );
- blas_int info;
+ blas_int info = 0;
S.set_size( static_cast<uword>((std::min)(m,n)) );
@@ -1964,7 +1964,7 @@
blas_int ldu = U.n_rows;
blas_int ldvt = V.n_rows;
blas_int lwork = 2 * (std::max)(blas_int(1), (std::max)( (3*(std::min)(m,n) + (std::max)(m,n)), 5*(std::min)(m,n) ) );
- blas_int info;
+ blas_int info = 0;
S.set_size( static_cast<uword>((std::min)(m,n)) );
@@ -2058,7 +2058,7 @@
blas_int ldu = U.n_rows;
blas_int ldvt = V.n_rows;
blas_int lwork = 2 * (std::max)(blas_int(1), 2*(std::min)(m,n)+(std::max)(m,n) );
- blas_int info;
+ blas_int info = 0;
S.set_size( static_cast<uword>((std::min)(m,n)) );
@@ -2467,7 +2467,7 @@
blas_int lda = A_n_rows;
blas_int ldb = A_n_rows;
blas_int nrhs = B.n_cols;
- blas_int info;
+ blas_int info = 0;
out = B;
@@ -2516,7 +2516,7 @@
blas_int ldb = A.n_rows;
blas_int nrhs = B.n_cols;
blas_int lwork = n + (std::max)(n, nrhs) + 2; // +2 for paranoia: some versions of Lapack might be trashing memory
- blas_int info;
+ blas_int info = 0;
Mat<eT> tmp = B;
@@ -2584,7 +2584,7 @@
blas_int ldb = A.n_cols;
blas_int nrhs = B.n_cols;
blas_int lwork = m + (std::max)(m,nrhs) + 2; // +2 for paranoia: some versions of Lapack might be trashing memory
- blas_int info;
+ blas_int info = 0;
Mat<eT> tmp;
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2011 Conrad Sanderson
+// Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
+// Copyright (C) 2008-2012 Conrad Sanderson
//
// This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -26,8 +26,56 @@
template<typename T>
+struct is_Mat_fixed_only
+ {
+ typedef char yes[1];
+ typedef char no[2];
+
+ template<typename X> static yes& check(typename X::Mat_fixed_type*);
+ template<typename> static no& check(...);
+
+ static const bool value = ( sizeof(check<T>(0)) == sizeof(yes) );
+ };
+
+
+
+template<typename T>
+struct is_Row_fixed_only
+ {
+ typedef char yes[1];
+ typedef char no[2];
+
+ template<typename X> static yes& check(typename X::Row_fixed_type*);
+ template<typename> static no& check(...);
+
+ static const bool value = ( sizeof(check<T>(0)) == sizeof(yes) );
+ };
+
+
+
+template<typename T>
+struct is_Col_fixed_only
+ {
+ typedef char yes[1];
+ typedef char no[2];
+
+ template<typename X> static yes& check(typename X::Col_fixed_type*);
+ template<typename> static no& check(...);
+
+ static const bool value = ( sizeof(check<T>(0)) == sizeof(yes) );
+ };
+
+
+
+template<typename T>
+struct is_Mat_fixed
+ { static const bool value = ( is_Mat_fixed_only<T>::value || is_Row_fixed_only<T>::value || is_Col_fixed_only<T>::value ); };
+
+
+
+template<typename T>
struct is_Mat_only
- { static const bool value = false; };
+ { static const bool value = is_Mat_fixed_only<T>::value; };
template<typename eT>
struct is_Mat_only< Mat<eT> >
@@ -38,9 +86,10 @@
{ static const bool value = true; };
+
template<typename T>
struct is_Mat
- { static const bool value = false; };
+ { static const bool value = ( is_Mat_fixed_only<T>::value || is_Row_fixed_only<T>::value || is_Col_fixed_only<T>::value ); };
template<typename eT>
struct is_Mat< Mat<eT> >
@@ -67,9 +116,10 @@
{ static const bool value = true; };
+
template<typename T>
struct is_Row
- { static const bool value = false; };
+ { static const bool value = is_Row_fixed_only<T>::value; };
template<typename eT>
struct is_Row< Row<eT> >
@@ -80,9 +130,10 @@
{ static const bool value = true; };
+
template<typename T>
struct is_Col
- { static const bool value = false; };
+ { static const bool value = is_Col_fixed_only<T>::value; };
template<typename eT>
struct is_Col< Col<eT> >
@@ -462,7 +513,7 @@
template<typename T>
struct is_basevec
- { static const bool value = false; };
+ { static const bool value = ( is_Row_fixed_only<T>::value || is_Col_fixed_only<T>::value ); };
template<typename eT>
struct is_basevec< Row<eT> >
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp 2012-04-02 19:58:30 UTC (rev 3563)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp 2012-04-04 19:05:53 UTC (rev 3564)
@@ -1,5 +1,5 @@
-// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
-// Copyright (C) 2008-2011 Conrad Sanderson
+// Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
+// Copyright (C) 2008-2012 Conrad Sanderson
//
// This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness
More information about the Rcpp-commits
mailing list