开发者

Building a 3x3 reflection matrix using GSL

开发者 https://www.devze.com 2023-01-10 00:34 出处:网络
Based on the documents http://www.gnu.org/software/gsl/manual/html_node/Householder-Transformations.html

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.]


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

0

精彩评论

暂无评论...
验证码 换一张
取 消