float *dist_accumulator = NULL;
float *tmp_coords = NULL;
float **b = NULL;
-#ifdef NONCORE
- FILE *fp = NULL;
-#endif
double *degrees = NULL;
float *lap2 = NULL;
int lap_length;
lap2[count] = (float) degrees[i];
}
-#ifdef NONCORE
- fpos_t pos;
- if (n > max_nodes_in_mem) {
-#define FILENAME "tmp_Dij$$$.bin"
- fp = fopen(FILENAME, "wb");
- fwrite(lap2, sizeof(float), lap_length, fp);
- fclose(fp);
- fp = NULL;
- }
-#endif
-
/*************************
** Layout optimization **
*************************/
tmp_coords = N_GNEW(n, float);
dist_accumulator = N_GNEW(n, float);
-#ifdef NONCORE
- if (n <= max_nodes_in_mem) {
-#endif
- lap1 = N_GNEW(lap_length, float);
-#ifdef NONCORE
- } else {
- lap1 = lap2;
- fp = fopen(FILENAME, "rb");
- fgetpos(fp, &pos);
- }
-#endif
+ lap1 = N_GNEW(lap_length, float);
old_stress = DBL_MAX; /* at least one iteration */
/* First, construct Laplacian of 1/(d_ij*|p_i-p_j|) */
set_vector_val(n, 0, degrees);
-#ifdef NONCORE
- if (n <= max_nodes_in_mem) {
-#endif
- sqrt_vecf(lap_length, lap2, lap1);
-#ifdef NONCORE
- } else {
- sqrt_vec(lap_length, lap1);
- }
-#endif
+ sqrt_vecf(lap_length, lap2, lap1);
for (count = 0, i = 0; i < n - 1; i++) {
len = n - i - 1;
/* init 'dist_accumulator' with zeros */
}
new_stress *= 2;
new_stress += constant_term; // only after mult by 2
-#ifdef NONCORE
- if (n > max_nodes_in_mem) {
- /* restore lap2 from disk */
- fsetpos(fp, &pos);
- fread(lap2, sizeof(float), lap_length, fp);
- }
-#endif
for (k = 0; k < dim; k++) {
right_mult_with_vector_ff(lap2, n, coords[k], tmp_coords);
new_stress -= vectors_inner_productf(n, coords[k], tmp_coords);
free(degrees);
free(lap2);
-
-#ifdef NONCORE
- if (n <= max_nodes_in_mem) {
-#endif
- free(lap1);
-#ifdef NONCORE
- }
- if (fp)
- fclose(fp);
-#endif
+ free(lap1);
finish:
free(ordering);
by d_{ij}^{-2} otherwise, they are normalized by d_{ij}^{-1}
*/
-#ifdef NONCORE
-/* Set 'max_nodes_in_mem' so that
- * 4*(max_nodes_in_mem^2) is smaller than the available memory (in bytes)
- * 4 = sizeof(float)
- */
-#define max_nodes_in_mem 18000
-#endif
-
/* relevant when using sparse distance matrix not within subspace */
#define smooth_pivots true
#ifdef ALTERNATIVE_STRESS_CALC
double mat_stress;
#endif
-#ifdef NONCORE
- FILE *fp = NULL;
-#endif
-
/*************************************************
** Computation of full, dense, unrestricted k-D **
lap2[count] = degrees[i];
}
-#ifdef NONCORE
- if (n > max_nodes_in_mem) {
-#define FILENAME "tmp_Dij$$$.bin"
- fp = fopen(FILENAME, "wb");
- fwrite(lap2, sizeof(float), lap_length, fp);
- fclose(fp);
- fp = NULL;
- }
-#endif
-
/*************************
** Layout optimization **
*************************/
tmp_coords = N_NEW(n, float);
dist_accumulator = N_NEW(n, float);
- lap1 = NULL;
-#ifdef NONCORE
- if (n <= max_nodes_in_mem) {
- lap1 = N_NEW(lap_length, float);
- } else {
- lap1 = lap2;
- fp = fopen(FILENAME, "rb");
- fgetpos(fp, &pos);
- }
-#else
lap1 = N_NEW(lap_length, float);
-#endif
#ifdef USE_MAXFLOAT
memset(degrees, 0, n * sizeof(DegType));
if (exp == 2) {
#ifdef Dij2
-#ifdef NONCORE
- if (n <= max_nodes_in_mem) {
- sqrt_vecf(lap_length, lap2, lap1);
- } else {
- sqrt_vec(lap_length, lap1);
- }
-#else
sqrt_vecf(lap_length, lap2, lap1);
-#endif
#endif
}
for (count = 0, i = 0; i < n - 1; i++) {
}
new_stress *= 2;
new_stress += constant_term; /* only after mult by 2 */
-#ifdef NONCORE
- if (n > max_nodes_in_mem) {
- /* restore lap2 from memory */
- fsetpos(fp, &pos);
- fread(lap2, sizeof(float), lap_length, fp);
- }
-#endif
for (k = 0; k < dim; k++) {
right_mult_with_vector_ff(lap2, n, coords[k], tmp_coords);
new_stress -= vectors_inner_productf(n, coords[k], tmp_coords);
d_coords[i][j] = coords[i][j];
}
}
-#ifdef NONCORE
- if (fp)
- fclose(fp);
-#endif
finish1:
free(f_storage);
free(coords);