pub trait Backend:
Copy
+ Default
+ Send
+ Sync
+ Debug
+ 'static
+ Sealed {
type Scalar<T: Element>: Copy + Debug;
type Array<T: Element>: Clone + Debug;
type Leaf: Clone + Debug;
Show 82 methods
// Required methods
fn lit<T: Element>(v: T) -> Self::Scalar<T>;
fn unary<T: Element>(op: UnaryOp, x: Self::Scalar<T>) -> Self::Scalar<T>;
fn binary<T: Element>(
op: BinaryOp,
x: Self::Scalar<T>,
y: Self::Scalar<T>,
) -> Self::Scalar<T>;
fn compare<T: Element>(
op: CompareOp,
x: Self::Scalar<T>,
y: Self::Scalar<T>,
) -> Self::Scalar<bool>;
fn is_finite<T: Element>(x: Self::Scalar<T>) -> Self::Scalar<bool>;
fn integer_pow<T: Element>(x: Self::Scalar<T>, y: i32) -> Self::Scalar<T>;
fn select<T: Element>(
c: Self::Scalar<bool>,
t: Self::Scalar<T>,
f: Self::Scalar<T>,
) -> Self::Scalar<T>;
fn cast<T: Element, U: Element>(x: Self::Scalar<T>) -> Self::Scalar<U>;
fn bitcast<T: Element, U: Element>(x: Self::Scalar<T>) -> Self::Scalar<U>;
fn to_real<T: Element>(
op: ToReal,
x: Self::Scalar<T>,
) -> Self::Scalar<T::Real>;
fn complex<C: Element>(
re: Self::Scalar<C::Real>,
im: Self::Scalar<C::Real>,
) -> Self::Scalar<C>;
fn conj<T: Element>(x: Self::Scalar<T>) -> Self::Scalar<T>;
fn constant<T: Element>(x: &NativeArray<T>) -> Self::Array<T>;
fn shape<T: Element>(x: &Self::Array<T>) -> Shape;
fn to_array<T: Element>(x: Self::Scalar<T>) -> Self::Array<T>;
fn to_scalar<T: Element>(x: &Self::Array<T>) -> Self::Scalar<T>;
fn a_unary<T: Element>(op: UnaryOp, x: &Self::Array<T>) -> Self::Array<T>;
fn a_binary<T: Element>(
op: BinaryOp,
x: &Self::Array<T>,
y: &Self::Array<T>,
) -> Self::Array<T>;
fn a_ternary<T: Element>(
op: TernaryOp,
x: &Self::Array<T>,
y: &Self::Array<T>,
z: &Self::Array<T>,
) -> Self::Array<T>;
fn a_compare<T: Element>(
op: CompareOp,
x: &Self::Array<T>,
y: &Self::Array<T>,
) -> Self::Array<bool>;
fn a_is_finite<T: Element>(x: &Self::Array<T>) -> Self::Array<bool>;
fn a_integer_pow<T: Element>(x: &Self::Array<T>, y: i32) -> Self::Array<T>;
fn a_cast<T: Element, U: Element>(x: &Self::Array<T>) -> Self::Array<U>;
fn a_bitcast<T: Element, U: Element>(x: &Self::Array<T>) -> Self::Array<U>;
fn a_to_real<T: Element>(
op: ToReal,
x: &Self::Array<T>,
) -> Self::Array<T::Real>;
fn a_complex<C: Element>(
re: &Self::Array<C::Real>,
im: &Self::Array<C::Real>,
) -> Self::Array<C>;
fn a_conj<T: Element>(x: &Self::Array<T>) -> Self::Array<T>;
fn a_select<T: Element>(
c: &Self::Array<bool>,
t: &Self::Array<T>,
f: &Self::Array<T>,
) -> Self::Array<T>;
fn a_clamp<T: Element>(
lo: &Self::Array<T>,
x: &Self::Array<T>,
hi: &Self::Array<T>,
) -> Self::Array<T>;
fn broadcast_in_dim<T: Element>(
x: &Self::Array<T>,
shape: &[usize],
dims: &[usize],
) -> Self::Array<T>;
fn reshape<T: Element>(
x: &Self::Array<T>,
shape: &[usize],
) -> Self::Array<T>;
fn transpose<T: Element>(
x: &Self::Array<T>,
perm: &[usize],
) -> Self::Array<T>;
fn slice<T: Element>(
x: &Self::Array<T>,
start: &[usize],
limit: &[usize],
strides: &[usize],
) -> Self::Array<T>;
fn dynamic_slice<T: Element, I: Element>(
x: &Self::Array<T>,
starts: &[Self::Scalar<I>],
sizes: &[usize],
) -> Self::Array<T>;
fn dynamic_update_slice<T: Element, I: Element>(
x: &Self::Array<T>,
update: &Self::Array<T>,
starts: &[Self::Scalar<I>],
) -> Self::Array<T>;
fn concatenate<T: Element>(
xs: &[Self::Array<T>],
dim: usize,
) -> Self::Array<T>;
fn pad<T: Element>(
x: &Self::Array<T>,
value: Self::Scalar<T>,
config: &[(i64, i64, usize)],
) -> Self::Array<T>;
fn rev<T: Element>(x: &Self::Array<T>, dims: &[usize]) -> Self::Array<T>;
fn iota<T: Element>(shape: &[usize], dim: usize) -> Self::Array<T>;
fn reduce<T: Element>(
op: ReduceOp,
x: &Self::Array<T>,
axes: &[usize],
) -> Self::Array<T>;
fn arg_min_max<T: Element, I: Element>(
x: &Self::Array<T>,
axis: usize,
max: bool,
) -> Self::Array<I>;
fn sort(
operands: &[Self::Leaf],
dimension: usize,
is_stable: bool,
num_keys: usize,
) -> Vec<Self::Leaf>;
fn cumulative<T: Element>(
op: CumulativeOp,
x: &Self::Array<T>,
axis: usize,
reverse: bool,
) -> Self::Array<T>;
fn top_k<T: Element>(
x: &Self::Array<T>,
k: usize,
axis: usize,
) -> (Self::Array<T>, Self::Array<i32>);
fn cholesky<T: LinalgScalar>(x: &Self::Array<T>) -> Self::Array<T>;
fn triangular_solve<T: LinalgScalar>(
a: &Self::Array<T>,
b: &Self::Array<T>,
options: TriangularSolveOptions,
) -> Self::Array<T>;
fn lu<T: LinalgScalar>(
x: &Self::Array<T>,
) -> (Self::Array<T>, Self::Array<i32>, Self::Array<i32>);
fn lu_pivots_to_permutation(
pivots: &Self::Array<i32>,
size: usize,
) -> Self::Array<i32>;
fn qr<T: LinalgScalar>(
x: &Self::Array<T>,
full_matrices: bool,
) -> (Self::Array<T>, Self::Array<T>);
fn qr_pivoting<T: LinalgScalar>(
x: &Self::Array<T>,
full_matrices: bool,
) -> (Self::Array<T>, Self::Array<T>, Self::Array<i32>);
fn eigh<T: LinalgScalar>(
x: &Self::Array<T>,
lower: bool,
sort_eigenvalues: bool,
subset_by_index: Option<(usize, usize)>,
algorithm: Option<EighImplementation>,
) -> (Self::Array<T>, Self::Array<T::Real>);
fn eig<T: LinalgScalar>(
x: &Self::Array<T>,
left: bool,
right: bool,
enable_eigvec_derivs: bool,
) -> (Self::Array<<T as LinalgScalar>::Complex>, Option<Self::Array<<T as LinalgScalar>::Complex>>, Option<Self::Array<<T as LinalgScalar>::Complex>>);
fn schur<T: LinalgScalar>(
x: &Self::Array<T>,
compute_schur_vectors: bool,
) -> (Self::Array<T>, Option<Self::Array<T>>);
fn hessenberg<T: LinalgScalar>(
x: &Self::Array<T>,
) -> (Self::Array<T>, Self::Array<T>);
fn householder_product<T: LinalgScalar>(
a: &Self::Array<T>,
taus: &Self::Array<T>,
) -> Self::Array<T>;
fn ormqr<T: LinalgScalar>(
a: &Self::Array<T>,
taus: &Self::Array<T>,
c: &Self::Array<T>,
left: bool,
transpose: bool,
) -> Self::Array<T>;
fn cholesky_update<T: LinalgFloat>(
r: &Self::Array<T>,
w: &Self::Array<T>,
) -> Self::Array<T>;
fn symmetric_product<T: LinalgFloat>(
a: &Self::Array<T>,
c: &Self::Array<T>,
alpha: f64,
beta: f64,
) -> Self::Array<T>;
fn tridiagonal<T: LinalgScalar>(
x: &Self::Array<T>,
lower: bool,
) -> (Self::Array<T>, Self::Array<T::Real>, Self::Array<T::Real>, Self::Array<T>);
fn tridiagonal_solve<T: LinalgScalar>(
dl: &Self::Array<T>,
d: &Self::Array<T>,
du: &Self::Array<T>,
b: &Self::Array<T>,
perturb_singular: bool,
) -> Self::Array<T>;
fn svd<T: LinalgScalar>(
x: &Self::Array<T>,
full_matrices: bool,
compute_uv: bool,
subset_by_index: Option<(usize, usize)>,
algorithm: Option<SvdAlgorithm>,
) -> (Self::Array<T::Real>, Option<(Self::Array<T>, Self::Array<T>)>);
fn fft<T: Element, U: Element>(
x: &Self::Array<T>,
fft_type: FftType,
fft_lengths: &[usize],
) -> Self::Array<U>;
fn dot_general<T: Element, U: Element>(
l: &Self::Array<T>,
r: &Self::Array<T>,
dims: &DotDims,
precision: Precision,
) -> Self::Array<U>;
fn conv_general_dilated<T: Element, U: Element>(
lhs: &Self::Array<T>,
rhs: &Self::Array<T>,
window: &ConvWindow<'_>,
dims: &ConvDims,
groups: (usize, usize),
precision: Precision,
) -> Self::Array<U>;
fn reduce_window<T: Element>(
op: ReduceOp,
x: &Self::Array<T>,
window: &Window<'_>,
) -> Self::Array<T>;
fn select_and_scatter_add<T: Element>(
source: &Self::Array<T>,
operand: &Self::Array<T>,
select_prim: SelectPrim,
window: &Window<'_>,
) -> Self::Array<T>;
fn select_and_gather_add<T: Element>(
tangents: &Self::Array<T>,
operand: &Self::Array<T>,
select_prim: SelectPrim,
window: &Window<'_>,
) -> Self::Array<T>;
fn gather<T: Element, I: Element>(
x: &Self::Array<T>,
indices: &Self::Array<I>,
dims: &GatherDims,
sizes: &[usize],
mode: GatherScatterMode,
sorted_unique: bool,
) -> Self::Array<T>;
fn scatter<T: Element, I: Element>(
combine: Option<BinaryOp>,
x: &Self::Array<T>,
indices: &Self::Array<I>,
updates: &Self::Array<T>,
dims: &ScatterDims,
mode: GatherScatterMode,
sorted_unique: bool,
) -> Self::Array<T>;
fn cond<S: Tree<Self>, R: Tree<Self>>(
index: I32<Self>,
branches: &[&dyn Fn(S) -> R],
operand: S,
) -> R;
fn while_loop<C: Tree<Self>>(
cond: &dyn Fn(&C) -> Bool<Self>,
body: &dyn Fn(C) -> C,
init: C,
) -> C;
fn scan<C: Tree<Self>, X: Tree<Self>, Y: Tree<Self>>(
f: &dyn Fn(C, X) -> (C, Y),
init: C,
xs: X,
length: usize,
reverse: bool,
) -> (C, Y);
fn fori_loop<C: Tree<Self>>(
lo: I32<Self>,
hi: I32<Self>,
body: &dyn Fn(I32<Self>, C) -> C,
init: C,
) -> C;
fn scalar_leaf<T: Element>(x: Self::Scalar<T>) -> Self::Leaf;
fn leaf_scalar<T: Element>(l: Self::Leaf) -> Self::Scalar<T>;
fn array_leaf<T: Element>(x: &Self::Array<T>) -> Self::Leaf;
fn leaf_array<T: Element>(l: Self::Leaf) -> Self::Array<T>;
fn leaf_aval(l: &Self::Leaf) -> AVal;
fn host_callback(
callback: &HostCallback,
args: &[Self::Leaf],
outputs: &[AVal],
) -> Vec<Self::Leaf>;
// Provided methods
fn custom_jvp<I: Tree<Self>, O: Tree<Self>>(
f: &dyn Fn(I) -> O,
jvp: &dyn Fn(I, I) -> (O, O),
primals: I,
) -> O { ... }
fn custom_vjp<I: Tree<Self>, O: Tree<Self>, R: Tree<Self>>(
f: &dyn Fn(I) -> O,
fwd: &dyn Fn(I) -> (O, R),
bwd: &dyn Fn(R, O) -> I,
primals: I,
) -> O { ... }
fn checkpoint<I: Tree<Self>, O: Tree<Self>>(
f: &dyn Fn(I) -> O,
input: I,
) -> O { ... }
}Expand description
Required Associated Types§
Required Methods§
Sourcefn binary<T: Element>(
op: BinaryOp,
x: Self::Scalar<T>,
y: Self::Scalar<T>,
) -> Self::Scalar<T>
fn binary<T: Element>( op: BinaryOp, x: Self::Scalar<T>, y: Self::Scalar<T>, ) -> Self::Scalar<T>
A binary operation.
Sourcefn compare<T: Element>(
op: CompareOp,
x: Self::Scalar<T>,
y: Self::Scalar<T>,
) -> Self::Scalar<bool>
fn compare<T: Element>( op: CompareOp, x: Self::Scalar<T>, y: Self::Scalar<T>, ) -> Self::Scalar<bool>
A comparison.
Sourcefn is_finite<T: Element>(x: Self::Scalar<T>) -> Self::Scalar<bool>
fn is_finite<T: Element>(x: Self::Scalar<T>) -> Self::Scalar<bool>
Whether the value is finite.
Sourcefn integer_pow<T: Element>(x: Self::Scalar<T>, y: i32) -> Self::Scalar<T>
fn integer_pow<T: Element>(x: Self::Scalar<T>, y: i32) -> Self::Scalar<T>
x^y for a static integer y.
Sourcefn select<T: Element>(
c: Self::Scalar<bool>,
t: Self::Scalar<T>,
f: Self::Scalar<T>,
) -> Self::Scalar<T>
fn select<T: Element>( c: Self::Scalar<bool>, t: Self::Scalar<T>, f: Self::Scalar<T>, ) -> Self::Scalar<T>
if c { t } else { f }.
Sourcefn cast<T: Element, U: Element>(x: Self::Scalar<T>) -> Self::Scalar<U>
fn cast<T: Element, U: Element>(x: Self::Scalar<T>) -> Self::Scalar<U>
Conversion to another element type.
Sourcefn bitcast<T: Element, U: Element>(x: Self::Scalar<T>) -> Self::Scalar<U>
fn bitcast<T: Element, U: Element>(x: Self::Scalar<T>) -> Self::Scalar<U>
Reinterpretation of the bits as another type of the same size.
Sourcefn to_real<T: Element>(op: ToReal, x: Self::Scalar<T>) -> Self::Scalar<T::Real>
fn to_real<T: Element>(op: ToReal, x: Self::Scalar<T>) -> Self::Scalar<T::Real>
abs, real, or imag (real and imag of complex numbers).
Sourcefn complex<C: Element>(
re: Self::Scalar<C::Real>,
im: Self::Scalar<C::Real>,
) -> Self::Scalar<C>
fn complex<C: Element>( re: Self::Scalar<C::Real>, im: Self::Scalar<C::Real>, ) -> Self::Scalar<C>
A complex number from its parts (lax.complex).
Sourcefn conj<T: Element>(x: Self::Scalar<T>) -> Self::Scalar<T>
fn conj<T: Element>(x: Self::Scalar<T>) -> Self::Scalar<T>
The complex conjugate of a complex number.
Sourcefn constant<T: Element>(x: &NativeArray<T>) -> Self::Array<T>
fn constant<T: Element>(x: &NativeArray<T>) -> Self::Array<T>
A constant array.
Sourcefn to_scalar<T: Element>(x: &Self::Array<T>) -> Self::Scalar<T>
fn to_scalar<T: Element>(x: &Self::Array<T>) -> Self::Scalar<T>
An array of rank 0 as a scalar.
Sourcefn a_unary<T: Element>(op: UnaryOp, x: &Self::Array<T>) -> Self::Array<T>
fn a_unary<T: Element>(op: UnaryOp, x: &Self::Array<T>) -> Self::Array<T>
Elementwise unary operation.
Sourcefn a_binary<T: Element>(
op: BinaryOp,
x: &Self::Array<T>,
y: &Self::Array<T>,
) -> Self::Array<T>
fn a_binary<T: Element>( op: BinaryOp, x: &Self::Array<T>, y: &Self::Array<T>, ) -> Self::Array<T>
Elementwise binary operation on arrays of the same shape.
Sourcefn a_ternary<T: Element>(
op: TernaryOp,
x: &Self::Array<T>,
y: &Self::Array<T>,
z: &Self::Array<T>,
) -> Self::Array<T>
fn a_ternary<T: Element>( op: TernaryOp, x: &Self::Array<T>, y: &Self::Array<T>, z: &Self::Array<T>, ) -> Self::Array<T>
Elementwise ternary operation on arrays of the same shape.
Sourcefn a_compare<T: Element>(
op: CompareOp,
x: &Self::Array<T>,
y: &Self::Array<T>,
) -> Self::Array<bool>
fn a_compare<T: Element>( op: CompareOp, x: &Self::Array<T>, y: &Self::Array<T>, ) -> Self::Array<bool>
Elementwise comparison of arrays of the same shape.
Sourcefn a_integer_pow<T: Element>(x: &Self::Array<T>, y: i32) -> Self::Array<T>
fn a_integer_pow<T: Element>(x: &Self::Array<T>, y: i32) -> Self::Array<T>
Elementwise integer_pow.
Sourcefn a_cast<T: Element, U: Element>(x: &Self::Array<T>) -> Self::Array<U>
fn a_cast<T: Element, U: Element>(x: &Self::Array<T>) -> Self::Array<U>
Elementwise conversion.
Sourcefn a_bitcast<T: Element, U: Element>(x: &Self::Array<T>) -> Self::Array<U>
fn a_bitcast<T: Element, U: Element>(x: &Self::Array<T>) -> Self::Array<U>
Elementwise bit reinterpretation.
Sourcefn a_to_real<T: Element>(op: ToReal, x: &Self::Array<T>) -> Self::Array<T::Real>
fn a_to_real<T: Element>(op: ToReal, x: &Self::Array<T>) -> Self::Array<T::Real>
Elementwise abs, real, or imag.
Sourcefn a_complex<C: Element>(
re: &Self::Array<C::Real>,
im: &Self::Array<C::Real>,
) -> Self::Array<C>
fn a_complex<C: Element>( re: &Self::Array<C::Real>, im: &Self::Array<C::Real>, ) -> Self::Array<C>
Elementwise complex of arrays of the same shape.
Sourcefn a_select<T: Element>(
c: &Self::Array<bool>,
t: &Self::Array<T>,
f: &Self::Array<T>,
) -> Self::Array<T>
fn a_select<T: Element>( c: &Self::Array<bool>, t: &Self::Array<T>, f: &Self::Array<T>, ) -> Self::Array<T>
select_n(c, f, t): c is a scalar or has the shape of the cases.
Sourcefn a_clamp<T: Element>(
lo: &Self::Array<T>,
x: &Self::Array<T>,
hi: &Self::Array<T>,
) -> Self::Array<T>
fn a_clamp<T: Element>( lo: &Self::Array<T>, x: &Self::Array<T>, hi: &Self::Array<T>, ) -> Self::Array<T>
clamp(lo, x, hi): bounds are scalars or have the shape of x.
Sourcefn broadcast_in_dim<T: Element>(
x: &Self::Array<T>,
shape: &[usize],
dims: &[usize],
) -> Self::Array<T>
fn broadcast_in_dim<T: Element>( x: &Self::Array<T>, shape: &[usize], dims: &[usize], ) -> Self::Array<T>
broadcast_in_dim.
Sourcefn slice<T: Element>(
x: &Self::Array<T>,
start: &[usize],
limit: &[usize],
strides: &[usize],
) -> Self::Array<T>
fn slice<T: Element>( x: &Self::Array<T>, start: &[usize], limit: &[usize], strides: &[usize], ) -> Self::Array<T>
slice.
Sourcefn dynamic_slice<T: Element, I: Element>(
x: &Self::Array<T>,
starts: &[Self::Scalar<I>],
sizes: &[usize],
) -> Self::Array<T>
fn dynamic_slice<T: Element, I: Element>( x: &Self::Array<T>, starts: &[Self::Scalar<I>], sizes: &[usize], ) -> Self::Array<T>
dynamic_slice (start indices are clamped).
Sourcefn dynamic_update_slice<T: Element, I: Element>(
x: &Self::Array<T>,
update: &Self::Array<T>,
starts: &[Self::Scalar<I>],
) -> Self::Array<T>
fn dynamic_update_slice<T: Element, I: Element>( x: &Self::Array<T>, update: &Self::Array<T>, starts: &[Self::Scalar<I>], ) -> Self::Array<T>
dynamic_update_slice (start indices are clamped).
Sourcefn pad<T: Element>(
x: &Self::Array<T>,
value: Self::Scalar<T>,
config: &[(i64, i64, usize)],
) -> Self::Array<T>
fn pad<T: Element>( x: &Self::Array<T>, value: Self::Scalar<T>, config: &[(i64, i64, usize)], ) -> Self::Array<T>
pad.
Sourcefn reduce<T: Element>(
op: ReduceOp,
x: &Self::Array<T>,
axes: &[usize],
) -> Self::Array<T>
fn reduce<T: Element>( op: ReduceOp, x: &Self::Array<T>, axes: &[usize], ) -> Self::Array<T>
A reduction over axes.
Sourcefn arg_min_max<T: Element, I: Element>(
x: &Self::Array<T>,
axis: usize,
max: bool,
) -> Self::Array<I>
fn arg_min_max<T: Element, I: Element>( x: &Self::Array<T>, axis: usize, max: bool, ) -> Self::Array<I>
argmax or argmin.
Sourcefn sort(
operands: &[Self::Leaf],
dimension: usize,
is_stable: bool,
num_keys: usize,
) -> Vec<Self::Leaf>
fn sort( operands: &[Self::Leaf], dimension: usize, is_stable: bool, num_keys: usize, ) -> Vec<Self::Leaf>
sort of operands of the same shape (of any element types) along
dimension, lexicographically by the first num_keys of them.
Sourcefn cumulative<T: Element>(
op: CumulativeOp,
x: &Self::Array<T>,
axis: usize,
reverse: bool,
) -> Self::Array<T>
fn cumulative<T: Element>( op: CumulativeOp, x: &Self::Array<T>, axis: usize, reverse: bool, ) -> Self::Array<T>
A cumulative reduction along axis (cumsum and the like), from
the end with reverse.
Sourcefn top_k<T: Element>(
x: &Self::Array<T>,
k: usize,
axis: usize,
) -> (Self::Array<T>, Self::Array<i32>)
fn top_k<T: Element>( x: &Self::Array<T>, k: usize, axis: usize, ) -> (Self::Array<T>, Self::Array<i32>)
top_k along axis: the k largest elements in descending order,
and their indices.
Sourcefn cholesky<T: LinalgScalar>(x: &Self::Array<T>) -> Self::Array<T>
fn cholesky<T: LinalgScalar>(x: &Self::Array<T>) -> Self::Array<T>
cholesky of a batch of matrices (see lax::linalg::cholesky).
Sourcefn triangular_solve<T: LinalgScalar>(
a: &Self::Array<T>,
b: &Self::Array<T>,
options: TriangularSolveOptions,
) -> Self::Array<T>
fn triangular_solve<T: LinalgScalar>( a: &Self::Array<T>, b: &Self::Array<T>, options: TriangularSolveOptions, ) -> Self::Array<T>
triangular_solve of batches of matrices.
Sourcefn lu<T: LinalgScalar>(
x: &Self::Array<T>,
) -> (Self::Array<T>, Self::Array<i32>, Self::Array<i32>)
fn lu<T: LinalgScalar>( x: &Self::Array<T>, ) -> (Self::Array<T>, Self::Array<i32>, Self::Array<i32>)
lu of a batch of matrices: the factors, the pivots, and the
permutation.
Sourcefn lu_pivots_to_permutation(
pivots: &Self::Array<i32>,
size: usize,
) -> Self::Array<i32>
fn lu_pivots_to_permutation( pivots: &Self::Array<i32>, size: usize, ) -> Self::Array<i32>
lu_pivots_to_permutation.
Sourcefn qr<T: LinalgScalar>(
x: &Self::Array<T>,
full_matrices: bool,
) -> (Self::Array<T>, Self::Array<T>)
fn qr<T: LinalgScalar>( x: &Self::Array<T>, full_matrices: bool, ) -> (Self::Array<T>, Self::Array<T>)
qr of a batch of matrices: q and r.
Sourcefn qr_pivoting<T: LinalgScalar>(
x: &Self::Array<T>,
full_matrices: bool,
) -> (Self::Array<T>, Self::Array<T>, Self::Array<i32>)
fn qr_pivoting<T: LinalgScalar>( x: &Self::Array<T>, full_matrices: bool, ) -> (Self::Array<T>, Self::Array<T>, Self::Array<i32>)
qr with column pivoting of a batch of matrices: q, r, and the
permutation.
Sourcefn eigh<T: LinalgScalar>(
x: &Self::Array<T>,
lower: bool,
sort_eigenvalues: bool,
subset_by_index: Option<(usize, usize)>,
algorithm: Option<EighImplementation>,
) -> (Self::Array<T>, Self::Array<T::Real>)
fn eigh<T: LinalgScalar>( x: &Self::Array<T>, lower: bool, sort_eigenvalues: bool, subset_by_index: Option<(usize, usize)>, algorithm: Option<EighImplementation>, ) -> (Self::Array<T>, Self::Array<T::Real>)
eigh of a batch of symmetric matrices: the eigenvectors and the
eigenvalues (of the range subset_by_index of indices, if given).
Sourcefn eig<T: LinalgScalar>(
x: &Self::Array<T>,
left: bool,
right: bool,
enable_eigvec_derivs: bool,
) -> (Self::Array<<T as LinalgScalar>::Complex>, Option<Self::Array<<T as LinalgScalar>::Complex>>, Option<Self::Array<<T as LinalgScalar>::Complex>>)
fn eig<T: LinalgScalar>( x: &Self::Array<T>, left: bool, right: bool, enable_eigvec_derivs: bool, ) -> (Self::Array<<T as LinalgScalar>::Complex>, Option<Self::Array<<T as LinalgScalar>::Complex>>, Option<Self::Array<<T as LinalgScalar>::Complex>>)
eig of a batch of general matrices: the complex eigenvalues, and
the left and right eigenvectors that are requested.
Sourcefn schur<T: LinalgScalar>(
x: &Self::Array<T>,
compute_schur_vectors: bool,
) -> (Self::Array<T>, Option<Self::Array<T>>)
fn schur<T: LinalgScalar>( x: &Self::Array<T>, compute_schur_vectors: bool, ) -> (Self::Array<T>, Option<Self::Array<T>>)
schur of a batch of square matrices: t and, with
compute_schur_vectors, z.
Sourcefn hessenberg<T: LinalgScalar>(
x: &Self::Array<T>,
) -> (Self::Array<T>, Self::Array<T>)
fn hessenberg<T: LinalgScalar>( x: &Self::Array<T>, ) -> (Self::Array<T>, Self::Array<T>)
hessenberg of a batch of square matrices: the reduced matrices and
the factors of the reflectors.
Sourcefn householder_product<T: LinalgScalar>(
a: &Self::Array<T>,
taus: &Self::Array<T>,
) -> Self::Array<T>
fn householder_product<T: LinalgScalar>( a: &Self::Array<T>, taus: &Self::Array<T>, ) -> Self::Array<T>
householder_product of reflectors and their factors.
Sourcefn ormqr<T: LinalgScalar>(
a: &Self::Array<T>,
taus: &Self::Array<T>,
c: &Self::Array<T>,
left: bool,
transpose: bool,
) -> Self::Array<T>
fn ormqr<T: LinalgScalar>( a: &Self::Array<T>, taus: &Self::Array<T>, c: &Self::Array<T>, left: bool, transpose: bool, ) -> Self::Array<T>
ormqr: c times Q (or Q^H) of the reflectors.
Sourcefn cholesky_update<T: LinalgFloat>(
r: &Self::Array<T>,
w: &Self::Array<T>,
) -> Self::Array<T>
fn cholesky_update<T: LinalgFloat>( r: &Self::Array<T>, w: &Self::Array<T>, ) -> Self::Array<T>
cholesky_update: the rank-1 update by w of the upper triangular
Cholesky factors r.
Sourcefn symmetric_product<T: LinalgFloat>(
a: &Self::Array<T>,
c: &Self::Array<T>,
alpha: f64,
beta: f64,
) -> Self::Array<T>
fn symmetric_product<T: LinalgFloat>( a: &Self::Array<T>, c: &Self::Array<T>, alpha: f64, beta: f64, ) -> Self::Array<T>
symmetric_product: alpha a a^T + beta c.
Sourcefn tridiagonal<T: LinalgScalar>(
x: &Self::Array<T>,
lower: bool,
) -> (Self::Array<T>, Self::Array<T::Real>, Self::Array<T::Real>, Self::Array<T>)
fn tridiagonal<T: LinalgScalar>( x: &Self::Array<T>, lower: bool, ) -> (Self::Array<T>, Self::Array<T::Real>, Self::Array<T::Real>, Self::Array<T>)
tridiagonal of a batch of Hermitian matrices: the reduced matrices,
the real diagonals and off-diagonals, and the factors of the
reflectors.
Sourcefn tridiagonal_solve<T: LinalgScalar>(
dl: &Self::Array<T>,
d: &Self::Array<T>,
du: &Self::Array<T>,
b: &Self::Array<T>,
perturb_singular: bool,
) -> Self::Array<T>
fn tridiagonal_solve<T: LinalgScalar>( dl: &Self::Array<T>, d: &Self::Array<T>, du: &Self::Array<T>, b: &Self::Array<T>, perturb_singular: bool, ) -> Self::Array<T>
tridiagonal_solve: the solution of the tridiagonal systems of the
diagonals dl, d, and du ([..., m]) with the right-hand sides
b ([..., m, n]).
Sourcefn svd<T: LinalgScalar>(
x: &Self::Array<T>,
full_matrices: bool,
compute_uv: bool,
subset_by_index: Option<(usize, usize)>,
algorithm: Option<SvdAlgorithm>,
) -> (Self::Array<T::Real>, Option<(Self::Array<T>, Self::Array<T>)>)
fn svd<T: LinalgScalar>( x: &Self::Array<T>, full_matrices: bool, compute_uv: bool, subset_by_index: Option<(usize, usize)>, algorithm: Option<SvdAlgorithm>, ) -> (Self::Array<T::Real>, Option<(Self::Array<T>, Self::Array<T>)>)
svd of a batch of matrices: the singular values, and u and vt
with compute_uv (of the range subset_by_index of indices, if
given).
Sourcefn fft<T: Element, U: Element>(
x: &Self::Array<T>,
fft_type: FftType,
fft_lengths: &[usize],
) -> Self::Array<U>
fn fft<T: Element, U: Element>( x: &Self::Array<T>, fft_type: FftType, fft_lengths: &[usize], ) -> Self::Array<U>
fft of the trailing axes, from T to U (complex to complex,
real to complex, or complex to real).
Sourcefn dot_general<T: Element, U: Element>(
l: &Self::Array<T>,
r: &Self::Array<T>,
dims: &DotDims,
precision: Precision,
) -> Self::Array<U>
fn dot_general<T: Element, U: Element>( l: &Self::Array<T>, r: &Self::Array<T>, dims: &DotDims, precision: Precision, ) -> Self::Array<U>
dot_general, computing in U (the operand type unless a preferred
type is given).
Sourcefn conv_general_dilated<T: Element, U: Element>(
lhs: &Self::Array<T>,
rhs: &Self::Array<T>,
window: &ConvWindow<'_>,
dims: &ConvDims,
groups: (usize, usize),
precision: Precision,
) -> Self::Array<U>
fn conv_general_dilated<T: Element, U: Element>( lhs: &Self::Array<T>, rhs: &Self::Array<T>, window: &ConvWindow<'_>, dims: &ConvDims, groups: (usize, usize), precision: Precision, ) -> Self::Array<U>
conv_general_dilated with (feature_group_count, batch_group_count) groups, computing in U (the operand type unless
a preferred type is given).
Sourcefn reduce_window<T: Element>(
op: ReduceOp,
x: &Self::Array<T>,
window: &Window<'_>,
) -> Self::Array<T>
fn reduce_window<T: Element>( op: ReduceOp, x: &Self::Array<T>, window: &Window<'_>, ) -> Self::Array<T>
reduce_window_sum, reduce_window_max, or reduce_window_min.
Sourcefn select_and_scatter_add<T: Element>(
source: &Self::Array<T>,
operand: &Self::Array<T>,
select_prim: SelectPrim,
window: &Window<'_>,
) -> Self::Array<T>
fn select_and_scatter_add<T: Element>( source: &Self::Array<T>, operand: &Self::Array<T>, select_prim: SelectPrim, window: &Window<'_>, ) -> Self::Array<T>
select_and_scatter_add (the window’s dilations must be 1).
Sourcefn select_and_gather_add<T: Element>(
tangents: &Self::Array<T>,
operand: &Self::Array<T>,
select_prim: SelectPrim,
window: &Window<'_>,
) -> Self::Array<T>
fn select_and_gather_add<T: Element>( tangents: &Self::Array<T>, operand: &Self::Array<T>, select_prim: SelectPrim, window: &Window<'_>, ) -> Self::Array<T>
select_and_gather_add.
Sourcefn gather<T: Element, I: Element>(
x: &Self::Array<T>,
indices: &Self::Array<I>,
dims: &GatherDims,
sizes: &[usize],
mode: GatherScatterMode,
sorted_unique: bool,
) -> Self::Array<T>
fn gather<T: Element, I: Element>( x: &Self::Array<T>, indices: &Self::Array<I>, dims: &GatherDims, sizes: &[usize], mode: GatherScatterMode, sorted_unique: bool, ) -> Self::Array<T>
gather.
Sourcefn scatter<T: Element, I: Element>(
combine: Option<BinaryOp>,
x: &Self::Array<T>,
indices: &Self::Array<I>,
updates: &Self::Array<T>,
dims: &ScatterDims,
mode: GatherScatterMode,
sorted_unique: bool,
) -> Self::Array<T>
fn scatter<T: Element, I: Element>( combine: Option<BinaryOp>, x: &Self::Array<T>, indices: &Self::Array<I>, updates: &Self::Array<T>, dims: &ScatterDims, mode: GatherScatterMode, sorted_unique: bool, ) -> Self::Array<T>
A scatter: replaces (combine is None) or combines updates.
Sourcefn cond<S: Tree<Self>, R: Tree<Self>>(
index: I32<Self>,
branches: &[&dyn Fn(S) -> R],
operand: S,
) -> R
fn cond<S: Tree<Self>, R: Tree<Self>>( index: I32<Self>, branches: &[&dyn Fn(S) -> R], operand: S, ) -> R
Calls branches[index] on operand; an index out of range calls the
last branch, as stablehlo.case does.
Sourcefn while_loop<C: Tree<Self>>(
cond: &dyn Fn(&C) -> Bool<Self>,
body: &dyn Fn(C) -> C,
init: C,
) -> C
fn while_loop<C: Tree<Self>>( cond: &dyn Fn(&C) -> Bool<Self>, body: &dyn Fn(C) -> C, init: C, ) -> C
Repeats body while cond holds.
Sourcefn scan<C: Tree<Self>, X: Tree<Self>, Y: Tree<Self>>(
f: &dyn Fn(C, X) -> (C, Y),
init: C,
xs: X,
length: usize,
reverse: bool,
) -> (C, Y)
fn scan<C: Tree<Self>, X: Tree<Self>, Y: Tree<Self>>( f: &dyn Fn(C, X) -> (C, Y), init: C, xs: X, length: usize, reverse: bool, ) -> (C, Y)
A loop over the leading dimension of the arrays of xs.
Sourcefn fori_loop<C: Tree<Self>>(
lo: I32<Self>,
hi: I32<Self>,
body: &dyn Fn(I32<Self>, C) -> C,
init: C,
) -> C
fn fori_loop<C: Tree<Self>>( lo: I32<Self>, hi: I32<Self>, body: &dyn Fn(I32<Self>, C) -> C, init: C, ) -> C
for i in lo..hi { state = body(i, state) }.
Sourcefn scalar_leaf<T: Element>(x: Self::Scalar<T>) -> Self::Leaf
fn scalar_leaf<T: Element>(x: Self::Scalar<T>) -> Self::Leaf
A scalar as a pytree leaf.
Sourcefn leaf_scalar<T: Element>(l: Self::Leaf) -> Self::Scalar<T>
fn leaf_scalar<T: Element>(l: Self::Leaf) -> Self::Scalar<T>
A pytree leaf as a scalar.
Sourcefn array_leaf<T: Element>(x: &Self::Array<T>) -> Self::Leaf
fn array_leaf<T: Element>(x: &Self::Array<T>) -> Self::Leaf
An array as a pytree leaf.
Sourcefn leaf_array<T: Element>(l: Self::Leaf) -> Self::Array<T>
fn leaf_array<T: Element>(l: Self::Leaf) -> Self::Array<T>
A pytree leaf as an array.
Sourcefn host_callback(
callback: &HostCallback,
args: &[Self::Leaf],
outputs: &[AVal],
) -> Vec<Self::Leaf>
fn host_callback( callback: &HostCallback, args: &[Self::Leaf], outputs: &[AVal], ) -> Vec<Self::Leaf>
host_callback: callback on the leaves args, whose results have
the types outputs.
Provided Methods§
Sourcefn custom_jvp<I: Tree<Self>, O: Tree<Self>>(
f: &dyn Fn(I) -> O,
jvp: &dyn Fn(I, I) -> (O, O),
primals: I,
) -> O
fn custom_jvp<I: Tree<Self>, O: Tree<Self>>( f: &dyn Fn(I) -> O, jvp: &dyn Fn(I, I) -> (O, O), primals: I, ) -> O
f(primals), differentiated with the rule jvp (see
lax::custom_jvp).
Sourcefn custom_vjp<I: Tree<Self>, O: Tree<Self>, R: Tree<Self>>(
f: &dyn Fn(I) -> O,
fwd: &dyn Fn(I) -> (O, R),
bwd: &dyn Fn(R, O) -> I,
primals: I,
) -> O
fn custom_vjp<I: Tree<Self>, O: Tree<Self>, R: Tree<Self>>( f: &dyn Fn(I) -> O, fwd: &dyn Fn(I) -> (O, R), bwd: &dyn Fn(R, O) -> I, primals: I, ) -> O
f(primals), differentiated in reverse mode with the rules fwd and
bwd (see lax::custom_vjp).
Sourcefn checkpoint<I: Tree<Self>, O: Tree<Self>>(f: &dyn Fn(I) -> O, input: I) -> O
fn checkpoint<I: Tree<Self>, O: Tree<Self>>(f: &dyn Fn(I) -> O, input: I) -> O
f(input), whose intermediate values reverse mode recomputes (see
lax::checkpoint).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".