nwh / lusol

Matlab interface to LUSOL

Home Page:http://www.stanford.edu/group/SOL/software/lusol.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

generation of non upper triangular U

joaoleal opened this issue · comments

I've come across a problem in LUSOL where the U matrix is not upper triangular.
This can happen when nzinit is too low, increasing it will generate correct results.
The inform flag is always 1 (successful factorization but rank deficient) and not 7 (LUSOL needs more storage).
Here is a script that should reproduce the problem:

m = 800;
n = 900;
A = sparse(m, n);
nfill = 10;
for i = 1:m
    for j = 1:nfill
        c = i + j - nfill / 2;
        if (c >= 1 && c < n) 
            A(i, c) = i;
        end
    end
end

options = lusol_obj.luset('pivot','TRP',...
                          'maxcol', 5,...
                          'keepLU', 1,...
                          'Ltol1', 1.5,...
                          'Ltol2',1.5,...
                          'nzinit', 10000);
mylu = lusol_obj(A, options);

fprintf('LUSOL inform: %i\n', mylu.inform());
if mylu.inform() == 0
    fprintf('factorization successful (full rank)\n');
elseif mylu.inform() == 1
    fprintf('factorization successful (rank deficient)\n');
else
    fprintf('factorization FAILED\n');
end

[U, P, Q] = mylu.U('matrix');

fprintf('min lena: %i\n', mylu.stats().minlen);

fprintf('is U upper triangular: ');
if istriu(U)
    fprintf('yes\n');
else
    fprintf('no\n');
end

The output is

LUSOL inform: 1
factorization successful (rank deficient)
min lena: 11390
is U upper triangular: no

Changing nzinit to 100000 will generate the output:

LUSOL inform: 1
factorization successful (rank deficient)
min lena: 11390
is U upper triangular: yes

@joaoleal I am not sure about this bug. Would you reach out to me at nwh@stanford.edu regarding conversion of the F77 files to F90?