This object is returned by ODESolver.solve().
Provides dense output (by being callable), is sliceable, and collects the time-grid as well as the discrete-time solution.
from typing import Optional
import numpy as np
from probnum import _randomvariablelist, filtsmooth, randvars
from probnum.filtsmooth._timeseriesposterior import DenseOutputLocationArgType
from probnum.typing import FloatArgType, IntArgType, ShapeArgType
"""Interface for ODE solutions in ProbNum.
Locations of the time-grid that was used by the ODE solver.
Output of the ODE solver at the locations.
Derivatives of the states at the locations. Optional. Default is None.
Some ODE solvers provide these estimates, others do not.
derivatives: Optional[_randomvariablelist._RandomVariableList] = None,
self.derivatives = (
if derivatives is not None
[docs] def interpolate(
previous_index: Optional[IntArgType] = None,
next_index: Optional[IntArgType] = None,
) -> randvars.RandomVariable:
raise NotImplementedError("Dense output is not implemented.")
def __len__(self) -> int:
"""Number of points in the discrete-time solution."""
def __getitem__(self, idx: int) -> randvars.RandomVariable:
"""Access the :math:`i`th element of the discrete-time solution."""
[docs] def sample(
t: Optional[DenseOutputLocationArgType] = None,
size: Optional[ShapeArgType] = (),
) -> np.ndarray:
"""Sample from the ODE solution.
Random number generator.
Location / time at which to sample.
If nothing is specified, samples at the ODE-solver grid points are computed.
If it is a float, a sample of the ODE-solution at this time point is computed.
Similarly, if it is a list of floats (or an array), samples at the specified grid-points are returned.
This is not the same as computing i.i.d samples at the respective locations.
Number of samples.
raise NotImplementedError("Sampling is not implemented.")
[docs] def transform_base_measure_realizations(
) -> np.ndarray:
"Transforming base measure realizations is not implemented."