|
@@ -25,6 +25,11 @@
|
|
#include <gsl/gsl_multifit.h>
|
|
#include <gsl/gsl_multifit.h>
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+
|
|
|
|
+#ifdef MLR_MODEL
|
|
|
|
+#include "mindgels.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
typedef struct { int h, w; double *x;} matrix_t, *matrix;
|
|
typedef struct { int h, w; double *x;} matrix_t, *matrix;
|
|
|
|
|
|
static long count_file_lines(FILE *f)
|
|
static long count_file_lines(FILE *f)
|
|
@@ -133,9 +138,90 @@ void gsl_multiple_reg_coeff(double *mpar, double *my, long n, unsigned ncoeff, u
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef MLR_MODEL
|
|
void dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff, unsigned nparameters, double *coeff, unsigned **combinations)
|
|
void dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff, unsigned nparameters, double *coeff, unsigned **combinations)
|
|
{
|
|
{
|
|
-
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(nn <= ncoeff)
|
|
|
|
+ {
|
|
|
|
+ printf("\nERROR: This function is not intended for the use when number of parameters is larger than the number of observations. Check how your matrices A and B were allocated or simply add more benchmarks.\n");
|
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
char trans = 'N';
|
|
char trans = 'N';
|
|
integer m = nn;
|
|
integer m = nn;
|
|
integer n = ncoeff;
|
|
integer n = ncoeff;
|
|
@@ -149,12 +235,14 @@ void dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff
|
|
Y[i] = my[i];
|
|
Y[i] = my[i];
|
|
X[i*n] = 1.;
|
|
X[i*n] = 1.;
|
|
for (int j=1; j < n; j++)
|
|
for (int j=1; j < n; j++)
|
|
|
|
+ {
|
|
coefficient = 1.;
|
|
coefficient = 1.;
|
|
for(int k=0; k < nparameters; k++)
|
|
for(int k=0; k < nparameters; k++)
|
|
{
|
|
{
|
|
coefficient *= pow(mpar[i*nparameters+k],combinations[j-1][k]);
|
|
coefficient *= pow(mpar[i*nparameters+k],combinations[j-1][k]);
|
|
}
|
|
}
|
|
X[i*n+j] = coefficient;
|
|
X[i*n+j] = coefficient;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
integer lda = m;
|
|
integer lda = m;
|
|
@@ -170,7 +258,7 @@ void dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff
|
|
|
|
|
|
if( info != 0 )
|
|
if( info != 0 )
|
|
{
|
|
{
|
|
- printf( "Problems with DGELS; info=%i\n");
|
|
+ printf( "Problems with DGELS; info=%ld\n", info);
|
|
exit(1);
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -181,6 +269,7 @@ void dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff
|
|
free(Y);
|
|
free(Y);
|
|
free(work);
|
|
free(work);
|
|
}
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, double *coeff, unsigned ncoeff, unsigned nparameters, unsigned **combinations, char *codelet_name)
|
|
int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, double *coeff, unsigned ncoeff, unsigned nparameters, unsigned **combinations, char *codelet_name)
|
|
{
|
|
{
|
|
@@ -221,9 +310,10 @@ int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, doubl
|
|
|
|
|
|
#ifdef TESTGSL
|
|
#ifdef TESTGSL
|
|
gsl_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);
|
|
gsl_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);
|
|
-#elseif
|
|
|
|
- dgels_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);
|
|
|
|
#endif
|
|
#endif
|
|
|
|
+#ifdef MLR_MODEL
|
|
|
|
+ dgels_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
if (calibrate==2)
|
|
if (calibrate==2)
|