Hi,

I wonder if someone could explain to me why the following program gives output

0.000000        -3.000000       -5.000000
-3.000000       -8.000000       -15.000000
-5.000000       -15.000000      -24.000000

from the definition of the Householder transformation used in the gsl manual, with tau=1.0 and v=(2.0, 3.0, 5.0) I would expect

-3.000000        -3.000000       -10.000000
-6.000000       -8.000000       -15.000000
-10.000000     -15.000000      -24.000000

it seems like gsl_linalg_householder_mh forces v(0)=1.0 is this correct? I guess there is no loss of generality but it seems odd, could some one explain to me?

__________________________



#include <gsl/gsl_matrix.h>
#include <gsl/gsl_linalg.h>
#include <stdio.h>

int main()
{
 gsl_vector* pgslvec;
 gsl_matrix* pgslmat;
 double tau=1.0;
 int i, j;

 pgslmat=gsl_matrix_alloc(3,3);
 pgslvec=gsl_vector_alloc(3);

 gsl_matrix_set_identity(pgslmat);

 gsl_vector_set(pgslvec, 0, 2.0);
 gsl_vector_set(pgslvec, 1, 3.0);
 gsl_vector_set(pgslvec, 2, 5.0);

 gsl_linalg_householder_mh(tau,pgslvec, pgslmat);

 for(i=0;i<3;i++)
   {
     printf("\n");
     for(j=0;j<3;j++)
   printf("%f\t",(float) gsl_matrix_get(pgslmat, i, j));
   }

 gsl_vector_free(pgslvec);
 gsl_matrix_free(pgslmat);
 return 0;
}



_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to