<< scidoe_sortdesign Support scidoe_string >>

Scidoe >> Scidoe > Support > scidoe_squareform

scidoe_squareform

Format distance matrix

Calling Sequence

S=scidoe_squareform(D)
D=scidoe_squareform(S)
S=scidoe_squareform(D,"tomatrix")
D=scidoe_squareform(S,"tovector")

Parameters

D :

a 1-by-b matrix of doubles, the distance vector, where b = m*(m-1)/2

S :

a m-by-m matrix of doubles, the pairwise distances

Description

S=scidoe_squareform(D) converts the pairwise distances D computed by scidoe_pdist into the square matrix S, so that S(i,j) is the distance between points i and j, for i,j=1,2,...,m. The diagonal part of S is zero.

D=scidoe_squareform(S) converts the square matrix of distances S into the vector of distances D.

By default, if D has a single entry (scalar), then convert it to a square matrix.

Examples

// Compute the euclidean distance between all pairs
// of points of the matrix
X = [
0.1629447    0.8616334
0.5811584    0.3826752
0.2270954    0.4442068
0.7670017    0.7264718
0.8253974    0.1937736
]
D = scidoe_pdist(X)
S = scidoe_squareform(D)
D = scidoe_squareform(S)

// See when there is only one point.
X = [
0.3185689    0.684731
];
D1=scidoe_pdist(X)
S1=scidoe_squareform(D1)
D2=scidoe_squareform(S1)

// See the action on a scalar zero
scidoe_squareform(0.)
scidoe_squareform(0.,"tovector")
scidoe_squareform(0.,"tomatrix")

See also

Bibliography

http://www.mathworks.fr/fr/help/stats/squareform.html

Authors


Report an issue
<< scidoe_sortdesign Support scidoe_string >>