cos method Null safety

  1. @override
void cos()
override

Calculates cos for each element.

Element i is calculated with the formula:

x[i] = cos(x[i]);

Implementation

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