Trait IsDualVector

Source
pub trait IsDualVector<S, const ROWS: usize, const BATCH: usize, const DM: usize, const DN: usize>: IsVector<S, ROWS, BATCH, DM, DN>
where S: IsDualScalar<BATCH, DM, DN>,
{ // Required methods fn var(val: <S as IsScalar<BATCH, DM, DN>>::RealVector<ROWS>) -> Self; fn derivative( &self, ) -> VectorValuedDerivative<<S as IsScalar<BATCH, DM, DN>>::RealScalar, ROWS, BATCH, DM, DN>; }
Expand description

A trait for a dual vector, supporting forward-mode AD on vector quantities.

A dual vector is a vector whose entries are themselves dual scalars (with partial derivatives). This trait extends IsVector with AD-specific methods:

  • Constructing a “variable” vector from a real vector (marking it for differentiation).
  • Retrieving the entire derivative as a VectorValuedDerivative.

§Generic Parameters

  • S: A type implementing IsDualScalar.
  • ROWS: Number of entries in the vector.
  • BATCH, DM, DN: Additional parameters for batch usage and the derivative shape.

Required Methods§

Source

fn var(val: <S as IsScalar<BATCH, DM, DN>>::RealVector<ROWS>) -> Self

Creates a new dual vector from a purely real vector, marking its entries as variables for auto-differentiation.

Source

fn derivative( &self, ) -> VectorValuedDerivative<<S as IsScalar<BATCH, DM, DN>>::RealScalar, ROWS, BATCH, DM, DN>

Returns the derivative as a VectorValuedDerivative.

If the vector has dimension ROWS, each element’s derivative is a matrix of shape [DM × DN], so the overall derivative is [ROWS] of those matrices.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<const ROWS: usize, const DM: usize, const DN: usize> IsDualVector<DualScalar<DM, DN>, ROWS, 1, DM, DN> for DualVector<ROWS, DM, DN>