From bbdcfe44da4011574dabb19b4f83e2ab199c667a Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Tue, 10 Dec 2019 12:35:50 +0100
Subject: [PATCH] Remove traces in functions.c

---
 pkg/src/functions.c | 29 ++---------------------------
 1 file changed, 2 insertions(+), 27 deletions(-)

diff --git a/pkg/src/functions.c b/pkg/src/functions.c
index 68f1b79..f311a34 100644
--- a/pkg/src/functions.c
+++ b/pkg/src/functions.c
@@ -54,24 +54,13 @@ void Moments_M3(double* X, double* Y, int* pn, int* pd, double* M3)
 	}
 }
 
-#include <stdio.h>
-
 // W = 1/N sum( t(g(Zi,theta)) g(Zi,theta) )
 // with g(Zi, theta) = i-th contribution to all moments (size dim) - real moments
 void Compute_Omega(double* X, double* Y, double* M, int* pn, int* pd, double* W)
 {
 	int n=*pn, d=*pd;
   int dim = d + d*d + d*d*d;
-
-//printf("X: \n");
-//for (int kk=0; kk<d*n; kk++) printf("%f ",X[kk]);
-//printf("\n");
-//printf("Y: \n");
-//for (int kk=0; kk<n; kk++) printf("%f ",Y[kk]);
-//printf("\n");
-//printf("M: \n");
-//for (int kk=0; kk<dim; kk++) printf("%f ",M[kk]);
-//printf("\n");
+  //double* W = (double*)malloc(dim*dim*sizeof(double));
 
   // (Re)Initialize W:
   for (int j=0; j<dim; j++)
@@ -79,12 +68,10 @@ void Compute_Omega(double* X, double* Y, double* M, int* pn, int* pd, double* W)
     for (int k=0; k<dim; k++)
       W[j*dim+k] = 0.0;
   }
-
-  //double* W = (double*)calloc(dim*dim,sizeof(double));
   double* g = (double*)malloc(dim*sizeof(double));
   for (int i=0; i<n; i++)
   {
-    // Fill gi:
+    // g == gi:
     for (int j=0; j<d; j++)
       g[j] = Y[i] * X[mi(i,j,n,d)] - M[j];
     for (int j=d; j<d+(d*d); j++)
@@ -110,11 +97,6 @@ void Compute_Omega(double* X, double* Y, double* M, int* pn, int* pd, double* W)
         g[j] -= Y[i] * X[mi(i,idx1,n,d)];
       g[j] += Y[i] * X[mi(i,idx1,n,d)]*X[mi(i,idx2,n,d)]*X[mi(i,idx3,n,d)] - M[j];
     }
-
-//printf("i=%i, g=: \n", i);
-//for (int kk=0; kk<d; kk++) printf("%f ",g[kk]);
-//printf("\n");
-
     // Add 1/n t(gi) %*% gi to W
     for (int j=0; j<dim; j++)
     {
@@ -123,11 +105,4 @@ void Compute_Omega(double* X, double* Y, double* M, int* pn, int* pd, double* W)
     }
   }
   free(g);
-
-//  for (int j=0; j<dim; j++)
-//  {
-//    printf("\n");
-//    for (int k=0; k<dim; k++)
-//      printf("%f ",W[j*dim+k]);
-//  }
 }
-- 
2.44.0