mul method Null safety

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

Multiplies elements.

Element i is calculated with the formula:

x[i] = x[i] * right[i];

Throws ArgumentError if tensor shapes are not equal.

Implementation

@override
void mul(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];
  }
}