from MEXING WITH IFORT 11.0 IN 64 BIT MATLAB by Leslie Foster
FOR 64 BIT MATLAB IN WINDOWS MEXING WITH MATLAB 7.6 - 7.8 AND IFORT 11.0

lupp_test.m
% This file tests the routine lupp which is described in
% the file lupp.m and can be created using
% Matlab's mex utility as discussed readme.txt and lupp_mex.txt
%
% associated files:
%      lupp.m -- describes the use of the lupp code
%      lupp.F -- the gateway routine for lupp
%      luppf.F -- a "computational routine" called by lupp.F
%      lupp_mex.m -- has examples of mex commands to compile lupp.F
%      lupp_test.m -- is a MATLAB routine that tests the compiled lupp
%      readme.txt -- describes how to add to MATLAB's mex utilility
%            to allow use of the Intel Fortran 11.0 compiler
%      intelf11msvs2005opts.b and intelf11msvs2005opts.stp --
%            two files discussed in readme.txt
%  created or modified by L. Foster, 6-4-2009

format compact
errors = [];
m = 200;
n = 200;
disp(['m = ',num2str(m),', n = ',num2str(n)])
A = randn(m,n);
% run with one output
L = lupp(A);
% test with two outputs
[L,U]=lupp(A);
normA = norm(A);
e = norm(A-L*U)/normA;
disp(['with two outputs: error = ',num2str(e)])
errors = [errors, e];
% test with three outputs
[L,U,P]=lupp(A);
e = norm(P*A-L*U)/normA;
errors = [errors, e];
disp(['with three outputs: error = ',num2str(e)])
% test with vector for permutation
[L,U,p]=lupp(A,'vector');
errors = [errors, e];
e = norm(A(p,:)-L*U)/normA;
disp(['with permutation stored as vector: error = ',num2str(e)])

m = 300;
n = 200;
disp(' ')
disp(['m = ',num2str(m),', n = ',num2str(n)])
A = randn(m,n);
% run with one output
L = lupp(A);
% test with two outputs
[L,U]=lupp(A);
normA = norm(A);
e = norm(A-L*U)/normA;
disp(['with two outputs: error = ',num2str(e)])
errors = [errors, e];
% test with three outputs
[L,U,P]=lupp(A);
e = norm(P*A-L*U)/normA;
errors = [errors, e];
disp(['with three outputs: error = ',num2str(e)])
% test with vector for permutation
[L,U,p]=lupp(A,'vector');
errors = [errors, e];
e = norm(A(p,:)-L*U)/normA;
disp(['with permutation stored as vector: error = ',num2str(e)])


m=200;
n = 300;
disp(' ')
disp(['m = ',num2str(m),', n = ',num2str(n)])
A = randn(m,n);
% run with one output
L = lupp(A);
% test with two outputs
[L,U]=lupp(A);
normA = norm(A);
e = norm(A-L*U)/normA;
disp(['with two outputs: error = ',num2str(e)])
errors = [errors, e];
% test with three outputs
[L,U,P]=lupp(A);
e = norm(P*A-L*U)/normA;
errors = [errors, e];
disp(['with three outputs: error = ',num2str(e)])
% test with vector for permutation
[L,U,p]=lupp(A,'vector');
errors = [errors, e];
e = norm(A(p,:)-L*U)/normA;
disp(['with permutation stored as vector: error = ',num2str(e)])

disp(' ')
if  ( max( errors ) < max(m,n)*eps )
    disp('lupp passed all tests')
else
    disp('lupp failed at least one test')
end

Contact us at files@mathworks.com