From 26d6e047dfe66c3942a2471acb05594702bf376c Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 21 Aug 2024 18:33:48 +0100
Subject: [PATCH] MNT: remove obsolete debugging macros and statements

---
 miscmaths.cc | 22 +---------------------
 miscmaths.h  |  3 ---
 sparsefn.cc  | 24 ------------------------
 3 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/miscmaths.cc b/miscmaths.cc
index 267554b..30e4947 100644
--- a/miscmaths.cc
+++ b/miscmaths.cc
@@ -553,8 +553,6 @@ namespace MISCMATHS {
       if (eigenvals(i+1)>tolerance)
         therank++;
 
-    // cout << "tolerance = " << tolerance << "\n" << "eigenvalues = " << eigenvals << "\n" << "rank = " << therank << endl;
-
     return therank;
   }
 
@@ -2520,16 +2518,12 @@ namespace MISCMATHS {
 
     /////////////////////
     // setup
-    OUT("Setup");
 
     int ntpts=Y.Nrows();
     int nevs=X.Ncols();
 
     if(ntpts!=X.Nrows())
-      throw Exception("COCK");
-
-    OUT(nevs);
-    OUT(ntpts);
+      throw Exception("Number of time points does not match number of rows in design matrix!");
 
     ColumnVector gam_m(nevs);
     gam_m=1e10;
@@ -2552,7 +2546,6 @@ namespace MISCMATHS {
     }
     else
     {
-      OUT("no ols");
       B.ReSize(nevs);
       B=0;
       lambdaB=1;
@@ -2563,9 +2556,6 @@ namespace MISCMATHS {
       gam_y=10;
     }
 
-    //     OUT(B(1));
-    //     OUT(lambdaB(1));
-
     float trace_ilambdaZZ=1;
 
     SymmetricMatrix ZZ;
@@ -2579,12 +2569,10 @@ namespace MISCMATHS {
 
     /////////////////////
     // iterate
-    OUT("Iterate");
 
     int i = 1;;
     for(; i<=niters; i++)
     {
-      cout<<i<<",";
       ////////////////////
       // update phim
       for(int l=1; l <= nevs; l++)
@@ -2597,8 +2585,6 @@ namespace MISCMATHS {
 	    gam_m(l) = b_m*c_m;
 	  }
 
-      // 	OUT(gam_m(1));
-
       ////////////////////
       // update B
       ColumnVector beta(nevs);
@@ -2634,7 +2620,6 @@ namespace MISCMATHS {
       tmp2 << tmp3*ZZ;
 
       trace_ilambdaZZ=tmp2.Trace();
-      // 	OUT(trace_ilambdaZZ);
 
 
       /////////////////////
@@ -2649,12 +2634,7 @@ namespace MISCMATHS {
       float b_y = 1.0/(0.5*(sum + trace_ilambdaZZ)+1/b_y0);
 
       gam_y = b_y*c_y;
-
-      // 	OUT(gam_y);
-
     }
-
-    cout << endl;
   }
 
   vector<float> ColumnVector2vector(const ColumnVector& col)
diff --git a/miscmaths.h b/miscmaths.h
index bbb0850..1379aed 100644
--- a/miscmaths.h
+++ b/miscmaths.h
@@ -37,9 +37,6 @@ namespace MISCMATHS {
 #define M_PI            3.14159265358979323846
 #endif
 
-#define OUT(t) std::cout<<#t "="<<t<<std::endl;
-#define LOGOUT(t) Utilities::LogSingleton::getInstance().str()<<#t "="<<t<<std::endl;
-
   // IO/string stuff
   template <class T> std::string num2str(T n, int width=-1);
 
diff --git a/sparsefn.cc b/sparsefn.cc
index 432a12b..7da8566 100644
--- a/sparsefn.cc
+++ b/sparsefn.cc
@@ -354,16 +354,12 @@ namespace MISCMATHS {
     Tracer_Plus trace("sparsefns::solvefortracex");
 
     int every = Max(1,A.Ncols()/nsamps);
-    //    int every = 1;
-    //    OUT(every);
 
     float tr = 0.0;
 
     // assumes symmetric A and b
     for(int r = every; r<=A.Ncols();  r+=every)
     {
-      //  	cout << float(r)/A.Ncols() << "\r";
-      //  	cout.flush();
 
       ColumnVector br = b.RowAsColumn(r);
       ColumnVector xr = x.RowAsColumn(r);
@@ -381,8 +377,6 @@ namespace MISCMATHS {
       tr += xr(r);
     }
 
-    cout << endl;
-
     tr *= every;
 
     return tr;
@@ -395,8 +389,6 @@ namespace MISCMATHS {
     // assumes symmetric A and b
     for(int r = 1; r<=A.Ncols();  r++)
     {
-      cout << float(r)/A.Ncols() << "\r";
-      cout.flush();
 
       ColumnVector br = b.RowAsColumn(r);
       ColumnVector xr = x.RowAsColumn(r);
@@ -411,7 +403,6 @@ namespace MISCMATHS {
         }
 	  }
     }
-    cout << endl;
   }
 
   void solveforx(const SparseMatrix& A, const ColumnVector& b, ColumnVector& x, float tol, int kmax)
@@ -454,29 +445,14 @@ namespace MISCMATHS {
 	    multiply(A,p,w);
 
 	    float alpha = 0.0;
-	    //if(k>1)
 	    alpha = rho(k-1)/(p.t()*w).AsScalar();
-	    //else
-	    //alpha = 1;
 
 	    x += alpha*p;
 	    r -= alpha*w;
 	    rho(k) = Sqr(norm2(r));
 	  }
 
-
-      if(k>kmax/2.0)
-	  {
-  	    OUT(std::sqrt(rho(k-1)));
-  	    OUT(norm2(b));
-	    OUT(k);
-	    cout.flush();
-	  }
-
     }
-
-
-    //    write_ascii_matrix("rho",rho);
   }
 
   void solveforx(const SparseMatrix& U, const SparseMatrix& L, const ColumnVector& b, ColumnVector& x)
-- 
GitLab