A toolbox for fast and accurate computations using M-matrices in Matlab, by Bruno Iannazzo, Mehdi Najafi-Kalyani, and Federico Poloni. The toolbox is described in
The mmatrix toolbox: componentwise accurate algorithms for M-matrices with triplet representation, Bruno Iannazzo, Mehdi Najafi Kalyani, Federico Poloni, arXiv:2607.05437.
To install the toolbox, download the source files from the Releases page into a folder, and add that folder to the Matlab search path.
If you have a working Fortran compiler set up on your computer to use with Matlab, you can compile the Mex files yourself with
>> build_mexOtherwise, you can download pre-compiled versions for Windows and Linux from the Releases page. (Producing a pre-compiled version for Mac is more complicated, unfortunately, since Matlab does not support building Mex-files using GFortran on Mac machines.) Download the mex-???.zip file that matches your operating system, and unzip its contents into the +mmex folder.
After installation, you can run the automated tests to check everything is working:
>> runtests('tests/');To download and install the most recent development version of the toolbox automatically, you can also run:
unzip('https://github.com/numpi/mmatrix/archive/main.zip');
movefile('mmatrix-main', 'mmatrix-toolbox');
addpath(fullfile('mmatrix-toolbox'));
savepath;dmmtf2.f: basic unblocked (BLAS level-2) version.dmmtrf2.f: recursive cache-oblivious version. Needs a temporary bufferWORKof size2n.dmmtrf.f: blocked version (BLAS level-3) which callsdmmtf2.fon the single blocks. Needs a temporary bufferWORKof sizenb, wherenbis the user-specified block size.dmmtrff.f: blocked version (BLAS level-3) which callsdmmtrf2.fon the single blocks (this one should be the fastest). Needs a temporary bufferWORKof size2*nb, wherenbis the user-specified block size.
dmltf2.f: basic unblocked (BLAS level-2) version.dmltrf2.f: recursive cache-oblivious version.dmltrf.f: blocked version (BLAS level-3) which callsdmltf2.fon the single blocks. Needs a temporary bufferWORKof sizenb, wherenbis the user-specified block size.dmltrff.f: blocked version (BLAS level-3) which callsdmltrf2.fon the single blocks. Needs a temporary bufferWORKof sizenb, wherenbis the user-specified block size.