[sdpb] 130/233: Simplified types.h

Tobias Hansen thansen at moszumanska.debian.org
Thu Mar 9 04:06:29 UTC 2017


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

thansen pushed a commit to branch master
in repository sdpb.

commit 312a9ac915078709553fb8584a2f2e94b82d72af
Author: David Simmons-Duffin <dsd at minerva.sns.ias.edu>
Date:   Sat Jan 10 03:54:44 2015 -0500

    Simplified types.h
---
 src/SDPSolver.h | 20 ++++++++++----------
 src/main.cpp    |  2 +-
 src/serialize.h |  2 +-
 src/types.h     | 39 ---------------------------------------
 4 files changed, 12 insertions(+), 51 deletions(-)

diff --git a/src/SDPSolver.h b/src/SDPSolver.h
index 19849b0..65dcc22 100644
--- a/src/SDPSolver.h
+++ b/src/SDPSolver.h
@@ -55,16 +55,16 @@ public:
   // command line or a file) after initializing other parameters.
   //
   void resetPrecision() {
-    setPrecision(dualityGapThreshold,          precision);
-    setPrecision(primalErrorThreshold,         precision);
-    setPrecision(dualErrorThreshold,           precision);
-    setPrecision(initialMatrixScalePrimal,     precision);
-    setPrecision(initialMatrixScaleDual,       precision);
-    setPrecision(feasibleCenteringParameter,   precision);
-    setPrecision(infeasibleCenteringParameter, precision);
-    setPrecision(stepLengthReduction,          precision);
-    setPrecision(choleskyStabilizeThreshold,   precision);
-    setPrecision(maxComplementarity,           precision);
+    dualityGapThreshold.set_prec(precision);
+    primalErrorThreshold.set_prec(precision);
+    dualErrorThreshold.set_prec(precision);
+    initialMatrixScalePrimal.set_prec(precision);
+    initialMatrixScaleDual.set_prec(precision);
+    feasibleCenteringParameter.set_prec(precision);
+    infeasibleCenteringParameter.set_prec(precision);
+    stepLengthReduction.set_prec(precision);
+    choleskyStabilizeThreshold.set_prec(precision);
+    maxComplementarity.set_prec(precision);
   }
 
   friend ostream& operator<<(ostream& os, const SDPSolverParameters& p);
diff --git a/src/main.cpp b/src/main.cpp
index 95aae9f..e21e005 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -41,7 +41,7 @@ int solveSDP(const path &sdpFile,
              SDPSolverParameters parameters) {
   // Set the default precision of all Real numbers to that specified
   // by the 'precision' parameter.
-  setDefaultPrecision(parameters.precision);
+  mpf_set_default_prec(parameters.precision);
 
   // Set cout to print the appropriate number of digits
   cout.precision(min(static_cast<int>(parameters.precision * 0.31 + 5), 30));
diff --git a/src/serialize.h b/src/serialize.h
index 28bad13..d94abf7 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -44,7 +44,7 @@ namespace boost {
     template<class Archive>
     void save(Archive& ar, Real const& f, unsigned int version) {
       std::ostringstream os;
-      os.precision(getPrecision(f));
+      os.precision(f.get_prec());
       os << f;
       std::string s = os.str();
       ar & s;
diff --git a/src/types.h b/src/types.h
index fb26ee5..b5972b9 100644
--- a/src/types.h
+++ b/src/types.h
@@ -12,46 +12,7 @@
 #include <mblas.h>
 #include <mlapack.h>
 
-#if defined ___MPACK_BUILD_WITH_GMP___
 typedef mpackint Integer;
 typedef mpf_class Real;
 
-inline void setDefaultPrecision(int prec) {
-  mpf_set_default_prec(prec);
-}
-
-inline int getDefaultPrecision() {
-  return mpf_get_default_prec();
-}
-
-inline void setPrecision(Real &r, int prec) {
-  r.set_prec(prec);
-}
-
-inline int getPrecision(const Real &r) {
-  return r.get_prec();
-}
-#endif
-
-#if defined ___MPACK_BUILD_WITH_MPFR___
-typedef mpackint Integer;
-typedef mpreal Real;
-
-inline void setDefaultPrecision(int prec) {
-  mpreal::set_default_prec(prec);
-}
-
-inline int getDefaultPrecision() {
-  return mpreal::get_default_prec();
-}
-
-inline void setPrecision(Real &r, int prec) {
-  r.set_prec(prec);
-}
-
-inline int getPrecision(const Real &r) {
-  return r.get_prec();
-}
-#endif
-
 #endif  // SDPB_TYPES_H_

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



More information about the debian-science-commits mailing list