A newer version of Max is available. Click here to access the latest version of this document.


Evaluate expressions


The jit.expr object evaluates expressions to fill an output matrix. The expression can contain any operator available from within jit.op, any functor available from within jit.bfg, and many jitter MOPs. A variable number of inputs can be specified with an attribute argument setting the inputs attribute. Expressions should be specified between double quotes, and different expressions can be evaulated per plane if multiple symbols are used for the expr attribute. There are special variables and constants which can be used within expressions listed below. All expressions are evaluated using floating point arithmeic, so they will be more precise, but often slower for computing char data. For optimal speed with char data, it is recommended to use jit.charmap where possible (perhaps filled with an exaluated expression).

Matrix Operator

matrix inputs:-1, matrix outputs:1
Name IOProc Planelink Typelink Dimlink Plane Dim Type
out n/a 1 1 1 1 1 char long float32 float64

Information for Jitter Matrix Operator (MOP) messages and attributes to this object


int Sets all matrix cells corresponding with input to int.
float Sets all matrix cells corresponding with input to float.
list input [list]
Sets all matrix cells corresponding with input to list, on a per plane basis.


Name Type g/s Description
inputs int Input count (default = 2)
cache int Toggles the cache intermediary values flag. The default is 1 (on). It may be desirable to turn off when using generator operators such as jit.noise in the expression, which should not be cached.
expr symbol The expression to evaluate. If one expression is specified, it is evaluated for all planes. If multiple expressions are specified, they are evaluated on a plane by plane basis.

For a list of valid operators see jit.op and jit.bfg.

Special variables that may be used are:
cell[0-31] integer coordinate across dim
norm[0-31] normalized coordinate across dim
snorm[0-31] signed normalized coordinate across dim
dim[0-31] matrix size across dim
in[0-31] input matrix, corresponding plane
in[0-31].p[0-31] input matrix, specific plane
matrixname any named matrix, corresponding plane
matrixname.p[0-31] any named matrix, specific plane

Special contants that may be used are:
E Euler's constant
LN2 natural log of 2
LN10 natural log of 10
LOG2E log base 2 of Euler's constant
LOG10E log base 10 of Euler's constant
SQRT2 square root of 2
SQRT1_2 square root of 1/2
precision symbol Sets the internal precision. The options are:

float32 (the default)
verbose int Toggles the printing of expression information to Max Window.

Information for box attributes common to all objects


See Also

Name Description
expr Evaluate a mathematical expression
jit.charmap 256 point input to output map
jit.op Apply binary or unary operators
jit.bfg Evaluates a procedural basis function graph
vexpr Evaluate a math expression for a list of different inputs
Tutorial 39: Spatial Mapping Tutorial 39: Spatial Mapping
Tutorial 46: Manipulating Matrix Data using JavaScript Tutorial 46: Manipulating Matrix Data using JavaScript