Expand description
Functions following jax.numpy, with NumPy’s broadcasting.
Operands are anything that converts to an array (ArrayLike): arrays,
scalars, and Rust values of the element type. At least one operand must
be an array or a scalar, which fixes the backend.
Modules§
- fft
- Discrete Fourier transforms following
jax.numpy.fft. - linalg
- Linear algebra following
jax.numpy.linalg(and NumPy’s semantics), on matrices and batches of matrices (seelax::linalgfor the decompositions). The decompositions and solves (cholesky,solve,inv,qr,eigh,eigvalsh,svd,svdvals) takef32,f64,c64, andc128;det,slogdet, andnormtakef32andf64.
Structs§
- Axis
List - At most eight axes, stored without allocating.
Enums§
- Axes
- Axes of a reduction: all of them, or a list (negative values count from the end).
Constants§
- ALL
- Every axis.
Functions§
- abs
|x|(unsigned values are returned unchanged; the magnitude of a complex number is real).- add
x + y.- all
- Whether every element along
axesis true. - angle
- The arguments of complex numbers (
atan2(imag, real)), in radians. - any
- Whether any element along
axesis true. - arange
0, 1, ..., n - 1.- arctan2
atan2(x, y).- argmax
- The index (
i32) of the largest element alongaxis. - argmin
- The index (
i32) of the smallest element alongaxis. - astype
- Converts to another element type.
- broadcast_
to - Broadcasts to
shape. - cbrt
- Cube root.
- ceil
- Round up.
- clip
- Clamps to
[lo, hi](maximumthenminimum, propagating NaN). - concatenate
- Joins arrays along
axis. - conj
- The complex conjugates.
- conjugate
- The complex conjugates (
jnp.conjugate, the same asconj). - cos
- Cosine.
- cumprod
- The cumulative product along
axis(of the flattened array forNone), in the input type. - cumsum
- The cumulative sum along
axis(of the flattened array forNone), in the input type. - divide
x / y.- equal
- Whether two arrays are equal elementwise.
- exp
e^x.- expand_
dims - Inserts a dimension of size 1 at
axis. - expm1
e^x - 1.- floor
- Round down.
- floor_
divide - Integer division rounding toward negative infinity, computed as JAX
does:
div, minus one where the signs ofxandydiffer and the remainder is nonzero (sox // 0is -2 forx != 0; unsigned integers onlydiv). - fmod
- The remainder of truncated division, with the sign of
x(C’sfmod). - full
- An array of
shapefilled withvalue. - imag
- The imaginary parts of complex numbers.
- isfinite
- Whether each element is finite.
- log
- Natural logarithm.
- log1p
log(1 + x).- logical_
and - Logical and.
- logical_
not - Logical not.
- logical_
or - Logical or.
- matmul
- Matrix product with NumPy’s rules for vectors and matrices.
- max
- The maximum over
axes. - maximum
- The maximum, propagating NaN.
- mean
- Averages over
axes, in the input type (16-bit floats inf32). - min
- The minimum over
axes. - minimum
- The minimum, propagating NaN.
- multiply
x * y.- negative
-x.- ones
- An array of ones.
- power
x^y.- real
- The real parts of complex numbers.
- remainder
- The remainder with the sign of
y(Python’s%,jnp.remainder):x - floor(x / y) * y, computed as JAX does (rem, addingywhere the signs differ; an integeryof zero is replaced by one). - roll
xwith the elements alongaxismoved by a staticshifttoward higher indices, wrapping around (jnp.roll(x, shift, axis)): elementigoes to(i + shift) mod n. As in JAX, it is two slices and a concatenation.- round
- Round, halfway cases to even (NumPy’s rounding).
- round_
with - Rounds with the given method (
roundwith a method, for completeness). - sign
- The sign (
x / |x|for complex numbers). - sin
- Sine.
- sqrt
- Square root.
- square
x * x.- stack
- Stacks arrays (or scalars) along a new dimension
axis. - subtract
x - y.- sum
- Sums over
axes. 16-bit floats accumulate inf32, as in JAX. - take
- The elements of
xatindicesalongaxis(jnp.take(x, indices, axis, mode="clip"), which is JAX’s indexingx[..., indices, ...]): the result has the shape ofxwith dimensionaxisreplaced by the shape ofindices. Negative indices count from the end, and indices out of bounds are clamped. - tan
- Tangent.
- tanh
- Hyperbolic tangent.
- where_
cond ? x : yelementwise, with broadcasting.- zeros
- An array of zeros.