Skip to content

@saehrimnir/druidjs / norm

Function: norm()

ts
function norm(v: 
  | number[]
  | Float64Array<ArrayBufferLike>
  | Matrix, metric?: Metric): number;

Defined in: matrix/norm.js:14

Computes the norm of a vector, by computing its distance to 0.

Parameters

ParameterTypeDefault valueDescription
v| number[] | Float64Array<ArrayBufferLike> | MatrixundefinedVector.
metric?MetriceuclideanWhich metric should be used to compute the norm. Default is euclidean

Returns

number

  • The norm of v.