vecNorm function

double vecNorm(
  1. Vector v
)

L2 norm ‖v‖.

Implementation

double vecNorm(Vector v) {
  var acc = 0.0;
  for (final x in v.values) {
    acc += x * x;
  }
  return math.sqrt(acc);
}