-
Notifications
You must be signed in to change notification settings - Fork 35
Home
The library contains of set of assembler hand optimized low level matrix functions for both x86 and x64 platforms. Beside the low level matrix functions there are also numerous high level ones like LU decomposition, singular value decomposition, matrix inversion, pseudo inversion and many more. All functions are written in plain Delphi/assembler and do not need any third party components/dlls!
You can for sure also make a donation to the project if you think it is usefull and want to support the developer.
The mrmath library contains a set of functions for matrix manipulation. It contains a hughe set for standard matrix handling - like adding or multiplying two matrices as well as function to apply a transformation function on each matrix element. In addition the library contains quite a set of standard linear algebra functions like the QR decomposition or Singular Value Decomposition.
An aim of this library was to provide highly optimized assembler versions in both x86 and x64 code for at least the lower level functions. To access the optimized functionality one needs at least a SSE3 capable processer - anyway the library decides on startup if the processor offers the expected features and if not it switches back to the pure Pascal implementation. In addition the library supports the CPU instruction sets AVX1 and FMA3.
The library itself is split into four parts: the first one consists of a set of pure Pascal procedural functions, a set of procedural highly optimized assembler functions in x86 and x64 versions and a matrix class tying the procedural functions together for easy matrix manipulation. In addition the single threaded matrix is extended by a threaded version, a platform dependent threadpool and a set of threaded matrix procedures.
A matrix is basically interpreted and also stored as an array of double values. The interpretation is row wise e.g. a 4x4 matrix is stored in an array of 16 double values whereas the first row consists of the first 4 values in the array, the second row of the next 4 values etc. All memory allocations are aligned to 32Bytes to avoid any memory access overhead to SSE and AVX.
To be more flexible in the calculations and to exihibit the advantages of proper memory alignment all of the functions provide some kind of LineWidth parameter for the input and output matrices. This also allows you to easily address sub matrices without doing any memory reallocation.
The matrix class provides an interface for base matrix manipulation and matrix memory management. It is basically a wrapper around the standard procedural functions and cares about the nasty details regarding memory management, data access and data initialization.
- Construction of objects and assigning data - memory management
- Loading and storing data from and to a stream/file
- Manipulating data
- Simple matrix manipulation functions
- Higher matrix manipulation functions
- Linear algebra
- Eigenvalue calculation
There are some mathematical methods that are encapsulated into separate classes:
- Principal component analysis and Incremental PCA
- Kernel Principal component analysis
- Independent component analysis
- Canonical Correlation Analysis
- Non-Negative Matrix factorization
- Partial Least Squares
- Non linear fit
- Expectation Maximization
- Dynamic Time Warp
- Robust B Splines
- Random number generation
- Statistic functions
- Correlation
- Distance calculations
- t-Distributed Stochastic Neighbor Embedding
- Singular Spectrum Analysis
During development there have been a few things that I stumbled over: