Computes the squared Euclidean distance between two data sets.

Namespace:  CenterSpace.NMath.Stats
Assembly:  NMathStats (in NMathStats.dll) Version: 3.4.0.0

Syntax

C#
public static double SquaredEuclideanDistance(
	DoubleVector data1,
	DoubleVector data2
)
Visual Basic (Declaration)
Public Shared Function SquaredEuclideanDistance ( _
	data1 As DoubleVector, _
	data2 As DoubleVector _
) As Double
Visual C++
public:
static double SquaredEuclideanDistance(
	DoubleVector^ data1, 
	DoubleVector^ data2
)

Parameters

data1
Type: CenterSpace.NMath.Core..::.DoubleVector
The first data set.
data2
Type: CenterSpace.NMath.Core..::.DoubleVector
The second data set.

Return Value

The distance between data1 and data2.

Remarks

This distance is computed as:
CopyC#
distance( x, y ) = sum ( xi - yi )^2
Squaring the simple Euclidean distance places progressively greater weight on objects that are further apart.
Missing values are allowed. Pairs of elements are excluded from the distance measure when their comparison returns NaN. If all pairs are excluded, NaN is returned for the distance measure.

Exceptions

ExceptionCondition
CenterSpace.NMath.Core..::.MismatchedSizeException Thrown if the given data sets do not have equal lengths.

See Also