This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Trouble with Cholesky
- To: gsl-discuss at sources dot redhat dot com
- Subject: Trouble with Cholesky
- From: Frank Boehme <f dot boehme at cs dot ucc dot ie>
- Date: Tue, 24 Apr 2001 00:49:19 +0100
Hi gang,
I am new to gsl and I am not on the list. Please reply directly.
I have just started to write a library of Eiffel wrapper classes for GSL
and things are in fast progress. Actually, it turns out to be simpler
than I had feared.
But this drives me *nuts*: I can't get either of the two Cholesky
solvers to work. Don't lough, I am sure that I am missing something. In
fact, yesterday was the first time a looked at GSL. At any rate, here is
the problem (pure C only, simplified to isolate the problem):
#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 definite: */
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, 0, 3.0);
gsl_linalg_cholesky_svx (m, v);
printf("%g\n", gsl_vector_get (v, 0));
printf("%g\n", gsl_vector_get (v, 1));
}
No trouble with compiling and linking against the two libs.
But why ON EARTH does this program output
0.333333
0
and not
1.0
1.0
????
I get the same weird result when I use gsl_linalg_cholesky_solve. This
is with gsl-0.7. What am I missing?
Any comments are greatly appreciated,
Frank
--
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 |