File Exchange

image thumbnail

Small size linear solver

version (3.03 KB) by Bruno Luong
Linear solver of multiple 2x2 and 3x3 systems


Updated 28 May 2010

View License

Solve multiple (2x2) or (3x3) linear systems:

A(:,:,k)*X(:,:,k) = B(:,:,k) for k=1,2,...,N

The method used here is basic cofactor/determinant.

DISADVANTAGE: This method may be less accurate than Matlab backslash (using in for-loop) when the matrices are ill-conditioned.

ADVANTAGE: for a large number of systems - the speed-up is about 15-30 fold.

Comments and Ratings (3)

James Tursa

FYI, I just uploaded a new version of MTIMESX that does small matrix multiplies (first two dimensions <= 4) with inline code in 'SPEED' mode. This runs faster than the previous version.

Bruno. Please ignore my previous comment. I overlooked that another MathCentral submission is required for your program to run.

Bruno, I tried to run your benchmark file (bench_inv2inv3.m) but ended up with an error:
??? Undefined function or method 'mtimesx' ...
A file seems to be missing.


Make sure calling MTIMESX with SPEED option
Modification of H1 lines

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux