This class wraps a symbolic expression with additional information for the convenience of compiling and exporting the symbolic expression to a C/C++ source files. More...
Public Member Functions | |
SymFunction (char name,char expr,cell vars,cell params) | |
The class constructor function. More... | |
function f = | export (char export_path,varargin varargin) |
Export the symbolic expression of functions to C/C++ source files and build them as MEX files. More... | |
function [ J , Js ] = | exportJacobian (char export_path,varargin varargin) |
Export the symbolic expression of the Jacobian of the function to C/C++ source files and build them as MEX files. More... | |
function [ H , Hs ] = | exportHessian (char export_path,varargin varargin) |
Export the symbolic expression of the Hessian of the function to C/C++ source files and build them as MEX files. More... | |
function file = | save (char export_path,varargin varargin) |
Save the symbolic expression of a wolframe MX file. More... | |
function SymExpression obj = | load (char file_path) |
load the saved symbolic expression from a wolframe MX file More... | |
Public Member Functions inherited from SymExpression | |
SymExpression (x, varargin) | |
The class constructor function. More... | |
function | delete () |
object destruction function More... | |
function | display (namestr) |
Display the symbolic expression. More... | |
function y = | argnames () |
Symbolic function input variables ARGNAMES(F) returns a sym array [X1, X2, ... ] of symbolic variables for F(X1, X2, ...). More... | |
function x = | formula () |
Symbolic expression formula body FORMULA(F) returns the definition of symbolic function F as a sym object expression. More... | |
function x = | symbol () |
Symbolic expression symbol string SYMBOL(F) returns the symbolc string of symbolic expression F as a sym object expression. More... | |
function y = | privToCell () |
function y = | length () |
The length of the symbolic vector LENGTH(X) returns the length of vector X. It is equivalent to MAX(SIZE(X)) for non-empty arrays and 0 for empty ones. More... | |
function varargout = | size () |
The size of the symbolic expression tensor. More... | |
function status = | islist () |
Check if the symbolic expression is a scalar (non-list) More... | |
function X = | first () |
function B = | uminus () |
------------— Arithmetic --------------— Symbolic negation. More... | |
function B = | uplus () |
Unary plus. More... | |
function X = | plus (B) |
Symbolic plus operation. More... | |
function X = | minus (B) |
Symbolic minus operation. More... | |
function X = | times (B) |
Symbolic array multiplication. TIMES(A,B) overloads symbolic A .* B. More... | |
function X = | mtimes (B) |
Symbolic matrix multiplication. MTIMES(A,B) overloads symbolic A * B. More... | |
function B = | mpower (p) |
Symbolic matrix power. MPOWER(A,p) overloads symbolic A^p. More... | |
function B = | power (p) |
Symbolic array power. POWER(A,p) overloads symbolic A.^p. More... | |
function X = | rdivide (B) |
Symbolic array right division. RDIVIDE(A,B) overloads symbolic A ./ B. More... | |
function X = | ldivide (B) |
Symbolic array left division. LDIVIDE(A,B) overloads symbolic A . B. More... | |
function X = | mrdivide (B) |
/ Slash or symbolic right matrix divide. A/B is the matrix division of B into A, which is roughly the same as A*INV(B) , except it is computed in a different way. More precisely, A / B = (B \ A )'. See SYM/MLDIVIDE for details. Warning messages are produced if X does not exist or is not unique. Rectangular matrices A are allowed, but the equations must be consistent; a least squares solution is not computed. More... | |
function X = | mldivide (B) |
Symbolic matrix left division. MLDIVIDE(A,B) overloads symbolic A \ B. X = A \ B solves the symbolic linear equations A*X = B. Warning messages are produced if X does not exist or is not unique. Rectangular matrices A are allowed, but the equations must be consistent; a least squares solution is not computed. More... | |
function B = | transpose () |
Symbolic matrix transpose. TRANSPOSE(A) overloads symbolic A.' . More... | |
function B = | ctranspose () |
Symbolic matrix complex conjugate transpose. CTRANSPOSE(A) overloads symbolic A' . More... | |
function B = | inv () |
Symbolic matrix inverse. INV(A) computes the symbolic inverse of A INV(VPA(A)) uses variable precision arithmetic. More... | |
function y = | eq (B) |
Symbolic equality test. EQ(A,B) overloads symbolic A == B. If A and B are integers, rational numbers, floating point values or complex numbers then A == B compares the values and returns true or false. Otherwise A == B returns a sym object of the unevaluated equation which can be passed to other functions like solve. To force the equation to perform a comparison call LOGICAL or isAlways. LOGICAL will compare the two sides structurally. isAlways will compare the two sides mathematically. More... | |
function y = | ne (B) |
NE Symbolic inequality test. NE(A,B) overloads symbolic A ~= B. The result is the opposite of A == B. More... | |
function C = | subsasgn (Idx, R) |
Subscripted assignment for a sym array. C = SUBSASGN(L,Idx,R) is called for the syntax L(Idx)=R. Idx is a structure array with the fields: type – string containing () specifying the subscript type. Only parenthesis subscripting is allowed. subs – Cell array or string containing the actual subscripts. More... | |
function B = | subsref (Idx) |
Subscripted reference for a sym array. B = SUBSREF(A,S) is called for the syntax A(I). S is a structure array with the fields: type – string containing () specifying the subscript type. Only parenthesis subscripting is allowed. subs – Cell array or string containing the actual subscripts. More... | |
function y = | end (varargin) |
Last index in an indexing expression for a sym array. END(A,K,N) is called for indexing expressions involving the sym array A when END is part of the K-th index out of N indices. For example, the expression A(end-1,:) calls A's END method with END(A,1,2). More... | |
function X = | double () |
Converts symbolic matrix to MATLAB double. DOUBLE(S) converts the symbolic matrix S to a matrix of double precision floating point numbers. S must not contain any symbolic variables, except eps . More... | |
function M = | char () |
Convert scalar or array sym to string. CHAR(A) returns a string representation of the symbolic object A in MuPAD syntax. More... | |
function [ SymExpression obj , file , SymExpression obj ] = | load (char file_path, file,SymExpression obj, varargin,SymExpression obj,char file_path, file) |
load the saved symbolic expression from a wolframe MX file More... | |
Public Attributes | |
char | Name |
An identification name of the function. More... | |
SymVariable | Vars |
The symbolic representation of the dependent variables. More... | |
SymVariable | Params |
The symbolic representation of the constant parameters. More... | |
struct | Status |
The status flags of the SymFunction. More... | |
Funcs | |
File names of the functions. More... | |
Public Attributes inherited from handle | |
addlistener | |
Creates a listener for the specified event and assigns a callback function to execute when the event occurs. More... | |
notify | |
Broadcast a notice that a specific event is occurring on a specified handle object or array of handle objects. More... | |
delete | |
Handle object destructor method that is called when the object's lifecycle ends. More... | |
disp | |
Handle object disp method which is called by the display method. See the MATLAB disp function. More... | |
display | |
Handle object display method called when MATLAB software interprets an expression returning a handle object that is not terminated by a semicolon. See the MATLAB display function. More... | |
findobj | |
Finds objects matching the specified conditions from the input array of handle objects. More... | |
findprop | |
Returns a meta.property objects associated with the specified property name. More... | |
fields | |
Returns a cell array of string containing the names of public properties. More... | |
fieldnames | |
Returns a cell array of string containing the names of public properties. See the MATLAB fieldnames function. More... | |
isvalid | |
Returns a logical array in which elements are true if the corresponding elements in the input array are valid handles. This method is Sealed so you cannot override it in a handle subclass. More... | |
eq | |
Relational functions example. See details for more information. More... | |
transpose | |
Transposes the elements of the handle object array. More... | |
permute | |
Rearranges the dimensions of the handle object array. See the MATLAB permute function. More... | |
reshape | |
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape function. More... | |
sort | |
ort the handle objects in any array in ascending or descending order. More... | |
Additional Inherited Members | |
Protected Attributes inherited from SymExpression | |
char | f |
The body (or formula) of the symbolic expression. More... | |
char | s |
The symbol that represents the symbolic expression. More... | |
Detailed Description
This class wraps a symbolic expression with additional information for the convenience of compiling and exporting the symbolic expression to a C/C++ source files.
Copyright (c) 2016, AMBER Lab All right reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted only in compliance with the BSD 3-Clause license, see http://www.opensource.org/licenses/bsd-license.php
Constructor & Destructor Documentation
◆ SymFunction()
The class constructor function.
- Parameters
-
name the name of the function. expr the symbolic expression of the function vars the symbolic representation of variables in the expression params the symbolic representation of parameters in the expression
- Required fields of funcs:
Func —
a string of the function that computes the function valueJac —
a string of the function that computes the function JacobianJacStruct —
a string of the function that computes the sparsity structure of function JacobianHess —
a string of the function that computes the function HessianHessStruct —
a string of the function that computes the sparsity structure of function Hessian
Member Function Documentation
◆ export()
Export the symbolic expression of functions to C/C++ source files and build them as MEX files.
- Parameters
-
export_path the path to export the file varargin variable input parameters Named Parameters for varargin:[, "BuildMex", BuildMex_value ] [, "Namespace", Namespace_value ][, "TemplateFile", TemplateFile_value ] [, "TemplateHeader", TemplateHeader_value ][, "noPrompt", noPrompt_value ] )- StackVariable whether to stack variables into one ( Default:
false
) - ForceExport force the export ( Default:
false
) - BuildMex flag whether to MEX the exported file ( Default:
true
) - Namespace the namespace of the function ( Default:
)SymFunction
- TemplateFile TemplateFile ( Default:
'
) - TemplateHeader TemplateHeader ( Default:
'
) - noPrompt noPrompt ( Default:
false
)
- StackVariable whether to stack variables into one ( Default:
◆ exportHessian()
Export the symbolic expression of the Hessian of the function to C/C++ source files and build them as MEX files.
- Parameters
-
export_path the path to export the file varargin variable input parameters Required Parameters for varargin:exportHessian ( ..., Vars, File,"ForceExport", ForceExport_value ] [, "BuildMex", BuildMex_value ][, "Namespace", Namespace_value ] [, "StackVariable", StackVariable_value ][, "TemplateFile", TemplateFile_value ] [, "TemplateHeader", TemplateHeader_value ] )- Vars a list of symbolic variables
- File the (full) file name of exported file
- ForceExport force the export ( Default:
false
) - BuildMex flag whether to MEX the exported file ( Default:
true
) - Namespace the namespace of the function ( Default:
)SymFunction
- StackVariable StackVariable ( Default:
false
) - TemplateFile TemplateFile ( Default:
'
) - TemplateHeader TemplateHeader ( Default:
'
)
◆ exportJacobian()
Export the symbolic expression of the Jacobian of the function to C/C++ source files and build them as MEX files.
- Parameters
-
export_path the path to export the file varargin variable input parameters Required Parameters for varargin:exportJacobian ( ..., Vars, File,"ForceExport", ForceExport_value ] [, "BuildMex", BuildMex_value ][, "Namespace", Namespace_value ] [, "StackVariable", StackVariable_value ][, "TemplateFile", TemplateFile_value ] [, "TemplateHeader", TemplateHeader_value ] )- Vars a list of symbolic variables
- File the (full) file name of exported file
- ForceExport force the export ( Default:
false
) - BuildMex flag whether to MEX the exported file ( Default:
true
) - Namespace the namespace of the function ( Default:
)SymFunction
- StackVariable StackVariable ( Default:
false
) - TemplateFile TemplateFile ( Default:
'
) - TemplateHeader TemplateHeader ( Default:
'
)
◆ load()
function SymExpression obj = SymFunction.load | ( | char | file_path | ) |
load the saved symbolic expression from a wolframe MX file
- Parameters
-
file_path the path to export the file obj the expressions other than the main object
- Generated fields of obj:
◆ save()
Save the symbolic expression of a wolframe MX file.
- Parameters
-
export_path the path to export the file varargin variable input parameters Named Parameters for varargin:save ( ..., [ "ForceExport", ForceExport_value ] )- ForceExport force the export ( Default:
false
)
- ForceExport force the export ( Default:
- Return values
-
file the full file name of the exported function
Member Data Documentation
◆ Funcs
SymFunction.Funcs |
File names of the functions.
Each field of 'Funcs' specifies the name of a function that used for a certain computation of the function.
- Note
- This property has non-standard access specifiers:
SetAccess = Private, GetAccess = Public
- Matlab documentation of property attributes.
◆ Name
SymFunction.Name |
An identification name of the function.
- Note
- This property has non-standard access specifiers:
SetAccess = Protected, GetAccess = Public
- Matlab documentation of property attributes.
◆ Params
SymFunction.Params |
The symbolic representation of the constant parameters.
- Note
- This property has non-standard access specifiers:
SetAccess = Protected, GetAccess = Public
- Matlab documentation of property attributes.
◆ Status
SymFunction.Status |
The status flags of the SymFunction.
These flags stores the status of assignment, export and compilation of the associated symbolic function.
- Note
- This property has non-standard access specifiers:
SetAccess = Protected, GetAccess = Public
- Matlab documentation of property attributes.
◆ Vars
SymFunction.Vars |
The symbolic representation of the dependent variables.
- Note
- This property has non-standard access specifiers:
SetAccess = Protected, GetAccess = Public
- Matlab documentation of property attributes.
The documentation for this class was generated from the following files:
- /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/symbolic/@SymFunction/SymFunction.m
- /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/symbolic/@SymFunction/export.m
- /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/symbolic/@SymFunction/exportHessian.m
- /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/symbolic/@SymFunction/exportJacobian.m
- /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/symbolic/@SymFunction/load.m
- /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/symbolic/@SymFunction/save.m