*rhs = x00;
}
-double get_stress(int m, int dim, int *iw, int *jw, double *w, double *d, double *x, double scaling, int weighted){
+double get_stress(int m, int dim, int *iw, int *jw, double *w, double *d, double *x, double scaling){
int i, j;
double res = 0., dist;
/* we use the fact that d_ij = w_ij*graph_dist(i,j). Also, d_ij and x are scalinged by *scaling, so divide by it to get actual unscaled streee. */
continue;
}
dist = d[j]/w[j];/* both negative*/
- if (weighted){
- res += -w[j]*(dist - distance(x, dim, i, jw[j]))*(dist - distance(x, dim, i, jw[j]));
- } else {
- res += (dist - distance(x, dim, i, jw[j]))*(dist - distance(x, dim, i, jw[j]));
- }
+ res += -w[j]*(dist - distance(x, dim, i, jw[j]))*(dist - distance(x, dim, i, jw[j]));
}
}
return 0.5*res/scaling/scaling;
iw = Lw->ia; jw = Lw->ja;
#ifdef DEBUG_PRINT
- if (Verbose) fprintf(stderr, "initial stress = %f\n", get_stress(m, dim, iw, jw, w, d, x, sm->scaling, 1));
+ if (Verbose) fprintf(stderr, "initial stress = %f\n", get_stress(m, dim, iw, jw, w, d, x, sm->scaling));
#else
(void)iw;
(void)jw;
#ifdef DEBUG_PRINT
if (Verbose) {
- fprintf(stderr, "stress1 = %g\n",get_stress(m, dim, iw, jw, w, d, x, sm->scaling, 1));
+ fprintf(stderr, "stress1 = %g\n",get_stress(m, dim, iw, jw, w, d, x, sm->scaling));
}
#endif
if (flag) goto RETURN;
#ifdef DEBUG_PRINT
- if (Verbose) fprintf(stderr, "stress2 = %g\n",get_stress(m, dim, iw, jw, w, d, y, sm->scaling, 1));
+ if (Verbose) fprintf(stderr, "stress2 = %g\n",get_stress(m, dim, iw, jw, w, d, y, sm->scaling));
#endif
diff = total_distance(m, dim, x, y)/sqrt(vector_product(m*dim, x, x));
#ifdef DEBUG_PRINT
#endif
#ifdef DEBUG_PRINT
- if (Verbose) fprintf(stderr, "iter = %d, final stress = %f\n", iter, get_stress(m, dim, iw, jw, w, d, x, sm->scaling, 1));
+ if (Verbose) fprintf(stderr, "iter = %d, final stress = %f\n", iter, get_stress(m, dim, iw, jw, w, d, x, sm->scaling));
#endif
RETURN: