Rank: 195280 based on 0 downloads (last 30 days) and 0 file submitted
photo

Qianyong Chen

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Qianyong
Updated File Comments Rating
28 Nov 2011 lapack Easily call any LAPACK or BLAS routine from inside Matlab. Author: Tim Toolan

I really like this idea. But couldn't make it work on my machine: 64bit Win7 with SDK 7.1 with Matlab 2011b.
The first run is always fine. But when I run the same code a few more times, it either stops due to segmentation error,
or gives unreliable results. Also, the difference for U and V (between Matlab results and using lapack.c provided here)
is large when the matrix is as small as 118 by 106. The error for the matrix itself (A - U * S * V) is very small though.

What I did is: 1) compile with mex lapack.c
2) run the following code:

% test a couple subroutines
clear all;
%--------------------
%1st: dgesvd.f
%--------------------
A = rand(118,106);

% 1st: results from direct matlab
[UM, SM, VM] = svd(A);

matlabError = max(max(abs(A-UM*SM*VM')))

% 2nd: results when using 'lapack' by Tim Toolan
[m,n] = size(A);

C = lapack('DGESVD', 'A','A',m, ...
n,A,m, zeros(n,1), zeros(m),m,zeros(n),n,zeros(5*m,1),5*m,0);
[SF, UF, VF] = C{[7,8,10]};

fortranError_U = max(max(abs(UM - UF)))
fortranError_V = max(max(abs(VM - VF')))
fortranError_SVD = max(abs(SF - diag(SM) ))

fortranError = max(max(abs( A - UF * SM * VF)))

Contact us