matrixNormOne function Null safety

double matrixNormOne(
  1. Array2d a
)

One norm return maximum column sum.

Examples

var a = Array2d([
  Array([1, 2, 3]),
  Array([1, 2, 3]),
  Array([1, 2, 3]),
]);

print(a.norm1());

/* output:
9
*/

Implementation

double matrixNormOne(Array2d a) {
  var f = 0.0;
  for (var j = 0; j < a.column; j++) {
    var s = 0.0;
    for (var i = 0; i < a.row; i++) {
      s += a[i][j].abs();
    }
    f = math.max(f, s);
  }
  return f;
}