Skip to main content

Knowledge Base

MtxVec expressions

Operator overloading

It is possible to mix vectors, matrices, complex numbers and scalars in the Delphi code. It is sufficient to declare the type as Vector or Matrix without the need to worry about object creation or destruction. Freeing of objects is automatically wrapped by the compiler in to try/finally blocks. Internally object and memory allocations are cached ensuring best in class performance. The syntax is best demonstrated by an example:

MtxVec Expressions

MtxVec Expressions are available for Delphi/C++Builder 2006 and later. Another set of additional features has been added in 2022:

SelectSyntax

The speed of code is of course still (much) higher than using native Delphi arrays as long as the vectors/matrices are big enough. (more than 10 elements). "Select" property returnes "a view" or subranged vector. In case of matrices, it makes a copy. This type of syntax is is usefull for quick prototyping and debugging.