help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] [Fwd: gsl_linalg_householder_mh question]


From: William Astle
Subject: [Help-gsl] [Fwd: gsl_linalg_householder_mh question]
Date: Fri, 31 Aug 2007 13:09:35 +0100
User-agent: Thunderbird 2.0.0.5 (X11/20070724)

I apologise for the error in the original message, please see the corrected version below.

Cheers for help


Will

-------- Original Message --------
Message-ID:     <address@hidden>
Date:   Fri, 31 Aug 2007 13:05:18 +0100
From:   William Astle <address@hidden>
User-Agent:     Thunderbird 2.0.0.5 (X11/20070724)
MIME-Version:   1.0
To:     address@hidden
Subject:        gsl_linalg_householder_mh question
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:      7bit



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        -6.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;
}







reply via email to

[Prev in Thread] Current Thread [Next in Thread]