bugGNU Octave - Bugs: bug #36437, chol2inv can't handle sparse matrix

 
 

bug #36437: chol2inv can't handle sparse matrix

Submitted by:  Nir Krakauer <nir_krakauer>
Submitted on:  Wed May 9 01:02:15 2012  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Nir KrakauerOpen/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu Aug 11 17:47:13 2016, comment #5:

FYI - tests that rely on CHOLMOD should be marked with "testif HAVE_CHOLMOD", applied that change here

http://hg.savannah.gnu.org/hgweb/octave/rev/2c7acd39e9b7

Mike Miller <mtmiller>
Project Administrator
Tue Aug 9 23:10:03 2016, comment #4:

I have pushed the fix. Some notes of this fix:

  • sparse matrices that were previously identified as banded, but were banded AND lower/upper, are now upper or lower and not banded.
  • I noticed that non-sparse matrices do not check for banded matrices.

http://hg.savannah.gnu.org/hgweb/octave/rev/5417dad26a25

http://hg.savannah.gnu.org/hgweb/octave/rev/71d86e88589f

Note, I had to adjust the precision in one of your tests.

Carnë Draug <carandraug>
Project Member
Sat Aug 6 17:48:35 2016, comment #3:

I added some tests, you can look at it at my repository:
https://bitbucket.org/BarbaraLocsi/octave/commits/branch/barbara-chol2inv

Barbara Lócsi <bumi>
Tue Jul 26 12:53:33 2016, comment #2:

I couldn't find any tests for chol2inv. Could you write some before I push this?

Carnë Draug <carandraug>
Project Member
Sat Mar 12 22:03:35 2016, comment #1:

I can see it is still not working, (only the error is bit different)

The chol2inv function in sparse-chol.cc:526, requires the type of the matrix to be determined. If it is an upper or lower matrix than it determines the retval, but otherwise it gives this error.

This Y matrix is an upper matrix so i think the type of the matrix is determined incorrectly.
MatrixType.cc lines 340-364. If it is a banded matrix then the function won't check whether it is lower or upper matrix.
But in this case, this matrix (Y) is both banded and upper.

Temporarily I deleted the else from else if, so even thougth the matrix is both banded and upper/lower it will say it is upper/lower (before it said it is banded).
In this case there is no more error from chol2inv but it calculates wrong result.
The result of

is:

,while the result of

is:

I think the chol2inv calculates it wrongly.

It is: (inv(Y))' * inv(Y)
While it should be inv (Y'*Y)

(file #36613)

Barbara Lócsi <bumi>
Wed May 9 01:02:15 2012, original submission:

chol2inv seems not to work when the input is a sparse upper triangular matrix. For example:

n = 10;
X = spdiags(ones(n, 1) * [1 2 1], [-1 0 1], n, n);
Y = chol(X);
Z = chol2inv(Y)
error: chol2inv: spchol2inv requires triangular matrix

On the other hand,
Z = chol2inv(full(Y))
returns the expected result

Nir Krakauer <nir_krakauer>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #36613:  bug_36437.diff added by bumi (2kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bumi (Updated the item)
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by nir_krakauer (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Aug 9 23:10:03 2016carandraugStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Sat Mar 12 22:03:35 2016bumiAttached File-=>Added bug_36437.diff, #36613
    Mon Oct 28 02:33:21 2013mtmillerCategoryNone=>Octave Function
      Item GroupNone=>Incorrect Result
      StatusNone=>Confirmed
      Release3.6.1=>dev

    Back to the top


    Powered by Savane 3.1-cleanup1