[mlpack-svn] r16389 - mlpack/trunk/src/mlpack/core/optimizers/lrsdp

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Mar 28 11:53:28 EDT 2014


Author: rcurtin
Date: Fri Mar 28 11:53:27 2014
New Revision: 16389

Log:
Better ToString() output.


Modified:
   mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp.cpp
   mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp
   mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp_function.hpp

Modified: mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp.cpp	(original)
+++ mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp.cpp	Fri Mar 28 11:53:27 2014
@@ -30,9 +30,6 @@
 {
   std::ostringstream convert;
   convert << "LRSDP [" << this << "]" << std::endl;
-  convert << "  Matrix Size: " << function.C().n_rows << "x"
-      << function.C().n_cols << std::endl;
-  convert << "  Initial point Size : " << function.GetInitialPoint().n_rows
-      << "x" << function.GetInitialPoint().n_cols << std::endl;
+  convert << "  Optimizer: " << util::Indent(augLag.ToString(), 1) << std::endl;
   return convert.str();
 }

Modified: mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp	(original)
+++ mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp_function.cpp	Fri Mar 28 11:53:27 2014
@@ -55,6 +55,21 @@
       << "optimizers!" << std::endl;
 }
 
+// Return a string representation of the object.
+std::string LRSDPFunction::ToString() const
+{
+  std::stringstream convert;
+  convert << "LRSDPFunction [" << this << "]" << std::endl;
+  convert << "  Number of constraints: " << a.size() << std::endl;
+  convert << "  Constraint matrix (A_i) size: " << initialPoint.n_rows << "x"
+      << initialPoint.n_cols << std::endl;
+  convert << "  A_i modes: " << aModes.t();
+  convert << "  Constraint b_i values: " << b.t();
+  convert << "  Objective matrix (C) size: " << c.n_rows << "x" << c.n_cols
+      << std::endl;
+  return convert.str();
+}
+
 namespace mlpack {
 namespace optimization {
 

Modified: mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp_function.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp_function.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/optimizers/lrsdp/lrsdp_function.hpp	Fri Mar 28 11:53:27 2014
@@ -57,7 +57,7 @@
   size_t NumConstraints() const { return b.n_elem; }
 
   //! Get the initial point of the LRSDP.
-  const arma::mat& GetInitialPoint() const {return initialPoint; }
+  const arma::mat& GetInitialPoint() const { return initialPoint; }
 
   //! Return the objective function matrix (C).
   const arma::mat& C() const { return c; }
@@ -79,6 +79,9 @@
   //! Modify the vector of B values.
   arma::vec& B() { return b; }
 
+  //! Return string representation of object.
+  std::string ToString() const;
+
  private:
   //! Objective function matrix c.
   arma::mat c;



More information about the mlpack-svn mailing list