sub method

  1. @override
void sub(
  1. Tensor<double> right
)
override

Subtracts elements of the arguments.

Element i is calculated with the formula:

x[i] = x[i] - right[i];

Throws ArgumentError if tensor shapes are not equal.

Implementation

@override
void sub(Tensor<double> right) {
  _checkSameShape(right);
  final elements = this.elements;
  final rightElements = right.elements;
  final n = length;
  for (var i = 0; i < n; i++) {
    elements[i] -= rightElements[i];
  }
}