normF function

double normF(
  1. Matrix a
)

Implementation

double normF(Matrix a) {
  double total = 0;

  double scale = a[0].max();

  if (scale == 0.0) return 0.0;

  final int size = a.length;

  for (int i = 0; i < size; i++) {
    double val = a[i][0] / scale;
    total += val * val;
  }

  return scale * sqrt(total);
}