MtxVec expression evaluator can be used to evaluate individual expressions or it can evaluate a list of expressions (a script).
MtxVec expression evaluator can be used to evaluate individual expressions or it can evaluate a list of expressions (a script). The parser compiles the expression and types can not be changed at run time. The compiled code can then be executed at top speed with:
- Support for real and complex numbers, vectors and matrices, integers vectors, integer matrices, booleans, boolean vectors and matrices, strings and custom object types.
- Many matrix operations are multithreaded
- Most built-in vectorized functions are optimized for SSE3/SSE4/AVX2/AVX512
- Features about 500 built-in functions ranging from basic math (Log, Sin, Exp,...), linear algebra (LQ, QR, EIG, LU, ...) , FFTs, 30 probability distributions and more...
- Performance of vectorized expression evaluation is 10 to 20x higher than scalar expression parsers.
- Operator support for per element and matrix/vector operations ( *., /., *, /,\)
- Very fast also when evaluating not vectorized expressions
- Constant expressions evaluated during the parsing stage
- You can add user defined variables, constants, functions and operators and custom functions can be object methods.
- Functions can be overloaded allowing same name but different param count.
- Vectors and matrices can be accessed by elements a(i) or m(r,c).
- Colon operator allows selection of ranges of rows and colums m(:), m(1,:),v(2:3)
- Assign operator supports colon operator: m(2:3) = 4
- Colon operator supports step <> 1 and allows: m(10:-1:3) = 4
- Vectors and matrices can return elements from conditions: a = m(m > 4)
- Concatenation operator: a = [1,2 ; 3, 4]
- Functions can have multiple results: (amplt, phase) = CartToPolar(FFT(a));
- Comments are done with //
- Support for while-loop, for-loop and if-else clauses
- Expressions are case sensitive, but aliases like Tan/tan, Sin/sin are supported
- Available for Windows, iOS, Android and OS X.
A short "Users manual" is available for end users.
Scripting currently supports only evaluation of a list of expressions, but this can already be very usefull when giving your customers an option to customize the processing of your application. Here is an example of the scripting interface included with the MtxVec demo application:
To get a list of functions avialable write "help", to clear the screen "cls", to undefine vars: undefine(a,b,...)....
You can also interface an arbitrary "Grid" object. The demo even features "tooltips" showing content of individual vars.
So many languages, so many scripts, and this particular one does not yet allow declaration of functions? Indeed, it is still to come. Currently however it does execute its expressions 3-5x faster than a (any) scripting language, when the variables are matrices and vectors and calling more than one function, and closely matches MtxVec expressions speed when compiled with the (C#, Delphi, C++) compilers.