[mlpack] 136/207: Avoid use of internal Armadillo structures in prefixedoustream_impl.hpp

Barak A. Pearlmutter barak+git at pearlmutter.net
Thu Mar 23 17:53:48 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 69c90e2249aa982f223ba4cb831d57e1721c4bec
Author: shikhar <shikharbhardwaj68 at gmail.com>
Date:   Sat Mar 11 16:52:31 2017 +0530

    Avoid use of internal Armadillo structures in prefixedoustream_impl.hpp
---
 src/mlpack/core/util/prefixedoutstream_impl.hpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mlpack/core/util/prefixedoutstream_impl.hpp b/src/mlpack/core/util/prefixedoutstream_impl.hpp
index 4abc16c..4772a7e 100644
--- a/src/mlpack/core/util/prefixedoutstream_impl.hpp
+++ b/src/mlpack/core/util/prefixedoutstream_impl.hpp
@@ -143,7 +143,7 @@ typename std::enable_if<arma::is_arma_type<T>::value>::type
 PrefixedOutStream::BaseLogic(const T& val)
 {
   // Extract printable object from the input.
-  auto printVal = arma::unwrap<T>(val).M;
+  const arma::Mat<typename T::elem_type> &printVal(val);
 
   // We will use this to track whether or not we need to terminate at the end of
   // this call (only for streams which terminate after a newline).
@@ -159,7 +159,7 @@ PrefixedOutStream::BaseLogic(const T& val)
   if (destination.flags() == convert.flags() &&
       destination.precision() == convert.precision())
   {
-    arma::arma_ostream::print(convert, printVal, true);
+    printVal.print(convert);
   }
   else
   {
@@ -168,7 +168,7 @@ PrefixedOutStream::BaseLogic(const T& val)
     convert.precision(destination.precision());
 
     // Set width of the convert stream
-    auto absVal = arma::abs(printVal).P.Q;
+    const arma::Mat<typename T::elem_type> &absVal(arma::abs(printVal));
     double maxVal = absVal.max();
 
     if (maxVal == 0.0)
@@ -178,7 +178,7 @@ PrefixedOutStream::BaseLogic(const T& val)
     maxLog = (maxLog > 0) ? floor(maxLog) + 1 : 1;
     const int padding = 4;
     convert.width(convert.precision() + maxLog + padding);
-    arma::arma_ostream::print(convert, printVal, false);
+    printVal.raw_print(convert);
   }
 
   if (convert.fail())

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