Skip to main content

Module elementwise

Module elementwise 

Source
Expand description

Elementwise operations on slices.

Each function dispatches on the operation once, outside the loop, so that the operation is inlined into the loop and the loop can be vectorized. The results are the same as applying Ops element by element.

Functionsยง

binary_assign
x[i] = op(x[i], y[i]), where y of length 1 stands for every element (an elementwise operation written over its first operand).
binary_into
out[i] = op(x[i], y[i]), where a slice of length 1 stands for every element (a broadcast scalar).
compare_into
out[i] = op(x[i], y[i]) for a comparison, where a slice of length 1 stands for every element.
unary_assign
x[i] = op(x[i]) (an elementwise operation written over its operand).
unary_into
out[i] = op(x[i]).