summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/numlib/tests/detgpdte.pas
blob: a7f385b37d1fe48fd5fc30085e4657260200e750 (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
program detgpdte;

uses
  typ,
  iom,
  det;

const
  n1  = -5;
  n2  = 10;
  rwa = n2 - n1 + 1;
var
  e, t, aantal, i, j, k, l, n, term: ArbInt;
  d: ArbFloat;
  a: array[n1..n2, n1..n2] of ArbFloat;
begin
  iom.npos := 1000;        {max. width of output to 1000, since this is piped}
  Write(' program results detgpdte');
  case sizeof(ArbFloat) of
    4: writeln('(single)');
    6: writeln('(real)');
    8: writeln('(double)');
    10: writeln('(Extended)');
  end;
  Read(aantal);
  writeln;
  writeln('  number of examples : ', aantal: 3);
  for t := 1 to aantal do
  begin
    writeln;
    writeln('       example nr ', t: 3);
    Read(k, l, n);
    for i := 1 to n do
      for j := 1 to i do
        Read(a[k + i - 1, l + j - 1]);
    detgpd(n, rwa, a[k, l], d, e, term);
    writeln;
    writeln(' A =');
    for i := 1 to n do
      for j := 1 to i - 1 do
        a[k + j - 1, l + i - 1] := a[k + i - 1, l + j - 1];
    iomwrm(output, a[k, l], n, n, n2 - n1 + 1, numdig);
    writeln;
    writeln('term=', term: 2);
    writeln;
    if term = 3 then
      writeln(' wrong input')
    else
    if term = 2 then
      writeln(' matrix not pos-def')
    else
    begin
      Write(' det =', d: numdig);
      if e <> 0 then
        Write(' * 8**', e: 3);
      writeln;
    end; {term=1}
    writeln('------------------------------------------------------');
  end; {t}
  Close(input);
  Close(output);
end.
program detgpdte;

uses
  typ,
  iom,
  det;

const
  n1  = -5;
  n2  = 10;
  rwa = n2 - n1 + 1;
var
  e, t, aantal, i, j, k, l, n, term: ArbInt;
  d: ArbFloat;
  a: array[n1..n2, n1..n2] of ArbFloat;
begin
  iom.npos := 1000;        {max. width of output to 1000, since this is piped}
  Write(' program results detgpdte');
  case sizeof(ArbFloat) of
    4: writeln('(single)');
    6: writeln('(real)');
    8: writeln('(double)');
    10: writeln('(Extended)');
  end;
  Read(aantal);
  writeln;
  writeln('  number of examples : ', aantal: 3);
  for t := 1 to aantal do
  begin
    writeln;
    writeln('       example nr ', t: 3);
    Read(k, l, n);
    for i := 1 to n do
      for j := 1 to i do
        Read(a[k + i - 1, l + j - 1]);
    detgpd(n, rwa, a[k, l], d, e, term);
    writeln;
    writeln(' A =');
    for i := 1 to n do
      for j := 1 to i - 1 do
        a[k + j - 1, l + i - 1] := a[k + i - 1, l + j - 1];
    iomwrm(output, a[k, l], n, n, n2 - n1 + 1, numdig);
    writeln;
    writeln('term=', term: 2);
    writeln;
    if term = 3 then
      writeln(' wrong input')
    else
    if term = 2 then
      writeln(' matrix not pos-def')
    else
    begin
      Write(' det =', d: numdig);
      if e <> 0 then
        Write(' * 8**', e: 3);
      writeln;
    end; {term=1}
    writeln('------------------------------------------------------');
  end; {t}
  Close(input);
  Close(output);
end.