General MEX Implementation of Thomas' Algorithm

Versión (18.7 KB) por oreoman
MEX (C/C++) Implementation of Thomas Algorithm (or Tridiagonal Matrix Algorithm) for real and complex data.

73 descargas

Actualizado 10 Mar 2020

De GitHub

Ver licencia en GitHub

MLDIVIDE has a great tridiagonal matrix solver for sparse matrices, and there are other implementations of Thomas' algorithm out there (see below), but I needed a faster way to solve tridiagonal systems for complex data; this seems to do the trick. On my system (and R2018b), this is about four times faster than MLDIVIDE or a straight up implementation in MATLAB.

This does use interleaved complex numbers with AVX instructions for complex operations, so to compile for use just put it on your path, type "mex -R2018a 'CFLAGS=-mavx' tdma.c" and it should work.

For a MEX implementation that works on REAL data, please see:

For a MATLAB implementation that works on all data, please see:

Citar como

oreoman (2023). General MEX Implementation of Thomas' Algorithm (, GitHub. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2018b
Compatible con cualquier versión desde R2018a
Compatibilidad con las plataformas
Windows macOS Linux

Inspirado por: Implementation of Thomas algorithm, mex, tridiag.m

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

No se pueden descargar versiones que utilicen la rama predeterminada de GitHub

Versión Publicado Notas de la versión

Connecting to GitHub...

Of course I forgot a few important comments on how to compile the MEX thread pool stuff so... fixed.


Added in a version that includes use of new persistent Thread Pool code for multi-threading, greatly speeding up smaller 2D and 3D problems.

Fixed a stupid logic error for 3D problems.

Added additional error checking, and updated some notes on multi-threading performance.

Added in limited multi-threading support, with underwhelming results.

Updated to include real data too, and to handle multi-dimensional problems without the need for permutation and reshaping of inputs / outputs.

Added in some error checks so things don't just crash MATLAB if you're off by a little bit.

Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.
Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.