1
/* housev.c CCMATH mathematics library source code.
3
* Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
4
* This code may be redistributed under the terms of the GNU library
5
* public license (LGPL). ( See the lgpl.license file for details.)
6
* ------------------------------------------------------------------------
10
void housev(double *a, double *d, double *dp, int n)
16
double *qw, *qs, *pc, *p;
18
qs = (double *)calloc(n, sizeof(double));
19
for (j = 0, pc = a; j < n - 2; ++j, pc += n + 1) {
21
for (i = 1, sc = 0.; i <= m; ++i)
25
if ((x = *(pc + 1)) < 0.) {
27
h = 1. / sqrt(-2. * sc * y);
31
h = 1. / sqrt(2. * sc * y);
34
for (i = 0, qw = pc + 1; i < m; ++i) {
41
for (i = 0, e = j + 2, p = pc + n + 1, h = 0.; i < m;
43
qs[i] += (y = qw[i]) * *p++;
44
for (k = i + 1; k < m; ++k) {
50
for (i = 0; i < m; ++i) {
54
for (i = 0, e = j + 2, p = pc + n + 1; i < m; ++i, p += e++) {
55
for (k = i; k < m; ++k)
56
*p++ -= qw[i] * qs[k] + qs[i] * qw[k];
64
d[j + 1] = *(pc += n + 1);
66
for (i = 0, m = n + n, p = pc; i < m; ++i)
71
for (m = 2; m < n; ++m, qw -= n + 1) {
72
for (j = 0, p = pc, *pc = 1.; j < m; ++j, p += n) {
73
for (i = 0, qs = p, h = 0.; i < m;)
75
for (i = 0, qs = p, h += h; i < m;)
78
for (i = 0, p = qw + m; i < n; ++i)