Periodic Nonuniform Piecewise [module]
Here are the methods of the class splinekit.PeriodicNonuniformPiecewise.
This class validates a list of pieces as being a periodic partition.
- class splinekit.periodic_nonuniform_piecewise.PeriodicNonuniformPiecewise(pieces: List[Piece], *, period: int)
Bases:
objectThe class that maintains a valid periodic partition of a closed-open proper interval of integer diameter with zero as left bound.
Let a Piece object define some arbitrary attribute over a domain made of an interval. Consider now a list of such pieces and assume that their combined intervals make for a partition of the closed-open interval \([0, P),\) where the period \(P\) is a positive integer. An instance of the class
PeriodicNonuniformPiecewisemaintains a database of such pieces and provides a convenience method to access the appropriate piece at any \(x\in{\mathbb{R}}\).
- property pieces: List[Piece]
The list of all pieces associated to this
PeriodicNonuniformPiecewiseinstance, sorted by increasing domain.- Returns:
All pieces as a list.
- Return type:
list of Piece
- property period: int
The period associated to this
PeriodicNonuniformPiecewiseinstance.- Returns:
The period.
- Return type:
int
- class Piece(domain: Interval, item: Any)
Bases:
NamedTupleEach piece of a
PeriodicNonuniformPiecewiseobject is a named tuple made of two fields. The first field is nameddomainand is an Interval object that describes an arbitrary domain over which the piece extends. The second field is nameditemand carries the attributes of the piece—often, a function.
- item: Any
The item of the piece.
- item_at(x: float) Any
Convenience method to access individual pieces.
The pieces are periodized with period
period. Accordingly, the indexxis free to take any real value.- Parameters:
x (float) – Floating-point index of the piece.
- Returns:
The item associated to the piece whose interval contains
x.- Return type:
Any