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