Expressions

ironArray has a strong support for expression evaluation. Things like sums, products, divisions and a pretty complete range of transcendental functions (e.g. exp, sin, asin, tanh…) have been implemented so as to guarantee an efficient evaluation in (large) arrays.

Expressions can be built either from small one liners (either in string format or as regular Python expressions, see tutorials section for details), or from User Defined Functions which are described later in section User Defined Functions. There are the next constructors for creating an expression:

Constructors

expr_from_string

Create an Expr instance from an expression in string form.

expr_from_udf

Create an Expr instance from an UDF function.

Expressions are implemented in the iarray.Expr class. Once built, they can be evaluated via the iarray.Expr.eval() method.

Expressions can call UDF functions registered via the iarray.UdfRegistry class.

Expr class

Expr

A class that is meant to hold an expression.

Methods

Expr.eval

Evaluate the expression in self.

UdfRegistry

This class is meant to register UDF functions in libraries. As there is only a global register, the user must use its global udf_registry instance in the iarray package.

Note that, since the inclusion of the new lib= param in the udf.scalar decorator, it is not necessary to use this explicitly for registering anymore. See udf_expr.py example for more info on how to use the register mechanism.

UdfRegistry

Methods

Methods

UdfRegistry.__getitem__

Get the name library.

UdfRegistry.__setitem__

Add a UDF function to name library.

UdfRegistry.__delitem__

Delete the attr given by name.

UdfRegistry.iter_funcs

Iterate over all UDF funcs registered in name lib.

UdfRegistry.iter_all_func_names

Iterate over all UDF func names registered in all libs.

UdfRegistry.get_func_addr

Return the address of the compiled UDF function.

UdfRegistry.clear

Clear all the registered libs and UDF funcs.

Utils

expr_get_operands

Return a tuple with the operands of an expression in string form.

expr_get_ops_funcs

Return the operands and functions of an expression in string form.