This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: Trouble with Cholesky
- To: Frank Boehme <f dot boehme at cs dot ucc dot ie>
- Subject: Re: Trouble with Cholesky
- From: Brian Gough <bjg at network-theory dot co dot uk>
- Date: Tue, 24 Apr 2001 10:02:50 +0100 (BST)
- Cc: gsl-discuss at sources dot redhat dot com
- References: <3AE4BF7F.875FB5B0@cs.ucc.ie><3AE4CCC8.FEC94085@cs.ucc.ie>
- Reply-To: gsl-discuss at sources dot redhat dot com
Hi,
The matrix needs to be decomposed into Cholesky form -- if you
add gsl_linalg_cholesky_decomp (m); before calling the solver it
should work. I'll try to make that clearer in the documentation.
regards
Brian Gough
Frank Boehme writes:
> Frank Boehme wrote:
>
> Ok, I made a mistake:
>
> > gsl_vector_set (v, 0, 3.0);
> > gsl_vector_set (v, 0, 3.0);
> ^^^
>
> But anyway, I believe there is a bug in the Cholesky algorithms. Here is
> the correct demo. Householder works, Cholesky doesn't:
>
> ======cut=here=====
>
> #include <stdio.h>
> #include <gsl/gsl_linalg.h>
> int main() {
> gsl_matrix * m = gsl_matrix_alloc (2, 2);
> gsl_vector * v = gsl_vector_alloc (2);
> /* this matrix is symmetrical and positiv definit: */
> gsl_matrix_set (m, 0, 0, 3.0);
> gsl_matrix_set (m, 0, 1, 0.0);
> gsl_matrix_set (m, 1, 0, 0.0);
> gsl_matrix_set (m, 1, 1, 3.0);
> gsl_vector_set (v, 0, 3.0);
> gsl_vector_set (v, 1, 3.0);
> /* uncomment one of the following two lines to see the difference */
> gsl_linalg_cholesky_svx (m, v);
> /* gsl_linalg_HH_svx (m, v); */
> printf("%g\n", gsl_vector_get (v, 0));
> printf("%g\n", gsl_vector_get (v, 1));
> }
>
> ======end===========
>
> --
> Dr Frank Boehme | Email: f.boehme@cs.ucc.ie
> National University of Ireland, Cork | phone: +353-21-4903163
> Dept of Computer Science | fax: +353-21-4903113
> Cork, Ireland |