Reference Guide > D Routines > DISTEUCLCART Function
  

DISTEUCLCART Function
Computes the distance with an Euclidean metric in cartesian coordinates.
Usage
d = DISTEUCLCART(x, y)
Input Parameters
x — An (p, n) array of p points in n-dimensional cartesian space.
y — An (q, n) array of q points in n-dimensional cartesian space.
Returned Value
d — An (p, q) array where d(i, j) is the square of the Euclidean distance between points x(i, *) and y(j, *). The result is computed with the precision of the higher input dataype, so input should generally be of type floating-point.
Keywords
None.
Discussion
The DISTEUCLCART function computes square of the Euclidean distance from each point in the first input array to each point in the second input array. All points must be specified in cartesian coordinates, but the dimension of the space is arbitrary.
Example
PM, DISTEUCLCART(REPLICATE(0.0,3,2), [[3.0,6.0], [4.0,8.0]])
; PV-WAVE prints:
;       25.0000       100.000
;       25.0000       100.000
;       25.0000       100.000

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.