Skip to main content

Module ndarray_support

Module ndarray_support 

Source
Available on crate feature ndarray only.
Expand description

ndarray adapters for echidna’s bytecode tape AD.

Thin wrappers accepting Array1<F> and returning Array1<F> / Array2<F>.

All functions here accept non-contiguous arrays (slices, transposed views, stepped views). Input data is copied element-wise via iter().copied() before being passed to the tape; the previous .as_slice().unwrap() path panicked on any non-C-contiguous layout, which was inconsistent with the faer/nalgebra adapters.

Functions§

grad_ndarray
Record a function and compute its gradient, returning an Array1.
grad_ndarray_val
Record a function, compute value and gradient, returning (value, Array1).
hessian_ndarray
Record and compute the Hessian, returning (value, gradient, hessian).
hvp_ndarray
Compute the Hessian-vector product, returning (gradient, hvp) as Array1.
jacobian_ndarray
Compute the Jacobian of a multi-output function, returning Array2<F>.
sparse_hessian_ndarray
Compute the sparse Hessian, returning (value, gradient, pattern, values).
sparse_jacobian_ndarray
Compute the sparse Jacobian, returning (outputs, pattern, values).
tape_gradient_ndarray
Evaluate gradient on a pre-recorded tape, accepting and returning ndarray types.
tape_hessian_ndarray
Evaluate Hessian on a pre-recorded tape, accepting and returning ndarray types.
tape_hvp_ndarray
Compute the Hessian-vector product on a pre-recorded tape, returning (gradient, hvp).
tape_sparse_hessian_ndarray
Compute the sparse Hessian on a pre-recorded tape.