pub fn floor_divide<B: Backend, T: Int>(
x: impl ArrayLike<B, T>,
y: impl ArrayLike<B, T>,
) -> Array<B, T>Expand description
Integer division rounding toward negative infinity, computed as JAX
does: div, minus one where the signs of x and y differ and the
remainder is nonzero (so x // 0 is -2 for x != 0; unsigned integers
only div).
ยงExamples
use ruxla_core::{Array, Native, jnp};
let x = Array::<Native, i32>::from_slice(&[7, -7, 5, 0, -5], [5]);
let y = Array::<Native, i32>::from_slice(&[2, 2, 0, 0, 0], [5]);
assert_eq!(jnp::floor_divide(&x, &y).to_vec(), [3, -4, -2, -1, -2]);