Trait LinearOpSens

Source
pub trait LinearOpSens: LinearOp {
    // Required method
    fn sens_mul_inplace(
        &self,
        _x: &Self::V,
        _t: Self::T,
        _v: &Self::V,
        _y: &mut Self::V,
    );

    // Provided methods
    fn sens_mul(&self, x: &Self::V, t: Self::T, v: &Self::V) -> Self::V { ... }
    fn sens_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M) { ... }
    fn _default_sens_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M) { ... }
    fn sens(&self, x: &Self::V, t: Self::T) -> Self::M { ... }
    fn sens_sparsity(&self) -> Option<<Self::M as Matrix>::Sparsity> { ... }
}

Required Methods§

Source

fn sens_mul_inplace( &self, _x: &Self::V, _t: Self::T, _v: &Self::V, _y: &mut Self::V, )

Compute the product of the gradient of F wrt a parameter vector p with a given vector J_p(t) * x * v. Note that the vector v is of size nparams() and the result is of size nstates(). Default implementation returns zero and panics if nparams() is not zero.

Provided Methods§

Source

fn sens_mul(&self, x: &Self::V, t: Self::T, v: &Self::V) -> Self::V

Compute the product of the partial gradient of F wrt a parameter vector p with a given vector \parial F/\partial p(x, t) * v, and return the result. Use [Self::sens_mul_inplace] to for a non-allocating version.

Source

fn sens_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M)

Compute the gradient of the operator wrt a parameter vector p and store it in the matrix y. y should have been previously initialised using the output of Self::sens_sparsity. The default implementation of this method computes the gradient using Self::sens_mul_inplace, but it can be overriden for more efficient implementations.

Source

fn _default_sens_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M)

Default implementation of the gradient computation (this is the default for Self::sens_inplace).

Source

fn sens(&self, x: &Self::V, t: Self::T) -> Self::M

Compute the gradient of the operator wrt a parameter vector p and return it. See Self::sens_inplace for a non-allocating version.

Source

fn sens_sparsity(&self) -> Option<<Self::M as Matrix>::Sparsity>

Implementors§