[mlpack] 104/149: Issue a runtime error if the user is using Armadillo 4.300.x through 4.400.x and tries to load or save HDF5 files, since that is a bug in Armadillo.

Barak A. Pearlmutter barak+git at pearlmutter.net
Sat May 2 09:11:14 UTC 2015


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit a56f8d43fa073699a073419a4e1b6f5955ddade0
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Tue Nov 18 22:55:49 2014 +0000

    Issue a runtime error if the user is using Armadillo 4.300.x through 4.400.x and
    tries to load or save HDF5 files, since that is a bug in Armadillo.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17382 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/core/data/load_impl.hpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/mlpack/core/data/load_impl.hpp b/src/mlpack/core/data/load_impl.hpp
index 44f4e88..23731f0 100644
--- a/src/mlpack/core/data/load_impl.hpp
+++ b/src/mlpack/core/data/load_impl.hpp
@@ -142,6 +142,22 @@ bool Load(const std::string& filename,
 #ifdef ARMA_USE_HDF5
     loadType = arma::hdf5_binary;
     stringType = "HDF5 data";
+  #if ARMA_VERSION_MAJOR == 4 && \
+      (ARMA_VERSION_MINOR >= 300 && ARMA_VERSION_MINOR <= 400)
+    Timer::Stop("loading_data");
+    if (fatal)
+      Log::Fatal << "Attempted to load '" << filename << "' as HDF5 data, but "
+          << "Armadillo 4.300.0 through Armadillo 4.400.1 are known to have "
+          << "bugs and one of these versions is in use.  Load failed."
+          << std::endl;
+    else
+      Log::Warn << "Attempted to load '" << filename << "' as HDF5 data, but "
+          << "Armadillo 4.300.0 through Armadillo 4.400.1 are known to have "
+          << "bugs and one of these versions is in use.  Load failed."
+          << std::endl;
+
+    return false;
+  #endif
 #else
     Timer::Stop("loading_data");
     if (fatal)
@@ -185,6 +201,8 @@ bool Load(const std::string& filename,
     Log::Info << "Loading '" << filename << "' as " << stringType << ".  "
         << std::flush;
 
+  Log::Debug << "load type " << loadType << "\n";
+
   const bool success = matrix.load(stream, loadType);
 
   if (!success)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list