From a27d53c381a88e0f8c8788a772575e35464294ef Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Mon, 7 Jun 2021 23:34:49 +0200
Subject: [PATCH] Fix computeW (was random - TODO)

---
 doc/LeastSquareMoments_Auder.et.al_2020.pdf | 1 +
 doc/Properties.of.GMM_Hansen_1982.pdf       | 1 +
 doc/TensorMethods_Anandkumar.et.al_2016.pdf | 1 +
 pkg/src/functions.c                         | 5 +++--
 4 files changed, 6 insertions(+), 2 deletions(-)
 create mode 100644 doc/LeastSquareMoments_Auder.et.al_2020.pdf
 create mode 100644 doc/Properties.of.GMM_Hansen_1982.pdf
 create mode 100644 doc/TensorMethods_Anandkumar.et.al_2016.pdf

diff --git a/doc/LeastSquareMoments_Auder.et.al_2020.pdf b/doc/LeastSquareMoments_Auder.et.al_2020.pdf
new file mode 100644
index 0000000..0f7c5f3
--- /dev/null
+++ b/doc/LeastSquareMoments_Auder.et.al_2020.pdf
@@ -0,0 +1 @@
+#$# git-fat d0b1d918a857132502576d36b698b45a2b7834c8               298962
diff --git a/doc/Properties.of.GMM_Hansen_1982.pdf b/doc/Properties.of.GMM_Hansen_1982.pdf
new file mode 100644
index 0000000..eba0a09
--- /dev/null
+++ b/doc/Properties.of.GMM_Hansen_1982.pdf
@@ -0,0 +1 @@
+#$# git-fat b79c9e7ac99547fb23c93f8281f597fdc2e106f4               455153
diff --git a/doc/TensorMethods_Anandkumar.et.al_2016.pdf b/doc/TensorMethods_Anandkumar.et.al_2016.pdf
new file mode 100644
index 0000000..f762d97
--- /dev/null
+++ b/doc/TensorMethods_Anandkumar.et.al_2016.pdf
@@ -0,0 +1 @@
+#$# git-fat db091adbb5bfcb3ad434507e9121557198e05114               256264
diff --git a/pkg/src/functions.c b/pkg/src/functions.c
index 0551016..79deff4 100644
--- a/pkg/src/functions.c
+++ b/pkg/src/functions.c
@@ -64,8 +64,9 @@ void Compute_Omega(double* X, int* Y, double* M, int* pnc, int* pn, int* pd, dou
       W[j*dim+k] = 0.0;
   }
   double* g = (double*)malloc(dim*sizeof(double));
-  omp_set_num_threads(nc >= 1 ? nc : omp_get_num_procs());
-  #pragma omp parallel for
+  // TODO: stabilize this (for now, random result)
+//  omp_set_num_threads(nc >= 1 ? nc : omp_get_num_procs());
+//  #pragma omp parallel for
   for (int i=0; i<n; i++)
   {
     // g == gi:
-- 
2.44.0