neg method Null safety

  1. @override
void neg()
override

Negates elements.

Element i is calculated with the formula:

x[i] = -x[i];

Implementation

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