ext/nmf.c in gsl-1.12.109 vs ext/nmf.c in gsl-1.14.5
- old
+ new
@@ -14,20 +14,22 @@
#define MAXITER 1000
#undef DEBUG
#define mm(a, b) gsl_matrix_mult(a, b)
+//gsl_matrix * gsl_matrix_mult(gsl_matrix *a, gsl_matrix *b)
gsl_matrix * gsl_matrix_mult(const gsl_matrix *a, const gsl_matrix *b)
{
gsl_matrix *c;
c = gsl_matrix_alloc(a->size1, b->size2);
gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, a, b, 0.0, c);
return c;
}
// pretty print
+//void pp(gsl_matrix *m)
void pp(const gsl_matrix *m)
{
int r, c;
for(r=0; r<m->size1; r++) {
@@ -37,10 +39,11 @@
printf("\n");
}
}
/* Returns a distance cost */
+//double difcost(gsl_matrix *a, gsl_matrix *b)
double difcost(const gsl_matrix *a, const gsl_matrix *b)
{
int i, j;
double dif=0, d;
@@ -48,9 +51,10 @@
{
for (j=0; j < a->size2; j++)
{
d = gsl_matrix_get(a, i, j) - gsl_matrix_get(b, i, j);
dif += d*d;
+ // dif += pow(gsl_matrix_get(a, i, j) - gsl_matrix_get(b, i, j), 2);
}
}
return dif;
}