Metric multidimensional scaling places points so that their Euclidean distances match given dissimilarities . D is a symmetric (N, N) matrix with zero diagonal and positive off-diagonal entries; Z is (N, L). All sums below run over pairs .
stress(D, Z): Kruskal's normalised stress .
sammon_stress(D, Z): Sammon's stress (each pair counted once).
smacof(D, n_iter, Z0): minimise the raw stress by the Guttman transform , where for (and when ) and . Starting from Z0, apply n_iter updates. Return (Z, history) where history lists the raw stress of Z0 followed by the raw stress after each update (length n_iter + 1).