From f47183deb252f12d532af81a491083f1411cacc8 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Wed, 13 Sep 2023 16:38:55 +0200 Subject: [PATCH] Remove OpenMP dependency (and unused variable) --- pkg/DESCRIPTION | 2 +- pkg/src/functions.c | 6 +++--- pkg/src/hungarian.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index c2833c6..706925c 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -6,7 +6,7 @@ Description: Mixture of logistic regressions parameters (H)estimation with (General Linear Model). For more details see chapter 3 in the PhD thesis of Mor-Absa Loum: <https://www.theses.fr/s156435>, available here <https://theses.hal.science/tel-01877796/document>. -Version: 1.0-3 +Version: 1.0-4 Author: Benjamin Auder <Benjamin.Auder@u-psud.fr> [aut,cre], Mor-Absa Loum <Mor-Absa.Loum@u-psud.fr> [aut] Maintainer: Benjamin Auder <Benjamin.Auder@u-psud.fr> diff --git a/pkg/src/functions.c b/pkg/src/functions.c index 79deff4..89e84ef 100644 --- a/pkg/src/functions.c +++ b/pkg/src/functions.c @@ -1,5 +1,5 @@ #include <stdlib.h> -#include <omp.h> +//#include <omp.h> // Index matrix (by columns) #define mi(i, j, d1, d2) (j*d1 + i) @@ -53,7 +53,7 @@ void Moments_M3(double* X, double* Y, int* pn, int* pd, double* M3) // with g(Zi, theta) = i-th contribution to all moments (size dim) - real moments void Compute_Omega(double* X, int* Y, double* M, int* pnc, int* pn, int* pd, double* W) { - int nc=*pnc, n=*pn, d=*pd; + int n=*pn, d=*pd; //,nc=*pnc int dim = d + d*d + d*d*d; //double* W = (double*)malloc(dim*dim*sizeof(double)); @@ -101,7 +101,7 @@ void Compute_Omega(double* X, int* Y, double* M, int* pnc, int* pn, int* pd, dou // This final nested loop is very costly. Some basic optimisations: double gj = g[j]; int baseIdx = j * dim; - #pragma GCC unroll 32 +// #pragma GCC unroll 32 for (int k=j; k>=0; k--) W[baseIdx+k] += gj * g[k]; } diff --git a/pkg/src/hungarian.c b/pkg/src/hungarian.c index 9671a43..3b2a28d 100644 --- a/pkg/src/hungarian.c +++ b/pkg/src/hungarian.c @@ -112,7 +112,7 @@ void hungarian_free(hungarian_problem_t* p) { void hungarian_solve(hungarian_problem_t* p) { int i, j, m, n, k, l, t, q, unmatched; - double cost, s; + double s; //,cost int* col_mate; int* row_mate; int* parent_row; @@ -122,7 +122,7 @@ void hungarian_solve(hungarian_problem_t* p) double* slack; int* slack_row; - cost = 0.; +// cost = 0.; m =p->num_rows; n =p->num_cols; @@ -160,7 +160,7 @@ void hungarian_solve(hungarian_problem_t* p) for (k=1; k<m; k++) if (p->cost[k][l]<s) s=p->cost[k][l]; - cost+=s; +// cost+=s; if (s!=0.) for (k=0; k<m; k++) p->cost[k][l]-=s; @@ -335,11 +335,11 @@ done: } /*TRACE("\n");*/ } - for (i=0; i<m; i++) +/* for (i=0; i<m; i++) cost+=row_dec[i]; for (i=0; i<n; i++) cost-=col_inc[i]; - +*/ free(slack); free(col_inc); free(parent_row); -- 2.44.0