div method
Calculates fraction of two tensors.
Element i
is calculated with the formula:
x[i] = x[i] / right[i];
If swapArguments
is true
, the arguments will be swapped.
Throws ArgumentError if tensor shapes is non-equal.
Implementation
@override
void div(Tensor<double> right, {bool swapArguments = false}) {
_checkSameShape(right);
final elements = this.elements;
final rightElements = right.elements;
final n = length;
if (swapArguments) {
for (var i = 0; i < n; i++) {
elements[i] = rightElements[i] / elements[i];
}
} else {
for (var i = 0; i < n; i++) {
elements[i] /= rightElements[i];
}
}
}