While I assume that the functions in this collection of M-files work, I note that many of the functions make use of the MATLAB function EVAL even though equivalent vectorized solutions exist. As a result, many of the functions run orders of magnitude slower than necessary. The functions addpaths, gmax, gmin, limindex, lim2cell, mmax, mmin, pad, resize, rmpaths, shift, subdim all use EVAL, when none need to. In addition, numerous functions are not computationally efficient. For example the simple function y=iseven(x) can be written as y=mod(x,2)==0; rather than by the three statements in iseven.
11 Feb 2003
Valeri Karlov
I tried function thomas. It solves a tridiagonal linear system by an efficient Thomas method. But, how this function is implemented completely ignores Matlab's vectorization and sparse type. This makes even a straightforward Matlab's solution x = A\d ~twice faster (for large systems). But, using "sparce" simply makes the calculation instant (but not for thomas.m).
See the test attached:
n = 5000;
a = rand(n,1);
b = rand(n-1,1);
c = rand(n-1,1);
d = rand(n,1);
A = diag(a) + diag(b,1) + diag(c,-1);
% Non-sparse
tic
xc = A\d;
toc
tic
xt = thomas(A,d);
toc
% Sparse
A_s = sparse(A);
tic
xc_s= A_s\d;
toc
tic
xt_s = thomas(A_s,d);
toc