algebra package¶
Submodules¶
algebra.interval_operations module¶
interval algebra primitives.
- algebra.interval_operations.combine_intervals(int_maker, interval_iterables, combiner_function=<function <lambda>>)[source]¶
The main workhorse for interval algebra. A list of N iterables over intervals is combined according to some prescriptions.
int_maker is a function from (peg1, peg2) to an instance of the desired interval* class (e.g. the constructor “Interval” itself).
interval_iterables is a list of iterables, each consisting of several intervals. Each of the iterables is an “operand” in some arbitrary (set-, i.e. boolean-) prescription to combine them.
With a single iterable as input (N=1), i.e. interval_iterables = [[int1, int2, …]] these are made into a normalized-form list of intervals.
With two iterables as input (N=2), interval_iterables = [[intA1, intA2, …], [intB1, intB2, …]]
one can achieve - setA U setB (default) - setA - setB - setA ^ setB depending on the passed combiner_function.
combiner_function is a function from a tuple of N booleans to a single boolean: it specifies whether a point or an open interval will be in the result according to whether it was contained in each of the N inputs: - (q0, q1) => q0 or q1 # for union - (q0, q1) => q0 and (not q1) # for set difference - (q0, q1) => q0 xor q1 # for ‘^’
N > 2 will presumably never be used.
algebra.symbols module¶
Defines symbols for extension to +/- infinity and related methods.
- algebra.symbols.x_from_dict(input_dict, v_decoder)[source]¶
Extract a extended value from a dictionary item, leveraging the passed decoder.
- algebra.symbols.x_subtract(val1, val2, subtracter)[source]¶
Evaluate the difference val1 - val2. Will raise an error if indeterminate forms arise.
Module contents¶
Interval algebra primitives are imported from this module.