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: object

A function node of an expression.

Parameters:
namestr

Unique name, used in strings, JSON files and exporters.

arityint

Number of arguments (1 or 2 for the built-in primitives).

funccallable()

Vectorized NumPy implementation; must not raise for finite inputs.

sympycallable()

Builds the SymPy expression from SymPy arguments.

derivcallable(), optional

deriv(args, value) -> tuple of the partial derivatives with respect to each argument (arrays or scalars), used for the parameter Jacobian.

intervalcallable(), optional

interval(lo_args, hi_args) -> (lo, hi); elementwise bounds of the function over boxes, used by shape constraints.

complexityfloat

Weight of the node in the weighted complexity measure.

commutativebool

True for symmetric binary functions (add, mul, max, min).

symbolstr, optional

Infix operator used by the string printer ("+" for add).