Jiro's pick this week is FACTORIZE by Tim Davis.
If you browse through the MATLAB Newsgroup, you will occasionally find discussions on "matrix inverse". In many of those discussions, the ultimate goal of wanting matrix
inversion was to solve a linear system
Ax = b
Take this simple example:
A = randn(3, 3)
b = randn(3, 1)
0.52006 -0.79816 -0.71453
-0.020028 1.0187 1.3514
-0.034771 -0.13322 -0.22477
Technically, you can solve it using the INV function.
x1 = inv(A)*b
But as the documentation for inv suggests, there is a better way to solve this problem, both in terms of efficiency as well as accuracy. That is to use the
x2 = A\b
Tim takes this one step further and extends the capability with his Factorize object. One of the benefits is that you can
"reuse" this efficiency in different conditions:
c = randn(3, 1);
F = factorize(A);
x3 = F\b
x4 = F\c;
This is a simple 3-by-3 example for illustration, but you'll appreciate its power when you're working with larger systems.
I like this entry for several reasons.
He uses the new MATLAB Class system (introduced in R2008a). Specifically, he utilizes object-oriented techniques, such as
property attributes and abstract classes.
He includes a very thorough, pedagogical document that explains the uses of the object and the theory behind different techniques for solving linear systems.
He includes a test suite for testing the accuracy, performance, error-handling, and display methods of the Factorize object.
I recommend looking at this highly-rated entry by Tim.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.