# Why does mldivide solve equations so fast that FORTRAN can't compare it？

14 views (last 30 days)

Answered: Christine Tobler on 25 Oct 2021
At present, I am studying the accelerated solution algorithm of the finite difference method (multigrid method). Therefore, I am very concerned about the speed comparison between Matlab's inverse division method and Mg method, but I find that the inverse division method or mldivide method is very fast, so I can't think of the significance of mg method? MG is meaningful only if:
1. Matlab's mldivide uses GPU acceleration
2. Matlab's mldivide uses multithreading or parallel acceleration
If this is the case, we would appreciate it if you could provide the source or bibliography
Of course, I also want to know whether these acceleration methods are also used by default, such as LU decomposition and QR decomposition

Jan on 23 Oct 2021
Edited: Jan on 23 Oct 2021
Matlab's code for the matrix division is not made public. Internally optimized BLAS libraries and MKL are used. The taskmanager shows, that multithreading is applied if the matrix size exceeds certain limits: mutliple cores are working.
QR and LU are using optimized libraries and mutlithreading also.
To see the source code, you have to be employed by MathWorks.

Christine Tobler on 25 Oct 2021
MATLAB's mldivide uses multithreading. It doesn't use the GPU unless you have the Parallel Computing Toolbox and are using the gpuArray class.
We don't give out details about the internal implementation of mldivide. Two things you can look into:
• The mldivide documentation which describes which decomposition is used (presumably you'd be interested in the sparse case)
• The spparms function: If you call spparms('spumoni', 1), every call to mldivide for a sparse matrix will print diagnostic information about what decomposition is used to the command line.

### Categories

Find more on Linear Algebra in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!