cholinv/spcholinv return incorrect results

David Bateman dbateman at dbateman.org
Fri Dec 12 16:23:11 CST 2008


Gabriele Pannocchia wrote:
> Hi,
> 
> the following code shows for me a bug in cholinv when the argument is a
> sparse matrix.
> 
> A = [2,0.2;0.2,1];
> issymmetric(A)
> min(eig(A))
> Ainv = inv(A);
> Ainv1 = cholinv(A);
> Ainv2 = inv(sparse(A));
> Ainv3 = cholinv(sparse(A));
> Ainv4 = spcholinv(sparse(A));
> err1 = norm(Ainv-Ainv1)
> err2 = norm(Ainv-Ainv2)
> err3 = norm(Ainv-Ainv3)
> err4 = norm(Ainv-Ainv4)
> 
> I am using:
> 
> ----------------------------------------------------------------------
> GNU Octave Version 3.0.1
> GNU Octave License: GNU General Public License
> Operating System: Linux 2.6.24-1-686 #1 SMP Thu May 8 02:16:39 UTC 2008
> i686
> ----------------------------------------------------------------------
> 
> Can anyone reproduce this?


Yes I can and its my fault.. The reason is that I don't think cholinv 
was ever used for sparse matrices, as frankly it doesn't make much sense 
as the Finv function itself detects the PD matrix and does the right 
thing. I added the sparse cholinv code just for compatible with the full 
version of this function..

The attached patch fixes the issue against 3.1.51+ It should also be 
applied for 3.0.4

Cheers
David

-- 
David Bateman                                dbateman at dbateman.org
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch8911
Url: https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20081212/f76fbf35/attachment.ksh 


More information about the Bug-octave mailing list