Skip to content

corrections

Correction models.

Correction ¤

Bases: ABC

Correction model interface.

Source code in probdiffeq/solvers/strategies/components/corrections.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class Correction(abc.ABC):
    """Correction model interface."""

    def __init__(self, ode_order):
        self.ode_order = ode_order

    @abc.abstractmethod
    def init(self, x, /):
        """Initialise the state from the solution."""
        raise NotImplementedError

    @abc.abstractmethod
    def estimate_error(self, ssv, corr, /, vector_field, t):
        """Perform all elements of the correction until the error estimate."""
        raise NotImplementedError

    @abc.abstractmethod
    def complete(self, ssv, corr, /):
        """Complete what has been left out by `estimate_error`."""
        raise NotImplementedError

    @abc.abstractmethod
    def extract(self, ssv, corr, /):
        """Extract the solution from the state."""
        raise NotImplementedError

complete(ssv, corr) ¤

Complete what has been left out by estimate_error.

Source code in probdiffeq/solvers/strategies/components/corrections.py
25
26
27
28
@abc.abstractmethod
def complete(self, ssv, corr, /):
    """Complete what has been left out by `estimate_error`."""
    raise NotImplementedError

estimate_error(ssv, corr, /, vector_field, t) ¤

Perform all elements of the correction until the error estimate.

Source code in probdiffeq/solvers/strategies/components/corrections.py
20
21
22
23
@abc.abstractmethod
def estimate_error(self, ssv, corr, /, vector_field, t):
    """Perform all elements of the correction until the error estimate."""
    raise NotImplementedError

extract(ssv, corr) ¤

Extract the solution from the state.

Source code in probdiffeq/solvers/strategies/components/corrections.py
30
31
32
33
@abc.abstractmethod
def extract(self, ssv, corr, /):
    """Extract the solution from the state."""
    raise NotImplementedError

init(x) ¤

Initialise the state from the solution.

Source code in probdiffeq/solvers/strategies/components/corrections.py
15
16
17
18
@abc.abstractmethod
def init(self, x, /):
    """Initialise the state from the solution."""
    raise NotImplementedError

slr0(cubature_fun=None) -> _ODEConstraintStatistical ¤

Zeroth-order statistical linear regression.

Source code in probdiffeq/solvers/strategies/components/corrections.py
132
133
134
135
136
137
138
139
140
def slr0(cubature_fun=None) -> _ODEConstraintStatistical:
    """Zeroth-order statistical linear regression."""
    cubature_fun = cubature_fun or cubature.third_order_spherical
    linearise_fun = impl.linearise.ode_statistical_1st(cubature_fun)
    return _ODEConstraintStatistical(
        ode_order=1,
        linearise_fun=linearise_fun,
        string_repr=f"<SLR1 with ode_order={1}>",
    )

slr1(cubature_fun=None) -> _ODEConstraintStatistical ¤

First-order statistical linear regression.

Source code in probdiffeq/solvers/strategies/components/corrections.py
143
144
145
146
147
148
149
150
151
def slr1(cubature_fun=None) -> _ODEConstraintStatistical:
    """First-order statistical linear regression."""
    cubature_fun = cubature_fun or cubature.third_order_spherical
    linearise_fun = impl.linearise.ode_statistical_0th(cubature_fun)
    return _ODEConstraintStatistical(
        ode_order=1,
        linearise_fun=linearise_fun,
        string_repr=f"<SLR0 with ode_order={1}>",
    )

ts0(*, ode_order=1) -> _ODEConstraintTaylor ¤

Zeroth-order Taylor linearisation.

Source code in probdiffeq/solvers/strategies/components/corrections.py
114
115
116
117
118
119
120
def ts0(*, ode_order=1) -> _ODEConstraintTaylor:
    """Zeroth-order Taylor linearisation."""
    return _ODEConstraintTaylor(
        ode_order=ode_order,
        linearise_fun=impl.linearise.ode_taylor_0th(ode_order=ode_order),
        string_repr=f"<TS0 with ode_order={ode_order}>",
    )

ts1(*, ode_order=1) -> _ODEConstraintTaylor ¤

First-order Taylor linearisation.

Source code in probdiffeq/solvers/strategies/components/corrections.py
123
124
125
126
127
128
129
def ts1(*, ode_order=1) -> _ODEConstraintTaylor:
    """First-order Taylor linearisation."""
    return _ODEConstraintTaylor(
        ode_order=ode_order,
        linearise_fun=impl.linearise.ode_taylor_1st(ode_order=ode_order),
        string_repr=f"<TS1 with ode_order={ode_order}>",
    )