help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inverse matrix


From: David Bateman
Subject: Re: inverse matrix
Date: Mon, 29 Oct 2007 10:13:10 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Abdul Rahman Riza wrote:
> Hi Olaf,
>
> I found the same result compared to your 2.1.73 running on my ocatve
> 2.9.9 in ubuntu feisty fawn as stated below:
>
> octave:1> a = [1.2500e+02, 1.4595e+01, 5.8551e-08, 4.9222e+02;
> 1.4595e+01, 1.0320e+01, -2.2343e-12, 1.7402e+02; 5.8551e-08,
> -2.2343e-12, 5.8688e+03, -1.5056e-11; 4.9222e+02, 1.7402e+02,
> -1.5056e-11, 8.8034e+03]
> a =
>
>    1.2500e+02   1.4595e+01   5.8551e-08   4.9222e+02
>    1.4595e+01   1.0320e+01  -2.2343e-12   1.7402e+02
>    5.8551e-08  -2.2343e-12   5.8688e+03  -1.5056e-11
>    4.9222e+02   1.7402e+02  -1.5056e-11   8.8034e+03
>
> octave:2> [x,rcond]=inverse(a)
> x =
>
>    1.0634e-02  -7.5196e-03  -1.0610e-13  -4.4593e-04
>   -7.5196e-03   1.5066e-01   7.5071e-14  -2.5578e-03
>   -1.0610e-13   7.5071e-14   1.7039e-04   4.4484e-15
>   -4.4593e-04  -2.5578e-03   4.4484e-15   1.8909e-04
>
> rcond =  6.5696e-04
> octave:3>
>
> Regards,
> Riza
>
> On Mon, 2007-09-17 at 14:45 +0200, Ólafur Jens Sigurðsson wrote:
>> Hi
>>
>> I came across the following scenario:
>> For the following matrix
>>
>>  1.0634e-02   -7.5196e-03   -1.0610e-13   -4.4593e-04
>> -7.5196e-03    1.5066e-01    7.5071e-14   -2.5578e-03
>> -1.0610e-13    7.5071e-14     1.7039e-04    4.4484e-15
>> -4.4593e-04   -2.5578e-03    4.4484e-15    1.8909e-04
>>
>> the inverse in version 2.9.10 in debian produces rcond = 0 but in
>> 2.1.73 it is rcond = 0.00065696
>>
>> Does this happen in all machines or is this just me (a AMD Athlon
>> 1344 MHz, cpu family 6, model 8 ... info taken from /proc/cpuinfo
>> running debian unstable)?
>>
>> If this is a general thing, is there a reason for why the 2.9.10 is
>> worse in this then 2.1.73 (I would consider this to be worse, unless
>> 2.1.73 is just doing wrong calculation).
>>
>> Regards
>>
>> Oli
>>
>> ps, creat the matrix by the following command (set in so you can just
>> cut and paste)
>>
>> a = [1.2500e+02, 1.4595e+01, 5.8551e-08, 4.9222e+02; 1.4595e+01,
>> 1.0320e+01, -2.2343e-12, 1.7402e+02; 5.8551e-08, -2.2343e-12,
>> 5.8688e+03, -1.5056e-11; 4.9222e+02, 1.7402e+02, -1.5056e-11,
>> 8.8034e+03]
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden <mailto:address@hidden>
>> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>>     

This is a bug that was previously fixed. The reason for the bug is that
Octave now uses the matrix symmetry to accelerate the inverse if the
matrix is positive definite as it is in the above case. The correct
inverse was calculated with 2.9.10 (and faster than in 2.1.73) but the
rcond was not set.. The changelog entry that fixed this bug is


2007-04-04  David Bateman  <address@hidden>

        * dMatrix.cc (Matrix::inverse): If calc_cond is true, calculate
        the condition number for positive definite matrices.
        * CMatrix.cc (ComplexMatrix::inverse): Ditto.
        * dbleChol.h (CHOL(const Matrix&, bool)): New arg, calc_cond.
        (CHOL(const Matrix&, octave_idx_type&, bool): Ditto.
        (octave_idx_type init (const Matrix&, bool)): Ditto.
        (CHOL(const CHOL&)): Copy xrcond.
        (CHOL& operator = (const CHOL&)): Copy xrcond.
        (xrcond): New private data member.
        * CmplxCHOL.h (ComplexCHOL(const ComplexMatrix&, bool)): New arg,
        calc_cond.
        (ComplexCHOL(const ComplexMatrix&, octave_idx_type&, bool): Ditto
        (octave_idx_type init (const ComplexMatrix&, bool)): Ditto.
        (ComplexCHOL(const ComplexCHOL&)): Copy xrcond.
        (ComplexCHOL& operator = (const ComplexCHOL&)): Copy xrcond.
        (xrcond): New private data member.
        * dbleCHOL.cc (CHOL::init(const Matrix&, bool)): If calc_cond is
        true, calculate the condition number with dpocon.
        * CmplxCHOL.cc (ComplexCHOL::init(const ComplexMatrix&, bool)): If
        calc_cond is true, calculate the condition number with zpocon.

So yes it is a bug in 2.9.10 and yes it is fixed..

D.


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

[Prev in Thread] Current Thread [Next in Thread]