[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'chol' 2nd output arg: funny output
From: |
David Bateman |
Subject: |
Re: 'chol' 2nd output arg: funny output |
Date: |
Wed, 23 Jun 2004 10:20:08 +0200 |
User-agent: |
Mutt/1.4.1i |
The oct-file chol.oct is in octave-forge in the directory
extra/linear-algebra. If you look you'll see that there is a user
defined type octave_tri defined in the file ov-re-tri.cc for upper and
lower triangular matrices. The Cholesky factorization is still done in
the same way as the original version in octave, so isn't any faster
but the final step for real matrices is to create a triangular matrix.
The octave_tri::print function adds the message you see.
What is the point of giving back a user type of a triangular matrix from
chol if it isn't any faster? Well the left division operator is defined!!
and so you don't need to do a factorization of the matrix to solution
a set of linear equations involving it... For example
b = rand(1000,10); a = rand(1000); a= a'*a;
tic; x = chol(a); y = x \ (x' \ b); toc
Runs on my machine in 3.06 seconds without the octave-forge version. While it
runs in 136 seconds with this version.
As for what is the second return argument of chol, reading the code it
is the flag "info" returned by "CHOL fact (m, info)". Reading
dbleCHOL.cc in the octave sources "info" is flag passed back by the
fortran lapack function dpotrf. Reading the dpotrf source
* INFO (output) INTEGER
* = 0: successful exit
* < 0: if INFO = -i, the i-th argument had an illegal value
* > 0: if INFO = i, the leading minor of order i is not
* positive definite, and the factorization could not be
* completed.
*
So if the second argument returned by chol is non zero you have problems!!
Regards
David
According to Michael Creel <address@hidden> (on 06/23/04):
> On Tuesday 22 June 2004 11:31, address@hidden wrote:
> > I'm using V2.1.57 Cygwin.
> >
> > Neither :> help chol
> > nor :> help -i chol
> > provide any info that 'chol' returns two outputs.
> >
> > The latter must be concluded from 'polyfit.m'
> > where 'chol' is called with two output
> > arguments.
> >
> > Can anybody give me something info about output B
> > of [ R, B ] = chol( A, 0 ) ?
> >
> > Thanks
> > Rolf Fabian fabian at ansci dot de
> >
> I was checking this out, and I'm a little surprised by the "Upper Triangular"
> message. What's its purpose?
>
> octave:1> a = rand(2,2)
> a =
>
> 0.81472 0.90579
> 0.13548 0.83501
>
> octave:2> a = a'*a
> a =
>
> 0.68213 0.85109
> 0.85109 1.51770
>
> octave:3> chol(a)
> ans =
>
> 0.82591 1.03049
> 0.00000 0.67512
> Upper Triangular
>
> octave:4>
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
--
David Bateman address@hidden
Motorola CRM +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------