1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
PROCEDURE mtt_sparse( b : StateVector;
n : integer;
VAR x : StateVector;
VAR rsq : real);
{*
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1 1998/08/13 08:40:40 peterg
## Initial revision
##
###############################################################
*}
(* Programs using routine SPARSE must define the type
|
|
|
|
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
PROCEDURE mtt_sparse( b : glnarray;
n : integer;
VAR x : glnarray;
VAR rsq : real);
{*
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1 1998/08/13 14:58:35 peterg
## Initial revision
##
## Revision 1.1 1998/08/13 08:40:40 peterg
## Initial revision
##
###############################################################
*}
(* Programs using routine SPARSE must define the type
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
aden := 0.0;
FOR j := 1 TO n DO BEGIN
anum := anum+g[j]*h[j];
aden := aden+sqr(xi[j])
END;
IF (aden = 0.0) THEN BEGIN
writeln('pause in routine SPARSE');
writeln('very singular matrix'); readln
END;
anum := anum/aden;
FOR j := 1 TO n DO BEGIN
xi[j] := x[j];
x[j] := x[j]+anum*h[j]
END;
mtt_asub(x,xj,n);
|
|
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
aden := 0.0;
FOR j := 1 TO n DO BEGIN
anum := anum+g[j]*h[j];
aden := aden+sqr(xi[j])
END;
IF (aden = 0.0) THEN BEGIN
writeln('pause in routine SPARSE');
writeln('very singular matrix'); {***readln ***}
END;
anum := anum/aden;
FOR j := 1 TO n DO BEGIN
xi[j] := x[j];
x[j] := x[j]+anum*h[j]
END;
mtt_asub(x,xj,n);
|
89
90
91
92
93
94
95
96
97
98
|
IF (gg = 0.0) THEN GOTO 99;
gam := dgg/gg;
FOR j := 1 TO n DO BEGIN
g[j] := -xi[j];
h[j] := g[j]+gam*h[j]
END
END;
writeln('pause in routine SPARSE');
writeln('too many iterations'); readln;
99: END;
|
|
|
>
>
|
|
92
93
94
95
96
97
98
99
100
101
102
103
|
IF (gg = 0.0) THEN GOTO 99;
gam := dgg/gg;
FOR j := 1 TO n DO BEGIN
g[j] := -xi[j];
h[j] := g[j]+gam*h[j]
END
END;
{***writeln('pause in routine SPARSE');
writeln('too many iterations'); readln; **}
99:{**writeln("---",iter,rsq);**}
END;
|