[mlpack] 171/207: 1 : use extern template to export part of the implementation of Load function 2 : use LoadCSV to relpace implementation of the part of csv loading

Barak A. Pearlmutter barak+git at pearlmutter.net
Thu Mar 23 17:53:51 UTC 2017


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

bap pushed a commit to branch master
in repository mlpack.

commit 4e3ed908fe4f4340b69418f48248cec1f7ece6b3
Author: stereomatchingkiss <thamngapwei at gmail.com>
Date:   Sun Feb 12 18:06:48 2017 +0800

    1 : use extern template to export part of the implementation of Load function
    2 : use LoadCSV to relpace implementation of the part of csv loading
---
 src/mlpack/core/data/CMakeLists.txt |  2 ++
 src/mlpack/core/data/load.cpp       | 18 ++++++++++++++++++
 src/mlpack/core/data/load.hpp       | 13 +++++++++++++
 src/mlpack/core/data/load_impl.hpp  |  6 +++++-
 4 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/core/data/CMakeLists.txt b/src/mlpack/core/data/CMakeLists.txt
index be64aac..bc27227 100644
--- a/src/mlpack/core/data/CMakeLists.txt
+++ b/src/mlpack/core/data/CMakeLists.txt
@@ -6,8 +6,10 @@ set(SOURCES
   extension.hpp
   format.hpp
   load_csv.hpp
+  load_csv.cpp
   load.hpp  
   load_impl.hpp
+  load.cpp
   load_arff.hpp
   load_arff_impl.hpp
   normalize_labels.hpp
diff --git a/src/mlpack/core/data/load.cpp b/src/mlpack/core/data/load.cpp
new file mode 100644
index 0000000..3170f4c
--- /dev/null
+++ b/src/mlpack/core/data/load.cpp
@@ -0,0 +1,18 @@
+#include "load.hpp"
+
+namespace mlpack {
+namespace data /** Functions to load and save matrices and models. */ {
+
+/*template bool Load<int, IncrementPolicy>(std::string const&, arma::Mat<int>&, DatasetMapper<IncrementPolicy>&,
+const bool fatal, const bool transpose);
+
+template bool Load<size_t, IncrementPolicy>(std::string const&, arma::Mat<size_t>&, DatasetMapper<IncrementPolicy>&,
+const bool fatal, const bool transpose);
+
+template bool Load<float, IncrementPolicy>(std::string const&, arma::Mat<float>&, DatasetMapper<IncrementPolicy>&,
+const bool fatal, const bool transpose);
+
+template bool Load<double, IncrementPolicy>(std::string const&, arma::Mat<double>&, DatasetMapper<IncrementPolicy>&,
+const bool fatal, const bool transpose);//*/
+
+}}
diff --git a/src/mlpack/core/data/load.hpp b/src/mlpack/core/data/load.hpp
index 9860e1b..72ca918 100644
--- a/src/mlpack/core/data/load.hpp
+++ b/src/mlpack/core/data/load.hpp
@@ -18,6 +18,7 @@
 #include <mlpack/core/arma_extend/arma_extend.hpp> // Includes Armadillo.
 #include <string>
 
+#include "load.hpp"
 #include "format.hpp"
 #include "dataset_mapper.hpp"
 #include "load_csv.hpp"
@@ -168,6 +169,18 @@ bool Load(const std::string& filename,
           const bool fatal = false,
           const bool transpose = true);
 
+/*extern template bool Load<int, IncrementPolicy>(std::string const&, arma::Mat<int>&, DatasetMapper<IncrementPolicy>&,
+const bool fatal, const bool transpose);
+
+extern template bool Load<size_t, IncrementPolicy>(std::string const&, arma::Mat<size_t>&, DatasetMapper<IncrementPolicy>&,
+const bool fatal, const bool transpose);
+
+extern template bool Load<float, IncrementPolicy>(std::string const&, arma::Mat<float>&, DatasetMapper<IncrementPolicy>&,
+const bool fatal, const bool transpose);
+
+extern template bool Load<double, IncrementPolicy>(std::string const&, arma::Mat<double>&, DatasetMapper<IncrementPolicy>&,
+const bool fatal, const bool transpose);//*/
+
 /**
  * Load a model from a file, guessing the filetype from the extension, or,
  * optionally, loading the specified format.  If automatic extension detection
diff --git a/src/mlpack/core/data/load_impl.hpp b/src/mlpack/core/data/load_impl.hpp
index 4fea5ce..98b1598 100644
--- a/src/mlpack/core/data/load_impl.hpp
+++ b/src/mlpack/core/data/load_impl.hpp
@@ -21,6 +21,10 @@
 #include <algorithm>
 #include <mlpack/core/util/timers.hpp>
 
+#include "load_csv.hpp"
+#include "load.hpp"
+#include "extension.hpp"
+
 #include <boost/serialization/serialization.hpp>
 #include <boost/algorithm/string/trim.hpp>
 #include <boost/archive/xml_iarchive.hpp>
@@ -66,7 +70,7 @@ void TransposeTokens(std::vector<std::vector<std::string>> const &input,
   }
 }
 
-}
+} //namespace details
 
 template<typename eT>
 bool inline inplace_transpose(arma::Mat<eT>& X)

-- 
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