The Complete SPRLIB & ANNLIB

sqrdistance

- calculate the squared distance (LOCAL)

SYNOPSIS

double sqrdistance (p1, p2, n)

ARGUMENTS

double *p1 The first pattern, a vector of size [1..n].
double *p2 The second pattern, a vector of size [1..n].
int n The dimensionality (size) of the patterns.

RETURNS

The function returns the squared distance between p1 and p2.

FUNCTION

This function calculates the squared distance between two patterns p1 and p2 by first computing the Hadamard product and then squaring and summing the individual elements.

NOTE

Both p1 and p2 are required to have the same length, and are both in vector format.

This document was generated using api2html on Thu Mar 5 09:00:00 MET DST 1998