[Rcpp-commits] r1870 - in pkg/RcppArmadillo: . inst inst/include inst/include/armadillo_bits src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 26 03:34:20 CEST 2010
Author: edd
Date: 2010-07-26 03:34:19 +0200 (Mon, 26 Jul 2010)
New Revision: 1870
Added:
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_conv.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_randu.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_toeplitz.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trunc_exp.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trunc_log.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_conv_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_conv_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_proto.hpp
Removed:
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_rand.hpp
Modified:
pkg/RcppArmadillo/DESCRIPTION
pkg/RcppArmadillo/NEWS
pkg/RcppArmadillo/inst/ChangeLog
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/atlas_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/blas_proto.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/debug.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/diskio_proto.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_chol.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_conv_to.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_dot.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_eig.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_log_det.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_lu.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_misc.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_ones.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_pinv.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_princomp.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_princomp_cov.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_qr.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_randn.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_svd.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_trace.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/fn_zeros.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/format_wrap.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/glue_join_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/itpp_wrap.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/op_dot_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/restrictors.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/subview_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/syslib_proto.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/traits.hpp
pkg/RcppArmadillo/inst/include/armadillo_bits/upgrade_val.hpp
pkg/RcppArmadillo/src/fastLm.cpp
Log:
upgraded to Armadillo 0.9.52 "Monkey Wrench"
changed fastLm.cpp to use pinv() instead of inv() as the latter now warns (which is the right thing to do) but our manual-page example works better with pinv()
Modified: pkg/RcppArmadillo/DESCRIPTION
===================================================================
--- pkg/RcppArmadillo/DESCRIPTION 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/DESCRIPTION 2010-07-26 01:34:19 UTC (rev 1870)
@@ -1,7 +1,7 @@
Package: RcppArmadillo
Type: Package
Title: Rcpp integration for Armadillo templated linear algebra library
-Version: 0.2.3
+Version: 0.2.4
Date: $Date$
Author: Romain Francois, Dirk Eddelbuettel and Doug Bates
Maintainer: Romain, Dirk and Doug <RcppArmadillo-authors at r-enthusiasts.com>
Modified: pkg/RcppArmadillo/NEWS
===================================================================
--- pkg/RcppArmadillo/NEWS 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/NEWS 2010-07-26 01:34:19 UTC (rev 1870)
@@ -1,3 +1,13 @@
+0.2.4 under development
+
+ o Upgraded to Armadillo 0.9.52 'Monkey Wrench'
+
+ o src/fastLm.cpp: Switch from inv() to pinv() as inv() now tests for
+ singular matrices and warns and returns an empty matrix which stops
+ the example fastLm() implementation on the manual page -- and while
+ this is generally reasonably it makes sense here to continue which
+ the Moore-Penrose inverse allows us to do
+
0.2.3 2010-06-14
o Better configuration to detect suncc (which does not have std::isfinite)
Modified: pkg/RcppArmadillo/inst/ChangeLog
===================================================================
--- pkg/RcppArmadillo/inst/ChangeLog 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/ChangeLog 2010-07-26 01:34:19 UTC (rev 1870)
@@ -1,3 +1,13 @@
+2010-07-25 Dirk Eddelbuettel <edd at debian.org>
+
+ * inst/include/* : upgrade to armadillo 0.9.52 "Monkey Wrench"
+
+ * src/fastLm.cpp: Switch from inv() (which now throws a warning on
+ (near) singular matrices and returns an empty matrix) to the
+ Moore-Penrose generalised inverse pinv() which allows us to continue
+ the example in the manual page. Of course, for standard use inv() is
+ doing the right thing by issueing the warning.
+
2010-06-14 Dirk Eddelbuettel <edd at debian.org>
* DESCRIPTION: Release 0.2.3
Modified: pkg/RcppArmadillo/inst/include/armadillo
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo 2010-07-26 01:34:19 UTC (rev 1870)
@@ -42,40 +42,60 @@
#endif
-#if defined(ARMA_USE_BOOST)
+#if defined(ARMA_USE_BOOST_DATE)
+ #include <boost/date_time/posix_time/posix_time.hpp>
+#endif
+
+
+#if defined(ARMA_HAVE_STD_TR1)
+ #include <tr1/cmath>
+ #include <tr1/complex>
+#elif defined(ARMA_USE_BOOST)
#include <boost/math/complex.hpp>
#include <boost/math/special_functions/acosh.hpp>
#include <boost/math/special_functions/asinh.hpp>
#include <boost/math/special_functions/atanh.hpp>
- #include <boost/current_function.hpp>
+#endif
+
+#if defined(ARMA_USE_BOOST)
#if defined(ARMA_EXTRA_DEBUG)
#include <boost/format.hpp>
+ #include <boost/current_function.hpp>
#define ARMA_USE_BOOST_FORMAT
#endif
#endif
-#if defined(ARMA_USE_BOOST_DATE)
- #include <boost/date_time/posix_time/posix_time.hpp>
-#endif
-
-
#if defined(ARMA_USE_ATLAS)
- #define ARMA_TMP_STRING(x) x
-
- #define ARMA_ATLAS_INCLUDE_1 <ARMA_TMP_STRING(ARMA_ATLAS_INCLUDE_DIR)/ARMA_TMP_STRING(cblas.h)>
- #define ARMA_ATLAS_INCLUDE_2 <ARMA_TMP_STRING(ARMA_ATLAS_INCLUDE_DIR)/ARMA_TMP_STRING(clapack.h)>
- extern "C"
- {
- #include ARMA_ATLAS_INCLUDE_1
- #include ARMA_ATLAS_INCLUDE_2
- }
+ #if !defined(ARMA_ATLAS_INCLUDE_DIR)
+ extern "C"
+ {
+ #include <cblas.h>
+ #include <clapack.h>
+ }
+ #else
+
+ #define ARMA_STR1(x) x
+ #define ARMA_STR2(x) ARMA_STR1(x)
+ #define ARMA_STR3(x) <x>
- #undef ARMA_TMP_STRING
- #undef ARMA_ATLAS_INCLUDE_1
- #undef ARMA_ATLAS_INCLUDE_2
+ #define ARMA_CBLAS ARMA_STR2(ARMA_ATLAS_INCLUDE_DIR)ARMA_STR2(cblas.h)
+ #define ARMA_CLAPACK ARMA_STR2(ARMA_ATLAS_INCLUDE_DIR)ARMA_STR2(clapack.h)
+
+ extern "C"
+ {
+ #include ARMA_STR3(ARMA_CBLAS)
+ #include ARMA_STR3(ARMA_CLAPACK)
+ }
+
+ #undef ARMA_STR1
+ #undef ARMA_STR2
+ #undef ARMA_STR3
+ #undef ARMA_CBLAS
+ #undef ARMA_CLAPACK
+ #endif
#endif
@@ -92,7 +112,6 @@
#include "armadillo_bits/arma_static_assert.hpp"
#include "armadillo_bits/typedef.hpp"
#include "armadillo_bits/format_wrap.hpp"
- #include "armadillo_bits/cmath_wrap.hpp"
#include "armadillo_bits/constants.hpp"
#include "armadillo_bits/arma_version.hpp"
#include "armadillo_bits/arma_config.hpp"
@@ -195,17 +214,19 @@
#include "armadillo_bits/glue_join_proto.hpp"
#include "armadillo_bits/glue_relational_proto.hpp"
#include "armadillo_bits/glue_solve_proto.hpp"
+ #include "armadillo_bits/glue_conv_proto.hpp"
+ #include "armadillo_bits/glue_toeplitz_proto.hpp"
-
- // for tests & experiments
-
-
//
// debugging functions
#include "armadillo_bits/debug.hpp"
+ //
+ //
+ #include "armadillo_bits/cmath_wrap.hpp"
+
//
// classes that underlay metaprogramming
@@ -293,7 +314,7 @@
#include "armadillo_bits/fn_misc.hpp"
#include "armadillo_bits/fn_norm.hpp"
#include "armadillo_bits/fn_dot.hpp"
- #include "armadillo_bits/fn_rand.hpp"
+ #include "armadillo_bits/fn_randu.hpp"
#include "armadillo_bits/fn_randn.hpp"
#include "armadillo_bits/fn_trig.hpp"
#include "armadillo_bits/fn_mean.hpp"
@@ -323,6 +344,10 @@
#include "armadillo_bits/fn_princomp_cov.hpp"
#include "armadillo_bits/fn_cross.hpp"
#include "armadillo_bits/fn_join.hpp"
+ #include "armadillo_bits/fn_conv.hpp"
+ #include "armadillo_bits/fn_trunc_exp.hpp"
+ #include "armadillo_bits/fn_trunc_log.hpp"
+ #include "armadillo_bits/fn_toeplitz.hpp"
//
// class meat
@@ -395,6 +420,8 @@
#include "armadillo_bits/glue_join_meat.hpp"
#include "armadillo_bits/glue_relational_meat.hpp"
#include "armadillo_bits/glue_solve_meat.hpp"
+ #include "armadillo_bits/glue_conv_meat.hpp"
+ #include "armadillo_bits/glue_toeplitz_meat.hpp"
}
#endif
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -864,11 +864,11 @@
template<typename eT>
inline
void
-Col<eT>::load(const std::string name, const file_type type)
+Col<eT>::load(const std::string name, const file_type type, const bool print_status)
{
arma_extra_debug_sigprint();
- Mat<eT>::load(name,type);
+ Mat<eT>::load(name, type, print_status);
arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
}
@@ -878,11 +878,11 @@
template<typename eT>
inline
void
-Col<eT>::load(std::istream& is, const file_type type)
+Col<eT>::load(std::istream& is, const file_type type, const bool print_status)
{
arma_extra_debug_sigprint();
- Mat<eT>::load(is, type);
+ Mat<eT>::load(is, type, print_status);
arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
}
@@ -891,6 +891,34 @@
template<typename eT>
inline
+void
+Col<eT>::quiet_load(const std::string name, const file_type type)
+ {
+ arma_extra_debug_sigprint();
+
+ Mat<eT>::quiet_load(name, type);
+
+ arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+ }
+
+
+
+template<typename eT>
+inline
+void
+Col<eT>::quiet_load(std::istream& is, const file_type type)
+ {
+ arma_extra_debug_sigprint();
+
+ Mat<eT>::quiet_load(is, type);
+
+ arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
+ }
+
+
+
+template<typename eT>
+inline
typename Col<eT>::row_iterator
Col<eT>::begin_row(const u32 row_num)
{
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -110,10 +110,14 @@
inline void ones(const u32 n_elem);
inline void ones(const u32 n_rows, const u32 n_cols);
- inline void load(const std::string name, const file_type type = auto_detect);
- inline void load( std::istream& is, const file_type type = auto_detect);
+ inline void load(const std::string name, const file_type type = auto_detect, const bool print_status = true);
+ inline void load( std::istream& is, const file_type type = auto_detect, const bool print_status = true);
+ inline void quiet_load(const std::string name, const file_type type = auto_detect);
+ inline void quiet_load( std::istream& is, const file_type type = auto_detect);
+
+
typedef eT* row_iterator;
typedef const eT* const_row_iterator;
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -1723,33 +1723,39 @@
//! save the cube to a file
template<typename eT>
inline
-void
-Cube<eT>::save(const std::string name, const file_type type) const
+bool
+Cube<eT>::save(const std::string name, const file_type type, const bool print_status) const
{
arma_extra_debug_sigprint();
+ bool save_okay;
+
switch(type)
{
case raw_ascii:
- diskio::save_raw_ascii(*this, name);
+ save_okay = diskio::save_raw_ascii(*this, name);
break;
case arma_ascii:
- diskio::save_arma_ascii(*this, name);
+ save_okay = diskio::save_arma_ascii(*this, name);
break;
case arma_binary:
- diskio::save_arma_binary(*this, name);
+ save_okay = diskio::save_arma_binary(*this, name);
break;
case ppm_binary:
- diskio::save_ppm_binary(*this, name);
+ save_okay = diskio::save_ppm_binary(*this, name);
break;
default:
- arma_stop("Cube::save(): unsupported file type");
+ arma_warn(print_status, "Cube::save(): unsupported file type");
+ save_okay = false;
}
+ arma_warn( (print_status && (save_okay == false)), "Cube::save(): couldn't write to ", name);
+
+ return save_okay;
}
@@ -1757,33 +1763,39 @@
//! save the cube to a stream
template<typename eT>
inline
-void
-Cube<eT>::save(std::ostream& os, const file_type type) const
+bool
+Cube<eT>::save(std::ostream& os, const file_type type, const bool print_status) const
{
arma_extra_debug_sigprint();
+ bool save_okay;
+
switch(type)
{
case raw_ascii:
- diskio::save_raw_ascii(*this, "[ostream]", os);
+ save_okay = diskio::save_raw_ascii(*this, os);
break;
case arma_ascii:
- diskio::save_arma_ascii(*this, "[ostream]", os);
+ save_okay = diskio::save_arma_ascii(*this, os);
break;
case arma_binary:
- diskio::save_arma_binary(*this, "[ostream]", os);
+ save_okay = diskio::save_arma_binary(*this, os);
break;
case ppm_binary:
- diskio::save_ppm_binary(*this, "[ostream]", os);
+ save_okay = diskio::save_ppm_binary(*this, os);
break;
default:
- arma_stop("Cube::save(): unsupported file type");
+ arma_warn(print_status, "Cube::save(): unsupported file type");
+ save_okay = false;
}
+ arma_warn( (print_status && (save_okay == false)), "Cube::save(): couldn't write to given stream");
+
+ return save_okay;
}
@@ -1791,37 +1803,59 @@
//! load a cube from a file
template<typename eT>
inline
-void
-Cube<eT>::load(const std::string name, const file_type type)
+bool
+Cube<eT>::load(const std::string name, const file_type type, const bool print_status)
{
arma_extra_debug_sigprint();
+ bool load_okay;
+ std::string err_msg;
+
switch(type)
{
case auto_detect:
- diskio::load_auto_detect(*this, name);
+ load_okay = diskio::load_auto_detect(*this, name, err_msg);
break;
case raw_ascii:
- diskio::load_raw_ascii(*this, name);
+ load_okay = diskio::load_raw_ascii(*this, name, err_msg);
break;
case arma_ascii:
- diskio::load_arma_ascii(*this, name);
+ load_okay = diskio::load_arma_ascii(*this, name, err_msg);
break;
case arma_binary:
- diskio::load_arma_binary(*this, name);
+ load_okay = diskio::load_arma_binary(*this, name, err_msg);
break;
case ppm_binary:
- diskio::load_ppm_binary(*this, name);
+ load_okay = diskio::load_ppm_binary(*this, name, err_msg);
break;
default:
- arma_stop("Cube::load(): unsupported file type");
+ arma_warn(print_status, "Cube::load(): unsupported file type");
+ load_okay = false;
}
+ if( (print_status == true) && (load_okay == false) )
+ {
+ if(err_msg.length() > 0)
+ {
+ arma_print("Cube::load(): ", err_msg, name);
+ }
+ else
+ {
+ arma_print("Cube::load(): couldn't read ", name);
+ }
+ }
+
+ if(load_okay == false)
+ {
+ (*this).reset();
+ }
+
+ return load_okay;
}
@@ -1829,43 +1863,118 @@
//! load a cube from a stream
template<typename eT>
inline
-void
-Cube<eT>::load(std::istream& is, const file_type type)
+bool
+Cube<eT>::load(std::istream& is, const file_type type, const bool print_status)
{
arma_extra_debug_sigprint();
+ bool load_okay;
+ std::string err_msg;
+
switch(type)
{
case auto_detect:
- diskio::load_auto_detect(*this, "[istream]", is);
+ load_okay = diskio::load_auto_detect(*this, is, err_msg);
break;
case raw_ascii:
- diskio::load_raw_ascii(*this, "[istream]", is);
+ load_okay = diskio::load_raw_ascii(*this, is, err_msg);
break;
case arma_ascii:
- diskio::load_arma_ascii(*this, "[istream]", is);
+ load_okay = diskio::load_arma_ascii(*this, is, err_msg);
break;
case arma_binary:
- diskio::load_arma_binary(*this, "[istream]", is);
+ load_okay = diskio::load_arma_binary(*this, is, err_msg);
break;
case ppm_binary:
- diskio::load_ppm_binary(*this, "[istream]", is);
+ load_okay = diskio::load_ppm_binary(*this, is, err_msg);
break;
default:
- arma_stop("Cube::load(): unsupported file type");
+ arma_warn(print_status, "Cube::load(): unsupported file type");
+ load_okay = false;
}
+
+ if( (print_status == true) && (load_okay == false) )
+ {
+ if(err_msg.length() > 0)
+ {
+ arma_print("Cube::load(): ", err_msg, "the given stream");
+ }
+ else
+ {
+ arma_print("Cube::load(): couldn't load from the given stream");
+ }
+ }
+
+ if(load_okay == false)
+ {
+ (*this).reset();
+ }
+
+ return load_okay;
}
+//! save the cube to a file, without printing any error messages
template<typename eT>
inline
+bool
+Cube<eT>::quiet_save(const std::string name, const file_type type) const
+ {
+ arma_extra_debug_sigprint();
+
+ return (*this).save(name, type, false);
+ }
+
+
+
+//! save the cube to a stream, without printing any error messages
+template<typename eT>
+inline
+bool
+Cube<eT>::quiet_save(std::ostream& os, const file_type type) const
+ {
+ arma_extra_debug_sigprint();
+
+ return (*this).save(os, type, false);
+ }
+
+
+
+//! load a cube from a file, without printing any error messages
+template<typename eT>
+inline
+bool
+Cube<eT>::quiet_load(const std::string name, const file_type type)
+ {
+ arma_extra_debug_sigprint();
+
+ return (*this).load(name, type, false);
+ }
+
+
+
+//! load a cube from a stream, without printing any error messages
+template<typename eT>
+inline
+bool
+Cube<eT>::quiet_load(std::istream& is, const file_type type)
+ {
+ arma_extra_debug_sigprint();
+
+ return (*this).load(is, type, false);
+ }
+
+
+
+template<typename eT>
+inline
typename Cube<eT>::iterator
Cube<eT>::begin()
{
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -160,13 +160,20 @@
inline void reset();
- inline void save(const std::string name, const file_type type = arma_binary) const;
- inline void save( std::ostream& os, const file_type type = arma_binary) const;
- inline void load(const std::string name, const file_type type = auto_detect);
- inline void load( std::istream& is, const file_type type = auto_detect);
+ inline bool save(const std::string name, const file_type type = arma_binary, const bool print_status = true) const;
+ inline bool save( std::ostream& os, const file_type type = arma_binary, const bool print_status = true) const;
+ inline bool load(const std::string name, const file_type type = auto_detect, const bool print_status = true);
+ inline bool load( std::istream& is, const file_type type = auto_detect, const bool print_status = true);
+ inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
+ inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
+
+ inline bool quiet_load(const std::string name, const file_type type = auto_detect);
+ inline bool quiet_load( std::istream& is, const file_type type = auto_detect);
+
+
// iterators
typedef eT* iterator;
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -2612,33 +2612,39 @@
//! save the matrix to a file
template<typename eT>
inline
-void
-Mat<eT>::save(const std::string name, const file_type type) const
+bool
+Mat<eT>::save(const std::string name, const file_type type, const bool print_status) const
{
arma_extra_debug_sigprint();
+ bool save_okay;
+
switch(type)
{
case raw_ascii:
- diskio::save_raw_ascii(*this, name);
+ save_okay = diskio::save_raw_ascii(*this, name);
break;
case arma_ascii:
- diskio::save_arma_ascii(*this, name);
+ save_okay = diskio::save_arma_ascii(*this, name);
break;
case arma_binary:
- diskio::save_arma_binary(*this, name);
+ save_okay = diskio::save_arma_binary(*this, name);
break;
case pgm_binary:
- diskio::save_pgm_binary(*this, name);
+ save_okay = diskio::save_pgm_binary(*this, name);
break;
default:
- arma_stop("Mat::save(): unsupported file type");
+ arma_warn(print_status, "Mat::save(): unsupported file type");
+ save_okay = false;
}
+ arma_warn( (print_status && (save_okay == false)), "Mat::save(): couldn't write to ", name);
+
+ return save_okay;
}
@@ -2646,33 +2652,39 @@
//! save the matrix to a stream
template<typename eT>
inline
-void
-Mat<eT>::save(std::ostream& os, const file_type type) const
+bool
+Mat<eT>::save(std::ostream& os, const file_type type, const bool print_status) const
{
arma_extra_debug_sigprint();
+ bool save_okay;
+
switch(type)
{
case raw_ascii:
- diskio::save_raw_ascii(*this, "[ostream]", os);
+ save_okay = diskio::save_raw_ascii(*this, os);
break;
case arma_ascii:
- diskio::save_arma_ascii(*this, "[ostream]", os);
+ save_okay = diskio::save_arma_ascii(*this, os);
break;
case arma_binary:
- diskio::save_arma_binary(*this, "[ostream]", os);
+ save_okay = diskio::save_arma_binary(*this, os);
break;
case pgm_binary:
- diskio::save_pgm_binary(*this, "[ostream]", os);
+ save_okay = diskio::save_pgm_binary(*this, os);
break;
default:
- arma_stop("Mat::save(): unsupported file type");
+ arma_warn(print_status, "Mat::save(): unsupported file type");
+ save_okay = false;
}
+ arma_warn( (print_status && (save_okay == false)), "Mat::save(): couldn't write to the given stream");
+
+ return save_okay;
}
@@ -2680,37 +2692,59 @@
//! load a matrix from a file
template<typename eT>
inline
-void
-Mat<eT>::load(const std::string name, const file_type type)
+bool
+Mat<eT>::load(const std::string name, const file_type type, const bool print_status)
{
arma_extra_debug_sigprint();
+ bool load_okay;
+ std::string err_msg;
+
switch(type)
{
case auto_detect:
- diskio::load_auto_detect(*this, name);
+ load_okay = diskio::load_auto_detect(*this, name, err_msg);
break;
case raw_ascii:
- diskio::load_raw_ascii(*this, name);
+ load_okay = diskio::load_raw_ascii(*this, name, err_msg);
break;
case arma_ascii:
- diskio::load_arma_ascii(*this, name);
+ load_okay = diskio::load_arma_ascii(*this, name, err_msg);
break;
case arma_binary:
- diskio::load_arma_binary(*this, name);
+ load_okay = diskio::load_arma_binary(*this, name, err_msg);
break;
case pgm_binary:
- diskio::load_pgm_binary(*this, name);
+ load_okay = diskio::load_pgm_binary(*this, name, err_msg);
break;
default:
- arma_stop("Mat::load(): unsupported file type");
+ arma_warn(print_status, "Mat::load(): unsupported file type");
+ load_okay = false;
}
+ if( (print_status == true) && (load_okay == false) )
+ {
+ if(err_msg.length() > 0)
+ {
+ arma_print("Mat::load(): ", err_msg, name);
+ }
+ else
+ {
+ arma_print("Mat::load(): couldn't read ", name);
+ }
+ }
+
+ if(load_okay == false)
+ {
+ (*this).reset();
+ }
+
+ return load_okay;
}
@@ -2718,43 +2752,118 @@
//! load a matrix from a stream
template<typename eT>
inline
-void
-Mat<eT>::load(std::istream& is, const file_type type)
+bool
+Mat<eT>::load(std::istream& is, const file_type type, const bool print_status)
{
arma_extra_debug_sigprint();
+ bool load_okay;
+ std::string err_msg;
+
switch(type)
{
case auto_detect:
- diskio::load_auto_detect(*this, "[istream]", is);
+ load_okay = diskio::load_auto_detect(*this, is, err_msg);
break;
case raw_ascii:
- diskio::load_raw_ascii(*this, "[istream]", is);
+ load_okay = diskio::load_raw_ascii(*this, is, err_msg);
break;
case arma_ascii:
- diskio::load_arma_ascii(*this, "[istream]", is);
+ load_okay = diskio::load_arma_ascii(*this, is, err_msg);
break;
case arma_binary:
- diskio::load_arma_binary(*this, "[istream]", is);
+ load_okay = diskio::load_arma_binary(*this, is, err_msg);
break;
case pgm_binary:
- diskio::load_pgm_binary(*this, "[istream]", is);
+ load_okay = diskio::load_pgm_binary(*this, is, err_msg);
break;
default:
- arma_stop("Mat::load(): unsupported file type");
+ arma_warn(print_status, "Mat::load(): unsupported file type");
+ load_okay = false;
}
+
+ if( (print_status == true) && (load_okay == false) )
+ {
+ if(err_msg.length() > 0)
+ {
+ arma_print("Mat::load(): ", err_msg, "the given stream");
+ }
+ else
+ {
+ arma_print("Mat::load(): couldn't load from the given stream");
+ }
+ }
+
+ if(load_okay == false)
+ {
+ (*this).reset();
+ }
+
+ return load_okay;
}
+//! save the matrix to a file, without printing any error messages
template<typename eT>
inline
+bool
+Mat<eT>::quiet_save(const std::string name, const file_type type) const
+ {
+ arma_extra_debug_sigprint();
+
+ return (*this).save(name, type, false);
+ }
+
+
+
+//! save the matrix to a stream, without printing any error messages
+template<typename eT>
+inline
+bool
+Mat<eT>::quiet_save(std::ostream& os, const file_type type) const
+ {
+ arma_extra_debug_sigprint();
+
+ return (*this).save(os, type, false);
+ }
+
+
+
+//! load a matrix from a file, without printing any error messages
+template<typename eT>
+inline
+bool
+Mat<eT>::quiet_load(const std::string name, const file_type type)
+ {
+ arma_extra_debug_sigprint();
+
+ return (*this).load(name, type, false);
+ }
+
+
+
+//! load a matrix from a stream, without printing any error messages
+template<typename eT>
+inline
+bool
+Mat<eT>::quiet_load(std::istream& is, const file_type type)
+ {
+ arma_extra_debug_sigprint();
+
+ return (*this).load(is, type, false);
+ }
+
+
+
+template<typename eT>
+inline
Mat<eT>::row_iterator::row_iterator(Mat<eT>& in_M, const u32 in_row)
: M (in_M )
, row(in_row)
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -198,16 +198,16 @@
inline void print(const std::string extra_text = "") const;
inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
-
+
inline void print_trans(const std::string extra_text = "") const;
inline void print_trans(std::ostream& user_stream, const std::string extra_text = "") const;
-
+
inline void raw_print(const std::string extra_text = "") const;
inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
-
+
inline void raw_print_trans(const std::string extra_text = "") const;
inline void raw_print_trans(std::ostream& user_stream, const std::string extra_text = "") const;
-
+
template<typename eT2>
inline void copy_size(const Mat<eT2>& m);
@@ -223,13 +223,20 @@
inline void reset();
- inline void save(const std::string name, const file_type type = arma_binary) const;
- inline void save( std::ostream& os, const file_type type = arma_binary) const;
- inline void load(const std::string name, const file_type type = auto_detect);
- inline void load( std::istream& is, const file_type type = auto_detect);
+ inline bool save(const std::string name, const file_type type = arma_binary, const bool print_status = true) const;
+ inline bool save( std::ostream& os, const file_type type = arma_binary, const bool print_status = true) const;
+ inline bool load(const std::string name, const file_type type = auto_detect, const bool print_status = true);
+ inline bool load( std::istream& is, const file_type type = auto_detect, const bool print_status = true);
+ inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
+ inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
+
+ inline bool quiet_load(const std::string name, const file_type type = auto_detect);
+ inline bool quiet_load( std::istream& is, const file_type type = auto_detect);
+
+
// iterators
typedef eT* iterator;
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -836,11 +836,11 @@
template<typename eT>
inline
void
-Row<eT>::load(const std::string name, const file_type type)
+Row<eT>::load(const std::string name, const file_type type, const bool print_status)
{
arma_extra_debug_sigprint();
- Mat<eT>::load(name,type);
+ Mat<eT>::load(name, type, print_status);
arma_debug_check( (Mat<eT>::n_rows > 1), "Row(): incompatible dimensions" );
}
@@ -850,11 +850,11 @@
template<typename eT>
inline
void
-Row<eT>::load(std::istream& is, const file_type type)
+Row<eT>::load(std::istream& is, const file_type type, const bool print_status)
{
arma_extra_debug_sigprint();
- Mat<eT>::load(is, type);
+ Mat<eT>::load(is, type, print_status);
arma_debug_check( (Mat<eT>::n_rows > 1), "Row(): incompatible dimensions" );
}
@@ -863,6 +863,34 @@
template<typename eT>
inline
+void
+Row<eT>::quiet_load(const std::string name, const file_type type)
+ {
+ arma_extra_debug_sigprint();
+
+ Mat<eT>::quiet_load(name, type);
+
+ arma_debug_check( (Mat<eT>::n_rows > 1), "Row(): incompatible dimensions" );
+ }
+
+
+
+template<typename eT>
+inline
+void
+Row<eT>::quiet_load(std::istream& is, const file_type type)
+ {
+ arma_extra_debug_sigprint();
+
+ Mat<eT>::quiet_load(is, type);
+
+ arma_debug_check( (Mat<eT>::n_rows > 1), "Row(): incompatible dimensions" );
+ }
+
+
+
+template<typename eT>
+inline
typename Row<eT>::row_iterator
Row<eT>::begin_row(const u32 row_num)
{
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -111,10 +111,14 @@
inline void ones(const u32 N);
inline void ones(const u32 n_rows, const u32 n_cols);
- inline void load(const std::string name, const file_type type = auto_detect);
- inline void load( std::istream& is, const file_type type = auto_detect);
+ inline void load(const std::string name, const file_type type = auto_detect, const bool print_status = true);
+ inline void load( std::istream& is, const file_type type = auto_detect, const bool print_status = true);
+ inline void quiet_load(const std::string name, const file_type type = auto_detect);
+ inline void quiet_load( std::istream& is, const file_type type = auto_detect);
+
+
typedef eT* row_iterator;
typedef const eT* const_row_iterator;
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -23,15 +23,24 @@
{
static const unsigned int major = 0;
static const unsigned int minor = 9;
- static const unsigned int patch = 10;
+ static const unsigned int patch = 52;
static
inline
std::string
as_string()
{
+ const char* nickname = "Monkey Wrench";
+
std::stringstream ss;
- ss << arma_version::major << '.' << arma_version::minor << '.' << arma_version::patch;
+ ss << arma_version::major
+ << '.'
+ << arma_version::minor
+ << '.'
+ << arma_version::patch
+ << " ("
+ << nickname
+ << ')';
return ss.str();
}
Modified: pkg/RcppArmadillo/inst/include/armadillo_bits/atlas_proto.hpp
===================================================================
--- pkg/RcppArmadillo/inst/include/armadillo_bits/atlas_proto.hpp 2010-07-25 16:37:44 UTC (rev 1869)
+++ pkg/RcppArmadillo/inst/include/armadillo_bits/atlas_proto.hpp 2010-07-26 01:34:19 UTC (rev 1870)
@@ -24,10 +24,10 @@
using ::CblasNoTrans;
using ::CblasTrans;
-// using ::cblas_sdot;
-// using ::cblas_ddot;
-// using ::cblas_cdotu_sub;
-// using ::cblas_zdotu_sub;
+ using ::cblas_sdot;
+ using ::cblas_ddot;
+ using ::cblas_cdotu_sub;
+ using ::cblas_zdotu_sub;
using ::cblas_sgemv;
using ::cblas_dgemv;
@@ -57,41 +57,68 @@
inline static const T& tmp_real(const std::complex<T>& X) { return X.real(); }
-// template<typename eT>
-// inline
-// void
-// cblas_dot(const int N, const eT *X, const int incX, const eT *Y, const int incY, eT& out)
-// {
-// arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
-//
-// if(is_float<eT>::value == true)
-// {
-// typedef float T;
-// out = eT( cblas_sdot(N, (const T*)X, incX, (const T*)Y, incY) );
-// }
-// else
-// if(is_double<eT>::value == true)
-// {
-// typedef double T;
-// out = eT( cblas_ddot(N, (const T*)X, incX, (const T*)Y, incY) );
-// }
-// else
-// if(is_supported_complex_float<eT>::value == true)
-// {
-// typedef std::complex<float> T;
-// cblas_cdotu_sub(N, (const T*)X, incX, (const T*)Y, incY, (T*)&out);
-// }
-// else
-// if(is_supported_complex_double<eT>::value == true)
-// {
-// typedef std::complex<double> T;
-// cblas_zdotu_sub(N, (const T*)X, incX, (const T*)Y, incY, (T*)&out);
-// }
-// }
+ template<typename eT>
+ arma_inline
+ eT
+ cblas_dot(const int N, const eT* X, const eT* Y)
+ {
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 1870
More information about the Rcpp-commits
mailing list