Open hgrecco opened 4 years ago
In the case of implicitness, it can be introspected from the coefficients, which would let us check that there are no misclassifications or typos in coefficients:
class RungeKutta:
def is_implicit(cls):
"""The method is implicit if any coefficient of A's upper triangle is not 0."""
return np.any(np.triu(cls.A) != 0)
class Multistep:
def is_implicit(cls):
"""The method is implicit if Bn is not 0."""
return cls.Bn != 0
In Multistep
, IMPLICIT
is implemented as a class property.
RungeKutta doesn't have that method, but each of its specializations has a class property (explicit
, implicit
, diagonally_implicit
) which is checked by __init_subclass__
.
+1 on having classification done by inspecting the coefficients.
+1 on adding a is_implicit
classproperty
-1 on having a explicit
, implicit
, diagonally_implicit
, etc property as provides a non homogeneous API in different solvers. I lke the Implicitness (in certain cases set automatically at __init_class__
)
Alternative 1: subclass
and then
and the same for others.
Pros:
Cons:
Alternative 2: enums
(names and members might differ)
In the solver, add the following attributes and classproperties
and the same for others.
Pros:
Cons: