[Rcpp-commits] r3601 - in pkg/RcppArmadillo: . inst inst/include inst/include/armadillo_bits
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu May 10 14:43:03 CEST 2012
Author: edd
Date: 2012-05-10 14:43:03 +0200 (Thu, 10 May 2012)
New Revision: 3601
Added:
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_unique.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_unique_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_unique_meat.hpp
Modified:
pkg/RcppArmadillo/ChangeLog
pkg/RcppArmadillo/DESCRIPTION
pkg/RcppArmadillo/inst/NEWS
pkg/RcppArmadillo/inst/include/armadillo
pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_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_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/debug.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/diagmat_proxy.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/diagview_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/diagview_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eOp_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eOp_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/eglue_core_bones.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/field_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_eig.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_log_det.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_princomp.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_sort_index.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_strans.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/forward_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_mixed_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_relational_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_times_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/lapack_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/lapack_wrapper.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_cumsum_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_hist_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_htrans_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_htrans_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_princomp_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_princomp_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_relational_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_reshape_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_shuffle_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_sort_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_stddev_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_sum_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_symmat_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_trimat_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_trimat_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_var_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/operator_times.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/podarray_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/subview_bones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp
Log:
RcppArmadillo 0.3.1.92 with Armadillo 3.1.92
Modified: pkg/RcppArmadillo/ChangeLog
===================================================================
--- pkg/RcppArmadillo/ChangeLog 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/ChangeLog 2012-05-10 12:43:03 UTC (rev 3601)
@@ -1,6 +1,12 @@
+2012-05-10 Dirk Eddelbuettel <edd at debian.org>
+
+ * DESCRIPTION: Release 0.3.1.92
+
+ * inst/include/*: Upgraded to new (beta) release 3.1.92 of Armadillo
+
2012-05-03 Dirk Eddelbuettel <edd at debian.org>
- * DESCRIPTION: Release 0.3.0.2
+ * DESCRIPTION: Release 0.3.0.3
* inst/include/*: Upgraded to new release 3.0.3 of Armadillo
Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/DESCRIPTION 2012-05-10 12:43:03 UTC (rev 3601)
@@ -1,7 +1,7 @@
Package: RcppArmadillo
Type: Package
Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.3.0.3
+Version: 0.3.1.92
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.0.3). Thus users do not need to
+ Armadillo library (currently version 3.1.92). 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-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/NEWS 2012-05-10 12:43:03 UTC (rev 3601)
@@ -1,5 +1,14 @@
-0.3.0.3 2012-05-03
+0.3.1.92 2012-05-10
+ o Upgraded to Armadillo release 3.0.2 "v3.2 beta 2"
+
+ * added unique(), for finding unique elements of a matrix
+ * faster eigen decomposition via optional use of "divide and
+ conquer" by eig_sym()
+ * faster transpose of vectors and compound expressions
+
+0.3.0.3 2012-05-03
+
o Upgraded to Armadillo release 3.0.3
* fixes for inplace transpose of complex number matrices
@@ -8,7 +17,7 @@
o New example script fastLm
-0.3.0.2 2012-04-19
+0.3.0.2 2012-04-19
o Upgraded to Armadillo release 3.0.2
@@ -18,7 +27,7 @@
number of useful debugging checks. Users can still define it or
define ARMA_NO_DEBUG if they want a 'non-development' build
-0.3.0.1 2012-04-12
+0.3.0.1 2012-04-12
o Upgraded to Armadillo release 3.0.1
Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo 2012-05-10 12:43:03 UTC (rev 3601)
@@ -87,6 +87,12 @@
#include "armadillo_bits/include_atlas.hpp"
+#if defined(ARMA_USE_HDF5)
+ #include <hdf5.h>
+#endif
+
+
+
//! \namespace arma namespace for Armadillo classes and functions
namespace arma
{
@@ -210,6 +216,7 @@
#include "armadillo_bits/op_cumsum_bones.hpp"
#include "armadillo_bits/op_symmat_bones.hpp"
#include "armadillo_bits/op_hist_bones.hpp"
+ #include "armadillo_bits/op_unique_bones.hpp"
#include "armadillo_bits/glue_times_bones.hpp"
#include "armadillo_bits/glue_mixed_bones.hpp"
@@ -238,14 +245,14 @@
//
// classes that underlay metaprogramming
+ #include "armadillo_bits/unwrap.hpp"
+ #include "armadillo_bits/unwrap_cube.hpp"
+
#include "armadillo_bits/Proxy.hpp"
#include "armadillo_bits/ProxyCube.hpp"
#include "armadillo_bits/diagmat_proxy.hpp"
- #include "armadillo_bits/unwrap.hpp"
- #include "armadillo_bits/unwrap_cube.hpp"
-
#include "armadillo_bits/strip.hpp"
#include "armadillo_bits/Op_meat.hpp"
@@ -369,6 +376,7 @@
#include "armadillo_bits/fn_syl_lyap.hpp"
#include "armadillo_bits/fn_hist.hpp"
#include "armadillo_bits/fn_histc.hpp"
+ #include "armadillo_bits/fn_unique.hpp"
//
// class meat
@@ -438,6 +446,7 @@
#include "armadillo_bits/op_cumsum_meat.hpp"
#include "armadillo_bits/op_symmat_meat.hpp"
#include "armadillo_bits/op_hist_meat.hpp"
+ #include "armadillo_bits/op_unique_meat.hpp"
#include "armadillo_bits/glue_times_meat.hpp"
#include "armadillo_bits/glue_mixed_meat.hpp"
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Base_bones.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -40,13 +40,40 @@
+template<typename elem_type, typename derived>
+struct Base_eval_Mat
+ {
+ const derived& eval() const;
+ };
+
+
+template<typename elem_type, typename derived>
+struct Base_eval_expr
+ {
+ Mat<elem_type> eval() const;
+ };
+
+
+template<typename elem_type, typename derived, bool condition>
+struct Base_eval {};
+
+template<typename elem_type, typename derived>
+struct Base_eval<elem_type, derived, true> { typedef Base_eval_Mat<elem_type, derived> result; };
+
+template<typename elem_type, typename derived>
+struct Base_eval<elem_type, derived, false> { typedef Base_eval_expr<elem_type, derived> result; };
+
+
+
//! Class for static polymorphism, modelled after the "Curiously Recurring Template Pattern" (CRTP).
//! Used for type-safe downcasting in functions that restrict their input(s) to be classes that are
//! derived from Base (e.g. Mat, Op, Glue, diagview, subview).
//! A Base object can be converted to a Mat object by the unwrap class.
template<typename elem_type, typename derived>
-struct Base : public Base_extra<derived, is_supported_blas_type<elem_type>::value>::result
+struct Base
+ : public Base_extra<derived, is_supported_blas_type<elem_type>::value>::result
+ , public Base_eval<elem_type, derived, is_Mat<derived>::value>::result
{
arma_inline const derived& get_ref() const;
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Base_meat.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -62,8 +62,10 @@
void
Base<elem_type,derived>::print(const std::string extra_text) const
{
- const unwrap<derived> tmp( (*this).get_ref() );
+ const Proxy<derived> P( (*this).get_ref() );
+ const quasi_unwrap< typename Proxy<derived>::stored_type > tmp(P.Q);
+
tmp.M.impl_print(extra_text);
}
@@ -74,8 +76,10 @@
void
Base<elem_type,derived>::print(std::ostream& user_stream, const std::string extra_text) const
{
- const unwrap<derived> tmp( (*this).get_ref() );
+ const Proxy<derived> P( (*this).get_ref() );
+ const quasi_unwrap< typename Proxy<derived>::stored_type > tmp(P.Q);
+
tmp.M.impl_print(user_stream, extra_text);
}
@@ -86,8 +90,10 @@
void
Base<elem_type,derived>::raw_print(const std::string extra_text) const
{
- const unwrap<derived> tmp( (*this).get_ref() );
+ const Proxy<derived> P( (*this).get_ref() );
+ const quasi_unwrap< typename Proxy<derived>::stored_type > tmp(P.Q);
+
tmp.M.impl_raw_print(extra_text);
}
@@ -98,8 +104,10 @@
void
Base<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string extra_text) const
{
- const unwrap<derived> tmp( (*this).get_ref() );
+ const Proxy<derived> P( (*this).get_ref() );
+ const quasi_unwrap< typename Proxy<derived>::stored_type > tmp(P.Q);
+
tmp.M.impl_raw_print(user_stream, extra_text);
}
@@ -118,4 +126,34 @@
+//
+// extra functions defined in Base_eval_Mat
+
+template<typename elem_type, typename derived>
+arma_inline
+const derived&
+Base_eval_Mat<elem_type, derived>::eval() const
+ {
+ arma_extra_debug_sigprint();
+
+ return static_cast<const derived&>(*this);
+ }
+
+
+
+//
+// extra functions defined in Base_eval_expr
+
+template<typename elem_type, typename derived>
+arma_inline
+Mat<elem_type>
+Base_eval_expr<elem_type, derived>::eval() const
+ {
+ arma_extra_debug_sigprint();
+
+ return Mat<elem_type>( static_cast<const derived&>(*this) );
+ }
+
+
+
//! @}
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -79,10 +79,12 @@
arma_inline subview_col<eT> subvec(const span& row_span);
arma_inline const subview_col<eT> subvec(const span& row_span) const;
- //arma_inline subview_col<eT> operator()(const span& row_span);
- //arma_inline const subview_col<eT> operator()(const span& row_span) const;
+ using Mat<eT>::operator();
+ arma_inline subview_col<eT> operator()(const span& row_span);
+ arma_inline const subview_col<eT> operator()(const span& row_span) const;
+
inline void shed_row (const uword row_num);
inline void shed_rows(const uword in_row1, const uword in_row2);
@@ -116,7 +118,6 @@
arma_aligned eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
- arma_inline void mem_setup();
arma_inline void change_to_row();
@@ -129,7 +130,7 @@
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;
@@ -153,15 +154,13 @@
inline const Col& operator=(const std::string& text);
inline const Col& operator=(const subview_cube<eT>& X);
- inline subview_row<eT> operator()(const uword row_num, const span& col_span);
- inline const subview_row<eT> operator()(const uword row_num, const span& col_span) const;
+ using Col<eT>::operator();
- inline subview_col<eT> operator()(const span& row_span, const uword col_num );
- inline const subview_col<eT> operator()(const span& row_span, const uword col_num ) const;
+ #if defined(ARMA_USE_CXX11)
+ inline fixed(const std::initializer_list<eT>& list);
+ inline const Col& operator=(const std::initializer_list<eT>& list);
+ #endif
- inline subview<eT> operator()(const span& row_span, const span& col_span);
- inline const subview<eT> operator()(const span& row_span, const span& col_span) const;
-
arma_inline arma_warn_unused eT& operator[] (const uword i);
arma_inline arma_warn_unused eT operator[] (const uword i) const;
arma_inline arma_warn_unused eT& at (const uword i);
@@ -183,10 +182,16 @@
};
+ protected:
+
+ inline Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem);
+
+
+ public:
+
#ifdef ARMA_EXTRA_COL_PROTO
#include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_PROTO)
#endif
-
};
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -494,30 +494,30 @@
-// template<typename eT>
-// arma_inline
-// subview_col<eT>
-// Col<eT>::operator()(const span& row_span)
-// {
-// arma_extra_debug_sigprint();
-//
-// return subvec(row_span);
-// }
-//
-//
-//
-// template<typename eT>
-// arma_inline
-// const subview_col<eT>
-// Col<eT>::operator()(const span& row_span) const
-// {
-// arma_extra_debug_sigprint();
-//
-// return subvec(row_span);
-// }
+template<typename eT>
+arma_inline
+subview_col<eT>
+Col<eT>::operator()(const span& row_span)
+ {
+ arma_extra_debug_sigprint();
+
+ return subvec(row_span);
+ }
+template<typename eT>
+arma_inline
+const subview_col<eT>
+Col<eT>::operator()(const span& row_span) const
+ {
+ arma_extra_debug_sigprint();
+
+ return subvec(row_span);
+ }
+
+
+
//! remove specified row
template<typename eT>
inline
@@ -734,24 +734,6 @@
template<uword fixed_n_elem>
arma_inline
void
-Col<eT>::fixed<fixed_n_elem>::mem_setup()
- {
- arma_extra_debug_sigprint();
-
- access::rw(Mat<eT>::n_rows) = fixed_n_elem;
- access::rw(Mat<eT>::n_cols) = 1;
- access::rw(Mat<eT>::n_elem) = fixed_n_elem;
- access::rw(Mat<eT>::vec_state) = 1;
- access::rw(Mat<eT>::mem_state) = 3;
- access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
- }
-
-
-
-template<typename eT>
-template<uword fixed_n_elem>
-arma_inline
-void
Col<eT>::fixed<fixed_n_elem>::change_to_row()
{
arma_extra_debug_sigprint();
@@ -766,10 +748,9 @@
template<uword fixed_n_elem>
arma_inline
Col<eT>::fixed<fixed_n_elem>::fixed()
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
arma_extra_debug_sigprint_this(this);
-
- mem_setup();
}
@@ -778,11 +759,10 @@
template<uword fixed_n_elem>
arma_inline
Col<eT>::fixed<fixed_n_elem>::fixed(const fixed<fixed_n_elem>& X)
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
arma_extra_debug_sigprint_this(this);
- mem_setup();
-
eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
arrayops::copy( dest, X.mem, fixed_n_elem );
@@ -794,11 +774,10 @@
template<uword fixed_n_elem>
inline
Col<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X)
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
arma_extra_debug_sigprint_this(this);
- mem_setup();
-
Col<eT>::operator=(X);
}
@@ -809,11 +788,10 @@
template<typename T1>
inline
Col<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A)
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
arma_extra_debug_sigprint_this(this);
- mem_setup();
-
Col<eT>::operator=(A.get_ref());
}
@@ -824,11 +802,10 @@
template<typename T1, typename T2>
inline
Col<eT>::fixed<fixed_n_elem>::fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B)
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
arma_extra_debug_sigprint_this(this);
- mem_setup();
-
Col<eT>::init(A,B);
}
@@ -838,12 +815,13 @@
template<uword fixed_n_elem>
inline
Col<eT>::fixed<fixed_n_elem>::fixed(const eT* aux_mem)
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
arma_extra_debug_sigprint_this(this);
- mem_setup();
+ eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
- arrayops::copy( const_cast<eT*>(Mat<eT>::mem), aux_mem, fixed_n_elem );
+ arrayops::copy( dest, aux_mem, fixed_n_elem );
}
@@ -855,11 +833,10 @@
template<uword fixed_n_elem>
inline
Col<eT>::fixed<fixed_n_elem>::fixed(const char* text)
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
arma_extra_debug_sigprint_this(this);
- mem_setup();
-
change_to_row();
Col<eT>::operator=(text);
@@ -874,11 +851,10 @@
template<uword fixed_n_elem>
inline
Col<eT>::fixed<fixed_n_elem>::fixed(const std::string& text)
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
arma_extra_debug_sigprint_this(this);
- mem_setup();
-
change_to_row();
Col<eT>::operator=(text);
@@ -961,28 +937,17 @@
-template<typename eT>
-template<uword fixed_n_elem>
-inline
-subview_row<eT>
-Col<eT>::fixed<fixed_n_elem>::operator()(const uword row_num, const span& col_span)
- {
- arma_extra_debug_sigprint();
-
- return Mat<eT>::operator()(row_num, col_span);
- }
+#if defined(ARMA_USE_CXX11)
-
-
template<typename eT>
template<uword fixed_n_elem>
inline
-const subview_row<eT>
-Col<eT>::fixed<fixed_n_elem>::operator()(const uword row_num, const span& col_span) const
+Col<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list)
+ : Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
{
- arma_extra_debug_sigprint();
+ arma_extra_debug_sigprint_this(this);
- return Mat<eT>::operator()(row_num, col_span);
+ (*this).operator=(list);
}
@@ -990,63 +955,36 @@
template<typename eT>
template<uword fixed_n_elem>
inline
-subview_col<eT>
-Col<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const uword col_num)
+const Col<eT>&
+Col<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& list)
{
arma_extra_debug_sigprint();
- return Mat<eT>::operator()(row_span, col_num);
- }
-
-
-
-template<typename eT>
-template<uword fixed_n_elem>
-inline
-const subview_col<eT>
-Col<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const uword col_num) const
- {
- arma_extra_debug_sigprint();
+ const uword N = list.size();
- return Mat<eT>::operator()(row_span, col_num);
- }
-
-
-
-template<typename eT>
-template<uword fixed_n_elem>
-inline
-subview<eT>
-Col<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const span& col_span)
- {
- arma_extra_debug_sigprint();
+ arma_debug_check( (N > fixed_n_elem), "Col::fixed: initialiser list is too long" );
- return Mat<eT>::operator()(row_span, col_span);
- }
-
-
-
-template<typename eT>
-template<uword fixed_n_elem>
-inline
-const subview<eT>
-Col<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const span& col_span) const
- {
- arma_extra_debug_sigprint();
+ eT* this_mem = (*this).memptr();
- return Mat<eT>::operator()(row_span, col_span);
+ arrayops::copy( this_mem, list.begin(), N );
+
+ for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); }
+
+ return *this;
}
+#endif
+
template<typename eT>
template<uword fixed_n_elem>
arma_inline
arma_warn_unused
eT&
-Col<eT>::fixed<fixed_n_elem>::operator[] (const uword i)
+Col<eT>::fixed<fixed_n_elem>::operator[] (const uword ii)
{
- return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i];
+ return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
}
@@ -1056,9 +994,9 @@
arma_inline
arma_warn_unused
eT
-Col<eT>::fixed<fixed_n_elem>::operator[] (const uword i) const
+Col<eT>::fixed<fixed_n_elem>::operator[] (const uword ii) const
{
- return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i];
+ return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
}
@@ -1068,9 +1006,9 @@
arma_inline
arma_warn_unused
eT&
-Col<eT>::fixed<fixed_n_elem>::at(const uword i)
+Col<eT>::fixed<fixed_n_elem>::at(const uword ii)
{
- return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i];
+ return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
}
@@ -1080,9 +1018,9 @@
arma_inline
arma_warn_unused
eT
-Col<eT>::fixed<fixed_n_elem>::at(const uword i) const
+Col<eT>::fixed<fixed_n_elem>::at(const uword ii) const
{
- return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i];
+ return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
}
@@ -1092,11 +1030,11 @@
arma_inline
arma_warn_unused
eT&
-Col<eT>::fixed<fixed_n_elem>::operator() (const uword i)
+Col<eT>::fixed<fixed_n_elem>::operator() (const uword ii)
{
- arma_debug_check( (i >= fixed_n_elem), "Col::operator(): out of bounds");
+ arma_debug_check( (ii >= fixed_n_elem), "Col::operator(): out of bounds");
- return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i];
+ return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
}
@@ -1106,11 +1044,11 @@
arma_inline
arma_warn_unused
eT
-Col<eT>::fixed<fixed_n_elem>::operator() (const uword i) const
+Col<eT>::fixed<fixed_n_elem>::operator() (const uword ii) const
{
- arma_debug_check( (i >= fixed_n_elem), "Col::operator(): out of bounds");
+ arma_debug_check( (ii >= fixed_n_elem), "Col::operator(): out of bounds");
- return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i];
+ return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
}
@@ -1245,6 +1183,16 @@
+template<typename eT>
+inline
+Col<eT>::Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem)
+ : Mat<eT>(arma_fixed_indicator(), in_n_elem, 1, 1, in_mem)
+ {
+ arma_extra_debug_sigprint_this(this);
+ }
+
+
+
#ifdef ARMA_EXTRA_COL_MEAT
#include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_MEAT)
#endif
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -307,6 +307,10 @@
template<typename T1, typename T2>
inline explicit fixed(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B) { mem_setup(); Cube<eT>::init(A,B); }
+
+
+ // using Cube<eT>::operator();
+ // TODO: overload operator(), operator[] and .at() to allow faster element access
};
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -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
@@ -34,10 +34,6 @@
if(arma_config::debug == true)
{
// try to expose buggy user code that accesses deleted objects
- access::rw(n_rows) = 0;
- access::rw(n_cols) = 0;
- access::rw(n_slices) = 0;
- access::rw(n_elem) = 0;
access::rw(mat_ptrs) = 0;
access::rw(mem) = 0;
}
@@ -278,6 +274,8 @@
ea_type1 PX = X.get_ea();
ea_type2 PY = Y.get_ea();
+ // TODO: add handling for prefer_at_accessor = true
+
for(uword i=0; i<N; ++i)
{
out_mem[i] = std::complex<T>(PX[i], PY[i]);
@@ -349,9 +347,9 @@
{
arma_extra_debug_sigprint();
- for(uword slice = 0; slice < n_slices; ++slice)
+ for(uword uslice = 0; uslice < n_slices; ++uslice)
{
- delete access::rw(mat_ptrs[slice]);
+ delete access::rw(mat_ptrs[uslice]);
}
if(mem_state <= 2)
@@ -386,9 +384,9 @@
}
}
- for(uword slice = 0; slice < n_slices; ++slice)
+ for(uword uslice = 0; uslice < n_slices; ++uslice)
{
- mat_ptrs[slice] = new Mat<eT>('j', slice_memptr(slice), n_rows, n_cols);
+ mat_ptrs[uslice] = new Mat<eT>('j', slice_memptr(uslice), n_rows, n_cols);
}
}
@@ -2265,9 +2263,9 @@
arma_inline
arma_warn_unused
eT*
-Cube<eT>::slice_memptr(const uword slice)
+Cube<eT>::slice_memptr(const uword uslice)
{
- return const_cast<eT*>( &mem[ slice*n_elem_slice ] );
+ return const_cast<eT*>( &mem[ uslice*n_elem_slice ] );
}
@@ -2277,9 +2275,9 @@
arma_inline
arma_warn_unused
const eT*
-Cube<eT>::slice_memptr(const uword slice) const
+Cube<eT>::slice_memptr(const uword uslice) const
{
- return &mem[ slice*n_elem_slice ];
+ return &mem[ uslice*n_elem_slice ];
}
@@ -2289,9 +2287,9 @@
arma_inline
arma_warn_unused
eT*
-Cube<eT>::slice_colptr(const uword slice, const uword col)
+Cube<eT>::slice_colptr(const uword uslice, const uword col)
{
- return const_cast<eT*>( &mem[ slice*n_elem_slice + col*n_rows] );
+ return const_cast<eT*>( &mem[ uslice*n_elem_slice + col*n_rows] );
}
@@ -2301,9 +2299,9 @@
arma_inline
arma_warn_unused
const eT*
-Cube<eT>::slice_colptr(const uword slice, const uword col) const
+Cube<eT>::slice_colptr(const uword uslice, const uword col) const
{
- return &mem[ slice*n_elem_slice + col*n_rows ];
+ return &mem[ uslice*n_elem_slice + col*n_rows ];
}
@@ -3339,6 +3337,8 @@
eT* out_mem = out.memptr();
ea_type PA = A.get_ea();
+ // TODO: add handling for prefer_at_accessor = true
+
for(uword i=0; i<n_elem; ++i)
{
//out_mem[i].real() = PA[i];
@@ -3371,6 +3371,8 @@
eT* out_mem = out.memptr();
ea_type PA = A.get_ea();
+ // TODO: add handling for prefer_at_accessor = true
+
for(uword i=0; i<n_elem; ++i)
{
//out_mem[i].imag() = PA[i];
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_bones.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -21,7 +21,6 @@
{
public:
- typedef typename T1::elem_type eT;
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
@@ -36,16 +35,16 @@
arma_inline Gen(const uword in_n_rows, const uword in_n_cols);
arma_inline ~Gen();
- arma_inline static eT generate();
+ arma_inline static elem_type generate();
- arma_inline eT operator[] (const uword i) const;
- arma_inline eT at (const uword row, const uword col) const;
+ arma_inline elem_type operator[] (const uword ii) const;
+ arma_inline elem_type at (const uword row, const uword col) const;
- inline void apply (Mat<eT>& out) const;
- inline void apply_inplace_plus (Mat<eT>& out) const;
- inline void apply_inplace_minus(Mat<eT>& out) const;
- inline void apply_inplace_schur(Mat<eT>& out) const;
- inline void apply_inplace_div (Mat<eT>& out) const;
+ inline void apply (Mat<elem_type>& out) const;
+ inline void apply_inplace_plus (Mat<elem_type>& out) const;
+ inline void apply_inplace_minus(Mat<elem_type>& out) const;
+ inline void apply_inplace_schur(Mat<elem_type>& out) const;
+ inline void apply_inplace_div (Mat<elem_type>& out) const;
};
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_meat.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Gen_meat.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -55,13 +55,13 @@
template<typename T1, typename gen_type>
arma_inline
typename T1::elem_type
-Gen<T1, gen_type>::operator[](const uword i) const
+Gen<T1, gen_type>::operator[](const uword ii) const
{
typedef typename T1::elem_type eT;
if(is_same_type<gen_type, gen_ones_diag>::value == true)
{
- return ((i % n_rows) == (i / n_rows)) ? eT(1) : eT(0);
+ return ((ii % n_rows) == (ii / n_rows)) ? eT(1) : eT(0);
}
else
{
@@ -125,9 +125,9 @@
{
const uword N = (std::min)(n_rows, n_cols);
- for(uword i=0; i<N; ++i)
+ for(uword iq=0; iq < N; ++iq)
{
- out.at(i,i) += eT(1);
+ out.at(iq,iq) += eT(1);
}
}
else
@@ -135,20 +135,19 @@
eT* out_mem = out.memptr();
const uword n_elem = out.n_elem;
- uword i,j;
-
- for(i=0, j=1; j<n_elem; i+=2, j+=2)
+ uword iq,jq;
+ for(iq=0, jq=1; jq < n_elem; iq+=2, jq+=2)
{
const eT tmp_i = Gen<T1, gen_type>::generate();
const eT tmp_j = Gen<T1, gen_type>::generate();
- out_mem[i] += tmp_i;
- out_mem[j] += tmp_j;
+ out_mem[iq] += tmp_i;
+ out_mem[jq] += tmp_j;
}
- if(i < n_elem)
+ if(iq < n_elem)
{
- out_mem[i] += Gen<T1, gen_type>::generate();
+ out_mem[iq] += Gen<T1, gen_type>::generate();
}
}
@@ -173,9 +172,9 @@
{
const uword N = (std::min)(n_rows, n_cols);
- for(uword i=0; i<N; ++i)
+ for(uword iq=0; iq < N; ++iq)
{
- out.at(i,i) -= eT(1);
+ out.at(iq,iq) -= eT(1);
}
}
else
@@ -183,20 +182,19 @@
eT* out_mem = out.memptr();
const uword n_elem = out.n_elem;
- uword i,j;
-
- for(i=0, j=1; j<n_elem; i+=2, j+=2)
+ uword iq,jq;
+ for(iq=0, jq=1; jq < n_elem; iq+=2, jq+=2)
{
const eT tmp_i = Gen<T1, gen_type>::generate();
const eT tmp_j = Gen<T1, gen_type>::generate();
- out_mem[i] -= tmp_i;
- out_mem[j] -= tmp_j;
+ out_mem[iq] -= tmp_i;
+ out_mem[jq] -= tmp_j;
}
- if(i < n_elem)
+ if(iq < n_elem)
{
- out_mem[i] -= Gen<T1, gen_type>::generate();
+ out_mem[iq] -= Gen<T1, gen_type>::generate();
}
}
@@ -221,10 +219,10 @@
{
const uword N = (std::min)(n_rows, n_cols);
- for(uword i=0; i<N; ++i)
+ for(uword iq=0; iq < N; ++iq)
{
- for(uword row=0; row<i; ++row) { out.at(row,i) = eT(0); }
- for(uword row=i+1; row<n_rows; ++row) { out.at(row,i) = eT(0); }
+ for(uword row=0; row < iq; ++row) { out.at(row,iq) = eT(0); }
+ for(uword row=iq+1; row < n_rows; ++row) { out.at(row,iq) = eT(0); }
}
}
else
@@ -232,20 +230,19 @@
eT* out_mem = out.memptr();
const uword n_elem = out.n_elem;
- uword i,j;
-
- for(i=0, j=1; j<n_elem; i+=2, j+=2)
+ uword iq,jq;
+ for(iq=0, jq=1; jq < n_elem; iq+=2, jq+=2)
{
const eT tmp_i = Gen<T1, gen_type>::generate();
const eT tmp_j = Gen<T1, gen_type>::generate();
- out_mem[i] *= tmp_i;
- out_mem[j] *= tmp_j;
+ out_mem[iq] *= tmp_i;
+ out_mem[jq] *= tmp_j;
}
- if(i < n_elem)
+ if(iq < n_elem)
{
- out_mem[i] *= Gen<T1, gen_type>::generate();
+ out_mem[iq] *= Gen<T1, gen_type>::generate();
}
}
@@ -270,12 +267,12 @@
{
const uword N = (std::min)(n_rows, n_cols);
- for(uword i=0; i<N; ++i)
+ for(uword iq=0; iq < N; ++iq)
{
const eT zero = eT(0);
- for(uword row=0; row<i; ++row) { out.at(row,i) /= zero; }
- for(uword row=i+1; row<n_rows; ++row) { out.at(row,i) /= zero; }
+ for(uword row=0; row < iq; ++row) { out.at(row,iq) /= zero; }
+ for(uword row=iq+1; row < n_rows; ++row) { out.at(row,iq) /= zero; }
}
}
else
@@ -283,20 +280,19 @@
eT* out_mem = out.memptr();
const uword n_elem = out.n_elem;
- uword i,j;
-
- for(i=0, j=1; j<n_elem; i+=2, j+=2)
+ uword iq,jq;
+ for(iq=0, jq=1; jq < n_elem; iq+=2, jq+=2)
{
const eT tmp_i = Gen<T1, gen_type>::generate();
const eT tmp_j = Gen<T1, gen_type>::generate();
- out_mem[i] /= tmp_i;
- out_mem[j] /= tmp_j;
+ out_mem[iq] /= tmp_i;
+ out_mem[jq] /= tmp_j;
}
- if(i < n_elem)
+ if(iq < n_elem)
{
- out_mem[i] /= Gen<T1, gen_type>::generate();
+ out_mem[iq] /= Gen<T1, gen_type>::generate();
}
}
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2012-05-10 02:52:09 UTC (rev 3600)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp 2012-05-10 12:43:03 UTC (rev 3601)
@@ -275,12 +275,12 @@
template<typename T1, typename T2, typename glue_type> inline const Mat& operator/=(const mtGlue<eT, T1, T2, glue_type>& X);
- arma_inline arma_warn_unused eT& operator[] (const uword i);
- arma_inline arma_warn_unused eT operator[] (const uword i) const;
- arma_inline arma_warn_unused eT& at (const uword i);
- arma_inline arma_warn_unused eT at (const uword i) const;
- arma_inline arma_warn_unused eT& operator() (const uword i);
- arma_inline arma_warn_unused eT operator() (const uword i) const;
+ arma_inline arma_warn_unused eT& operator[] (const uword ii);
+ arma_inline arma_warn_unused eT operator[] (const uword ii) const;
+ arma_inline arma_warn_unused eT& at (const uword ii);
+ arma_inline arma_warn_unused eT at (const uword ii) const;
+ arma_inline arma_warn_unused eT& operator() (const uword ii);
+ arma_inline arma_warn_unused eT operator() (const uword ii) const;
arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col);
arma_inline arma_warn_unused eT at (const uword in_row, const uword in_col) const;
@@ -300,8 +300,8 @@
arma_inline arma_warn_unused bool is_square() const;
inline arma_warn_unused bool is_finite() const;
- arma_inline arma_warn_unused bool in_range(const uword i) const;
- arma_inline arma_warn_unused bool in_range(const span& x) const;
+ arma_inline arma_warn_unused bool in_range(const uword ii) const;
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 3601
More information about the Rcpp-commits
mailing list