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

uses
  typ,
  iom,
  eig;

const
  n1 = -100;
  n2 = 100;
var
  ex, nex, nel, p, q, n, b, k1, k2, term: ArbInt;
  a:   array[n1..n2] of ArbFloat;
  lam: array[n1..n2] of ArbFloat;
begin
  Write(' program results eigbs2te');
  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 ex := 1 to nex do
  begin
    writeln('example number', ex: 2);
    writeln;
    Read(p, q, n, b, k1, k2);
    nel := n * (b + 1) - (b * (b + 1)) div 2;
    iomrev(input, a[p], nel);
    eigbs2(a[p], n, b, k1, k2, lam[q], term);
    writeln(' A = ');
    iomwrv(output, a[p], nel, numdig);
    writeln;
    writeln('term=', term: 2);
    if term = 1 then
    begin
      writeln;
      writeln('lambda=');
      iomwrv(output, lam[q], k2 - k1 + 1, numdig);
    end
    else
      writeln(' wrong input');
    writeln;
    writeln('-------------------------------------------');
  end;
  Close(input);
  Close(output);
end.
program eigbs2te;

uses
  typ,
  iom,
  eig;

const
  n1 = -100;
  n2 = 100;
var
  ex, nex, nel, p, q, n, b, k1, k2, term: ArbInt;
  a:   array[n1..n2] of ArbFloat;
  lam: array[n1..n2] of ArbFloat;
begin
  Write(' program results eigbs2te');
  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 ex := 1 to nex do
  begin
    writeln('example number', ex: 2);
    writeln;
    Read(p, q, n, b, k1, k2);
    nel := n * (b + 1) - (b * (b + 1)) div 2;
    iomrev(input, a[p], nel);
    eigbs2(a[p], n, b, k1, k2, lam[q], term);
    writeln(' A = ');
    iomwrv(output, a[p], nel, numdig);
    writeln;
    writeln('term=', term: 2);
    if term = 1 then
    begin
      writeln;
      writeln('lambda=');
      iomwrv(output, lam[q], k2 - k1 + 1, numdig);
    end
    else
      writeln(' wrong input');
    writeln;
    writeln('-------------------------------------------');
  end;
  Close(input);
  Close(output);
end.