This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Householder solver
- From: Henri Lindén <hlinden at cc dot helsinki dot fi>
- To: <gsl-discuss at sources dot redhat dot com>
- Date: Mon, 14 Jan 2002 12:23:34 +0200 (EET)
- Subject: Householder solver
Hi!
I am having problems with the Householder alogithm. Usually this is used
for overdetermined linear systems, i.e. systems in which
m > n, where A \in R^{m \times n}. Then how come i.e. the following code:
//=========================================================
gsl_matrix *a=gsl_matrix_alloc(5,3);
gsl_vector *b=gsl_vector_alloc(5);
gsl_vector *x=gsl_vector_calloc(3);
gsl_vector_set(b,0,2.0); gsl_vector_set(b,1,2.0);
gsl_vector_set(b,2,3.0); gsl_vector_set(b,3,5.0);
gsl_vector_set(b,4,6.0);
gsl_matrix_set(a,0,0,1.0); gsl_matrix_set(a,0,1,1.0);
gsl_matrix_set(a,0,2,1.0); gsl_matrix_set(a,1,0,1.0);
gsl_matrix_set(a,1,1,2.0); gsl_matrix_set(a,1,2,4.0);
gsl_matrix_set(a,2,0,1.0); gsl_matrix_set(a,2,1,3.0);
gsl_matrix_set(a,2,2,9.0); gsl_matrix_set(a,3,0,1.0);
gsl_matrix_set(a,3,1,3.0); gsl_matrix_set(a,3,2,9.0);
gsl_matrix_set(a,4,0,1.0); gsl_matrix_set(a,4,1,4.0);
gsl_matrix_set(a,4,2,16.0);
gsl_linalg_HH_solve(a,b,x);
//=============================================================
yields the following error message:
gsl: hh.c:41: ERROR: System is underdetermined
Aborted
???
Usually the first dimension refers to row dimension and the second to
columns, which is exactly as things generally are done in GSL. Thus my
example system should by all means be overdetermined with 5 equalities and
3 variables. However the Householder solver seems to disagree!
O========================================================================O
O Henri Lindén address: Korkeavuorenkatu 4 A 5 O
O Department of Mathematics 00150 Helsinki O
O University of Helsinki email: hlinden@cc.helsinki.fi O
O to work: +358 (0)9-191 23207 O
O cellphone: +358 (0)50-5884288 O
O========================================================================O