abs method Null safety

  1. @override
void abs()
override

Calculates absolute value for each element.

Element i is calculated with the formula:

x[i] = x[i].abs();

Implementation

@override
void abs() {
  final elements = this.elements;
  final n = length;
  for (var i = 0; i < n; i++) {
    elements[i] = elements[i].abs();
  }
}