VECTOR_NORM scalar function

Calculates the distance of the given vector from the zero vector.

Read syntax diagramSkip visual syntax diagramVECTOR_DISTANCE(vector, metric)

The schema is SYSIBM.

vector
A VECTOR expression
metric
Identifies the metric used to compute the distance between the vector and the zero vector.
Note: A zero vector is the base vector from which the magnitude for a vector is computed. All points (dimensions) of a zero vector have zero values.
The following metrics are supported:
  • EUCLIDEAN
  • EUCLIDEAN_SQUARED

Result

The result of the function is a DOUBLE value representing the computed distance between vector and the zero vector using the specified metric. If the first argument can be null, the result can be null; if the first argument is null, the result is the null value.

Examples

The following example shows the command syntax for computing the Euclidean distance between the specified vector and the zero vector:
SELECT VECTOR_NORM(VECTOR('[-0.0762727, 0.0559632]', 2, REAL), EUCLIDEAN)
FROM SYSIBM.SYSDUMMY1
The following example shows the output from running the SELECT statement:
1
------------------------
  +9.46012951215538E-002

  1 record(s) selected.