Logo

Programming-Idioms

  • D
  • Scheme
  • Pascal

Idiom #201 Euclidean norm

Calculate n, the Euclidean norm of data, where data is a list of floating point values.

uses math;
var
  data: array of double;
...
  n := norm(data);
...
n = norm2( data )

data may be a multidimensional array (e.g. data(:,:)). n is the Frobenius norm if data is a 2-dimensional array (matrix).

New implementation...
< >
Bart