ILNumerics Ultimate VSILMathdistL2sq Method (InArraySingle, InArraySingle)ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Computes the [m x n] squared pairwise L2 distances between data points provided in A [d x m] and B [d x n].

[ILNumerics Computing Engine]

Namespace: ILNumerics
Assembly: ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.3.0.0 (5.3.7131.2749)
Syntax

public static RetArray<float> distL2sq(
	InArray<float> A,
	InArray<float> B
)

Parameters

A
Type: ILNumericsInArraySingle
Input data matrix A [d x m], m points are provided as columns of length d.
B
Type: ILNumericsInArraySingle
Input data matrix B [d x n], n points are provided as columns of length d.

Return Value

Type: RetArraySingle
Distance matrix D of size [m x n]. Di,j is the squared euclidian distance between data point i in A and data point j in B.
Remarks

This function computes the square of the pairwise euclidian (L2) distances between data values in A and B.

In order to get the non-squared distances one may use the sqrt(BaseArrayDouble) function on the array returned.

For those coming from languages like Matlab / Octave: the equivalent function there would be: bsxfun(@plus, dot(X, X, 1)',dot(Y,Y,1))-2*(X' * Y)

[ILNumerics Computing Engine]

See Also

Reference