6. Code generation for computations¶
Warning
This section of the documentation is still incomplete.
Computation trees
Sets of computations organized as dependency graphs, with multiple roots (input variables) and leaves (output expressions).
6.1. Defining a computation¶
- class csparse¶
- cs=csparse()
Creates an empty computation tree
- Returns
empty
csparse
object
- declareSet(cs, destination, functionName)¶
Adds an input variable to the tree
- Parameters
cs –
csparse
objectdestination –
Tcalculus
tensor variable created usingTvariable()
functionname (
string
) – name of the function to be created
- declareGet(cs, sources, functionName)¶
Adds output expressions to the tree
- declareCopy(cs, destinations, sources, functionName)¶
Sets the value of input variables, based on the value of output expressions
- Parameters
cs –
csparse
objectsources – cell array of
Tcalculus
tensor-valued expressionsdestinations – cell array of
Tcalculus
tensor variables created usingTvariable()
functionname (
string
) – name of the function to be created
6.2. Code generation¶
- cmex2compute(parameter1, value1, parameter2, values2, ...)¶
- class2compute(parameter1, value1, parameter2, values2, ...)¶
Generate code to set values of input variables, get values of output expressions, and copy output expressions to input variables.
- Parameters
parameter1 (
string
) – parameter to setparameter2 (
string
) – parameter to set, …
- Returns
name of the MATLAB© class created
- Return type
string