summaryrefslogtreecommitdiff
path: root/packages/extra/numlib/tests/eiggg2te.pas
blob: e6ac0645857e3db0789dd376d8d09d1424a6810f (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
program eiggg2te;

uses
  typ,
  eig,
  iom;

const
  m1 = -9;
  m2 = 5;
  n1 = -10;
  n2 = 8;
  n3 = -7;
  n4 = 6;
var
  i, j, l, nex, k1, k2, i1, j1, i2, j2, n, term: ArbInt;
  a:   array[m1..m2, n1..n2] of ArbFloat;
  b:   array[m1..m2, n3..n4] of ArbFloat;
  lam: array[m1..m2] of ArbFloat;
begin
  Write(' program results eiggg2te');
  case sizeof(ArbFloat) of
    4: writeln('(single)');
    6: writeln('(real)');
    8: writeln('(double)');
  end;
  Read(nex);
  writeln;
  writeln('number of examples', nex: 2);
  writeln;
  for l := 1 to nex do
  begin
    writeln('example number', l: 2);
    writeln;
    Read(i1, j1, i2, j2, n, k1, k2);
    for i := 1 to n do
      for j := 1 to i do
        Read(a[i1 + i - 1, j1 + j - 1]);
    for i := 1 to n do
      for j := 1 to i do
        Read(b[i2 + i - 1, j2 + j - 1]);
    eiggg2(a[i1, j1], n, n2 - n1 + 1, k1, k2, b[i2, j2], n4 - n3 + 1,
      lam[i1 + k1 - 1], term);
    writeln;
    writeln('A=');
    writeln;
    for i := 1 to n do
      iomwrv(output, a[i1 + i - 1, j1], i, numdig);
    writeln;
    writeln('B=');
    writeln;
    for i := 1 to n do
      iomwrv(output, b[i2 + i - 1, j2], i, numdig);
    writeln;
    writeln('term=', term: 2);
    writeln;
    if term = 1 then
    begin
      writeln('lambda', k1: 2, ' t/m', k2: 2, ' = ');
      iomwrv(output, lam[i1 + k1 - 1], k2 - k1 + 1, numdig);
    end;
    writeln;
    writeln('-------------------------------------------');
  end;
  Close(input);
  Close(output);
end.
program eiggg2te;

uses
  typ,
  eig,
  iom;

const
  m1 = -9;
  m2 = 5;
  n1 = -10;
  n2 = 8;
  n3 = -7;
  n4 = 6;
var
  i, j, l, nex, k1, k2, i1, j1, i2, j2, n, term: ArbInt;
  a:   array[m1..m2, n1..n2] of ArbFloat;
  b:   array[m1..m2, n3..n4] of ArbFloat;
  lam: array[m1..m2] of ArbFloat;
begin
  Write(' program results eiggg2te');
  case sizeof(ArbFloat) of
    4: writeln('(single)');
    6: writeln('(real)');
    8: writeln('(double)');
  end;
  Read(nex);
  writeln;
  writeln('number of examples', nex: 2);
  writeln;
  for l := 1 to nex do
  begin
    writeln('example number', l: 2);
    writeln;
    Read(i1, j1, i2, j2, n, k1, k2);
    for i := 1 to n do
      for j := 1 to i do
        Read(a[i1 + i - 1, j1 + j - 1]);
    for i := 1 to n do
      for j := 1 to i do
        Read(b[i2 + i - 1, j2 + j - 1]);
    eiggg2(a[i1, j1], n, n2 - n1 + 1, k1, k2, b[i2, j2], n4 - n3 + 1,
      lam[i1 + k1 - 1], term);
    writeln;
    writeln('A=');
    writeln;
    for i := 1 to n do
      iomwrv(output, a[i1 + i - 1, j1], i, numdig);
    writeln;
    writeln('B=');
    writeln;
    for i := 1 to n do
      iomwrv(output, b[i2 + i - 1, j2], i, numdig);
    writeln;
    writeln('term=', term: 2);
    writeln;
    if term = 1 then
    begin
      writeln('lambda', k1: 2, ' t/m', k2: 2, ' = ');
      iomwrv(output, lam[i1 + k1 - 1], k2 - k1 + 1, numdig);
    end;
    writeln;
    writeln('-------------------------------------------');
  end;
  Close(input);
  Close(output);
end.