Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 204 | chris | 1 | /******************************************************* |
| 2 | * |
||
| 3 | * Author: Shinsaku Hiura, Hirokazu Kato |
||
| 4 | * |
||
| 5 | * shinsaku@sys.es.osaka-u.ac.jp |
||
| 6 | * kato@sys.im.hiroshima-cu.ac.jp |
||
| 7 | * |
||
| 8 | * Revision: 2.1 |
||
| 9 | * Date: 99/07/16 |
||
| 10 | * |
||
| 11 | *******************************************************/ |
||
| 12 | |||
| 13 | #include <stdio.h> |
||
| 14 | #include <math.h> |
||
| 15 | #include <AR/matrix.h> |
||
| 16 | |||
| 17 | double arVecHousehold( ARVec *x ) |
||
| 18 | { |
||
| 19 | double s, t; |
||
| 20 | int i; |
||
| 21 | |||
| 22 | s = sqrt( arVecInnerproduct(x,x) ); |
||
| 23 | |||
| 24 | if( s != 0.0 ) { |
||
| 25 | if(x->v[0] < 0) s = -s; |
||
| 26 | x->v[0] += s; |
||
| 27 | t = 1 / sqrt(x->v[0] * s); |
||
| 28 | for( i = 0; i < x->clm; i++ ) { |
||
| 29 | x->v[i] *= t; |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | return(-s); |
||
| 34 | } |