cottax.core.maths.kinds module¶
Node kinds: functional and conditional.
- check_owns_something(d: NodeDefinition)[source]¶
Check a node owns something: a computation’s rule, which a condition node does not add.
O_n ≠ ∅ ∀ n ∊ N_F
- Return type:
Iterator[Violation]
- class FunctionalNode[V: Place][source]¶
Bases:
NodeDefinition[V],Generic[V]A computation: reads in, owns out. Only checked it produces something (beyond the base NodeDefinition checks)
- class Function[V: Place](reads: tuple[V, ...], owns: tuple[V, ...])[source]¶
Bases:
FunctionalNode[V],Generic[V]A computation: what it reads and what it owns.
- reads: tuple[V, ...]¶
- owns: tuple[V, ...]¶
- check_states_something(node: ConditionalNode)[source]¶
A condition node determines something or holds against something: one with neither has no edges, and is in no graph’s structure.
U_n ≠ ∅ or C_n ≠ ∅ ∀ n ∊ N_C
- Return type:
Iterator[Violation]
- class ConditionalNode[V: Place][source]¶
Bases:
NodeDefinition[V],Generic[V]A condition node: what it determines and what it holds against. With or without the algorithm answering it.
No shape-matching of the unknowns against the conditions: the shape of the arrays is unknown at this time, and one ‘vector’ unknown against 200 conditions is legitimate. It is a driver’s question anyway – a least-squares driver does not want it forbidden.
- unknowns: AbstractVar[tuple[V, ...]]¶
What this node determines; () for a requirement.
- conditions: AbstractVar[tuple[V, ...]]¶
its reads, less a driver’s data.
- Type:
What it holds against
- checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_states_something>,)¶
Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).
- is_requirement(d: object)[source]¶
A requirement: a condition node that holds against something and determines nothing: n ∊ N_C N_P.
- Return type:
bool
- is_problem(d: object)[source]¶
A problem: a condition node that determines something: n ∊ N_P = {n ∊ N_C : U_n ≠ ∅}.
- Return type:
bool
- problems[N: Label](definitions: Mapping[N, NodeDefinition])[source]¶
The problems among definitions, in the order given.
- Return type:
tuple[N,...]
- requirements[N: Label](definitions: Mapping[N, NodeDefinition])[source]¶
The requirements, in the order given.
- Return type:
tuple[N,...]
- class StatesNothing(node: str)[source]¶
Bases:
Violation- node: str¶
- template: AbstractClassVar[str] = '{node}: an empty condition node -- no unknowns and no conditions, so it is in no structure'¶
e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’
- Type:
Wording
- class OwnsNothing[source]¶
Bases:
Violation- template: AbstractClassVar[str] = 'a functional node must own at least one variable'¶
e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’
- Type:
Wording