algebra
Algebraic interfaces and helpers used by Finch operators.
SingletonOperatorFType
Bases: ImmutableStructFType, FinchOperatorFType
A stateless callable type with one canonical operator value.
Source code in src/finch/algebra/algebra.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
cansplitpush(op)
Whether a reduction can split-push through the same operator expression.
Source code in src/finch/algebra/algebra.py
198 199 200 | |
fixpoint_type(op, z, t)
Determines the fixpoint type after repeated calling the given operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
op
|
CallableFType
|
The operation to evaluate. |
required |
z
|
Any
|
The initial value. |
required |
t
|
FType
|
The type to evaluate against. |
required |
Returns:
| Type | Description |
|---|---|
FType
|
The fixpoint type. |
Source code in src/finch/algebra/algebra.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
is_specializable_value(val)
A constant is only worth specializing on if some operator's identity or
annihilator rule can fire against it; see SPECIALIZABLE_VALUES.
Source code in src/finch/algebra/algebra.py
113 114 115 116 117 118 119 120 121 | |
repeat_operator(op)
If there exists an operator g such that f(x, x, ..., x) (n times) is equal to g(x, n), then return g.
Source code in src/finch/algebra/algebra.py
189 190 191 192 193 194 195 | |
type_max(type_)
Returns the maximum value of the given type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type_
|
FDTypeOrdered
|
The type to determine the maximum value for. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The maximum value of the given type. |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the maximum value is not implemented for the given type. |
Source code in src/finch/algebra/algebra.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
type_min(type_)
Returns the minimum value of the given type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type_
|
FDTypeOrdered
|
The type to determine the minimum value for. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The minimum value of the given type. |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the minimum value is not implemented for the given type. |
Source code in src/finch/algebra/algebra.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |