Trait diffsol::op::NonLinearOp
source · pub trait NonLinearOp: Op {
Show 13 methods
// Required methods
fn call_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::V);
fn jac_mul_inplace(
&self,
x: &Self::V,
t: Self::T,
v: &Self::V,
y: &mut Self::V
);
// Provided methods
fn sens_mul_inplace(
&self,
_x: &Self::V,
_t: Self::T,
_v: &Self::V,
y: &mut Self::V
) { ... }
fn has_sens(&self) -> bool { ... }
fn call(&self, x: &Self::V, t: Self::T) -> Self::V { ... }
fn jac_mul(&self, x: &Self::V, t: Self::T, v: &Self::V) -> Self::V { ... }
fn sens_mul(&self, x: &Self::V, t: Self::T, v: &Self::V) -> Self::V { ... }
fn jacobian_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M) { ... }
fn _default_jacobian_inplace(
&self,
x: &Self::V,
t: Self::T,
y: &mut Self::M
) { ... }
fn jacobian(&self, x: &Self::V, t: Self::T) -> Self::M { ... }
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 { ... }
}
Required Methods§
sourcefn call_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::V)
fn call_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::V)
Compute the operator F(x, t)
at a given state and time.
Provided Methods§
sourcefn sens_mul_inplace(
&self,
_x: &Self::V,
_t: Self::T,
_v: &Self::V,
y: &mut Self::V
)
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(x, t) * 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.
fn has_sens(&self) -> bool
sourcefn call(&self, x: &Self::V, t: Self::T) -> Self::V
fn call(&self, x: &Self::V, t: Self::T) -> Self::V
Compute the operator F(x, t)
at a given state and time, and return the result.
Use [Self::call_inplace]
to for a non-allocating version.
sourcefn jac_mul(&self, x: &Self::V, t: Self::T, v: &Self::V) -> Self::V
fn jac_mul(&self, x: &Self::V, t: Self::T, v: &Self::V) -> Self::V
Compute the product of the Jacobian with a given vector J(x, t) * v
, and return the result.
Use [Self::jac_mul_inplace]
to for a non-allocating version.
sourcefn sens_mul(&self, x: &Self::V, t: Self::T, v: &Self::V) -> Self::V
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.
sourcefn jacobian_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M)
fn jacobian_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M)
Compute the Jacobian matrix J(x, t)
of the operator and store it in the matrix y
.
y
should have been previously initialised using the output of Op::sparsity
.
The default implementation of this method computes the Jacobian using Self::jac_mul_inplace,
but it can be overriden for more efficient implementations.
sourcefn _default_jacobian_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M)
fn _default_jacobian_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M)
Default implementation of the Jacobian computation (this is the default for Self::jacobian_inplace).
sourcefn jacobian(&self, x: &Self::V, t: Self::T) -> Self::M
fn jacobian(&self, x: &Self::V, t: Self::T) -> Self::M
Compute the Jacobian matrix J(x, t)
of the operator and return it.
See Self::jacobian_inplace for a non-allocating version.
sourcefn sens_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::M)
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 Op::sparsity
.
The default implementation of this method computes the gradient using Self::sens_mul_inplace,
but it can be overriden for more efficient implementations.
sourcefn _default_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)
Default implementation of the gradient computation (this is the default for Self::sens_inplace).