views:

34

answers:

1

Based on the documents

http://www.gnu.org/software/gsl/manual/html_node/Householder-Transformations.html

and

http://en.wikipedia.org/wiki/Householder_transformation

I figured the following code would successfully produce the matrix for reflection in the plane orthogonal to the unit vector normal_vector.

gsl_matrix * reflection = gsl_matrix_alloc(3, 3);
gsl_matrix_set_identity(reflection);
gsl_linalg_householder_hm(2, normal_vector, reflection);

However, the result is not a reflection matrix as far as I can tell. In particular in my case it has the real eigenvalue -(2 + 1/3), which is impossible for a reflection matrix.

So my questions are:

(1) What am I doing wrong? It seems like that should work to me.

(2) If that approach doesn't work, does anyone know how to go about building such a matrix using gsl?

[As a final note, I realize gsl provides functions for applying Householder transformations without actually finding the matrices. I actually need the matrices in my case for other work.]

+1  A: 

reflection matrix, P, is never formed. Instead you get v as in P = I - \tau v v^T.

gsl_linalg_householder_hm applies PA transformation, you must generate v first with gsl_linalg_householder_transform

aaa
You're right. I suppose this is a case of me not comprehending the documentation at all. I still feel that documentation is confusing, so maybe this question will help someone else out in the future.
Zach Conn
@Zac I agree. Documentation looks upside down, confuse me too
aaa