return this;
}
public double[][] run() {
if (fdistances.rowCount() == 0) return new double[0][2];
Mds mds = new Mds(fdistances, fInitialConfiguration, Function.IDENTITY, Function.IDENTITY, Function.IDENTITY);
int len = fdistances.rowCount();
fdistances = null;
fInitialConfiguration = null;
loop: while (fiterations > 0) {
if (fListener != null) fListener.update(mds);
long t = System.nanoTime();
double prev = 1.0;
for (int n = 0; n < 5; n++) {
mds.mds_once(true);
mds.mds_once(true);
double stress = mds.stress;
if (prev - stress < fThreshold) break loop;
prev = stress;
}
if (fOut != null) fOut.printf("%d, %d (stress=%f)\n",
(int) (1e9 * 10 / (System.nanoTime() - t)),
(int) (1e9 * 10 * len / (System.nanoTime() - t)),
prev);
fiterations -= 10;
}
if (fListener != null) fListener.update(mds);
return mds.points();
}