eqdisco.expr.Primitive#
- class eqdisco.expr.Primitive(name, arity, func, sympy, deriv=None, interval=None, complexity=1.0, commutative=False, symbol=None, precedence=10)[source]#
Bases:
objectA function node of an expression.
- Parameters:
- name
str Unique name, used in strings, JSON files and exporters.
- arity
int Number of arguments (1 or 2 for the built-in primitives).
- func
callable() Vectorized NumPy implementation; must not raise for finite inputs.
- sympy
callable() Builds the SymPy expression from SymPy arguments.
- deriv
callable(),optional deriv(args, value) -> tupleof the partial derivatives with respect to each argument (arrays or scalars), used for the parameter Jacobian.- interval
callable(),optional interval(lo_args, hi_args) -> (lo, hi); elementwise bounds of the function over boxes, used by shape constraints.- complexity
float Weight of the node in the weighted complexity measure.
- commutativebool
True for symmetric binary functions (add, mul, max, min).
- symbol
str,optional Infix operator used by the string printer (
"+"for add).
- name