Go to the source code of this file.
|
int | dsvd (double **a, int m, int n, double *w, double **v) |
|
◆ ASCII_TEXT_BORDER_WIDTH
#define ASCII_TEXT_BORDER_WIDTH 4 |
◆ BACKWARD
◆ False
◆ FORWARD
◆ MAX
#define MAX |
( |
|
x, |
|
|
|
y |
|
) |
| ((x)>(y)?(x):(y)) |
◆ MAXHIST
◆ MAXINT
#define MAXINT 2147483647 |
◆ MIN
#define MIN |
( |
|
x, |
|
|
|
y |
|
) |
| ( (x) < (y) ? (x) : (y) ) |
◆ PRECISION1
◆ PRECISION2
◆ PROJ_DIM
◆ SIGN
#define SIGN |
( |
|
a, |
|
|
|
b |
|
) |
| ((b) >= 0.0 ? fabs(a) : -fabs(a)) |
◆ STEP0
◆ True
◆ hist_rec
◆ dsvd()
int dsvd |
( |
double ** |
a, |
|
|
int |
m, |
|
|
int |
n, |
|
|
double * |
w, |
|
|
double ** |
v |
|
) |
| |
Definition at line 38 of file ALFA_SvdCalc.cxx.
42 double anorm = 0.0,
g = 0.0,
scale = 0.0;
47 fprintf(
stderr,
"#rows must be > #cols \n");
54 for (
i = 0;
i <
n;
i++)
62 for (
k =
i;
k <
m;
k++)
66 for (
k =
i;
k <
m;
k++)
77 for (j =
l; j <
n; j++)
79 for (
s = 0.0,
k =
i;
k <
m;
k++)
82 for (
k =
i;
k <
m;
k++)
86 for (
k =
i;
k <
m;
k++)
94 if (
i <
m &&
i !=
n - 1)
96 for (
k =
l;
k <
n;
k++)
100 for (
k =
l;
k <
n;
k++)
109 for (
k =
l;
k <
n;
k++)
110 rv1[
k] = (
double)
a[
i][
k] /
h;
113 for (j =
l; j <
m; j++)
115 for (
s = 0.0,
k =
l;
k <
n;
k++)
117 for (
k =
l;
k <
n;
k++)
118 a[j][
k] += (
double)(
s * rv1[
k]);
121 for (
k =
l;
k <
n;
k++)
125 anorm =
MAX(anorm, (fabs((
double)
w[
i]) + fabs(rv1[
i])));
129 for (
i =
n - 1;
i >= 0;
i--)
135 for (j =
l; j <
n; j++)
138 for (j =
l; j <
n; j++)
140 for (
s = 0.0,
k =
l;
k <
n;
k++)
142 for (
k =
l;
k <
n;
k++)
146 for (j =
l; j <
n; j++)
147 v[
i][j] =
v[j][
i] = 0.0;
155 for (
i =
n - 1;
i >= 0;
i--)
160 for (j =
l; j <
n; j++)
167 for (j =
l; j <
n; j++)
169 for (
s = 0.0,
k =
l;
k <
m;
k++)
172 for (
k =
i;
k <
m;
k++)
176 for (j =
i; j <
m; j++)
181 for (j =
i; j <
m; j++)
188 for (
k =
n - 1;
k >= 0;
k--)
190 for (its = 0; its < 30; its++)
193 for (
l =
k;
l >= 0;
l--)
196 if (fabs(rv1[
l]) + anorm == anorm)
201 if (fabs((
double)
w[
nm]) + anorm == anorm)
208 for (
i =
l;
i <=
k;
i++)
211 if (fabs(
f) + anorm != anorm)
219 for (j = 0; j <
m; j++)
235 for (j = 0; j <
n; j++)
236 v[j][
k] = (-
v[j][
k]);
242 fprintf(
stderr,
"No convergence after 30,000! iterations \n");
252 f = ((
y -
z) * (
y +
z) + (
g -
h) * (
g +
h)) / (2.0 *
h *
y);
258 for (j =
l; j <=
nm; j++)
273 for (jj = 0; jj <
n; jj++)
288 f = (
c *
g) + (
s *
y);
289 x = (
c *
y) - (
s *
g);
290 for (jj = 0; jj <
m; jj++)