pydiodon.dis2gram¶
- pydiodon.dis2gram(dis, no_loop=True)[source]¶
Computes a Gram matrix knowing a distance matrix
- Parameters
- dis: a 2D numpy array, size `n x n`, of floats
is a distance or dissimilarity matrix to be analyzed
- Returns
- grama 2D numpy array, size n x n, of floats
the associated Gram matrix
Notes
if \(d_{i.}^2 = (1/n) \sum_j d_{ij}^2\) and \(d_{..}^2 = (1/n^2) \sum_{i,j} d_{ij}^2\)
then
\(gram[i,j] = -(1/2) (d_{ij}^2 - d_{i.}^2 - d_{.j}^2 + d_{..}^2)\)
af, 07/11/2017, 22.10.13