Annotation of OpenXM_contrib/PHC/Ada/Schubert/ts_brackpols.adb, Revision 1.1.1.1
1.1 maekawa 1: with text_io,integer_io; use text_io,integer_io;
2: with Complex_Numbers; use Complex_Numbers;
3: with Brackets,Brackets_io; use Brackets,Brackets_io;
4: with Bracket_Monomials; use Bracket_Monomials;
5: with Bracket_Monomials_io; use Bracket_Monomials_io;
6: with Bracket_Polynomials; use Bracket_Polynomials;
7: with Bracket_Polynomials_io; use Bracket_Polynomials_io;
8:
9: procedure ts_brackpols is
10:
11: procedure Compare ( p : in Bracket_Polynomial; t : in Bracket_Term ) is
12:
13: -- DESCRIPTION :
14: -- Compares every monomial in p with the term t.
15:
16: procedure Compare ( tt : in Bracket_Term; continue : out boolean ) is
17: begin
18: if tt < t
19: then put(tt); put(" < "); put(t);
20: elsif tt > t
21: then put(tt); put(" > "); put(t);
22: else put(tt); put(" = "); put(t);
23: end if;
24: new_line;
25: if tt > t
26: then put(tt); put(" > "); put(t);
27: elsif tt < t
28: then put(tt); put(" < "); put(t);
29: else put(tt); put(" = "); put(t);
30: end if;
31: new_line;
32: continue := true;
33: end Compare;
34: procedure Compare_Terms is new Enumerate_Terms(Compare);
35:
36: begin
37: Compare_Terms(p);
38: end Compare;
39:
40: procedure Interactive_Read ( d : in natural; t : out Bracket_Term ) is
41:
42: m : natural;
43: b : Bracket(1..d);
44: s,c : integer;
45: bm : Bracket_Monomial;
46:
47: begin
48: c := 1;
49: put("Give the number of brackets in the monomial : "); get(m);
50: for i in 1..m loop
51: put("Give "); put(d,1); put(" numbers for the ");
52: put(i,1); put("th bracket : "); get(b,s);
53: c := s*c;
54: Multiply(bm,b);
55: end loop;
56: put_line("The bracket monomial : "); put(bm); new_line;
57: if c > 0
58: then t.coeff := CMPLX(1.0);
59: else t.coeff := -CMPLX(1.0);
60: end if;
61: t.monom := bm;
62: end Interactive_Read;
63:
64: procedure Interactive_Read ( d : in natural; p : out Bracket_Polynomial ) is
65:
66: m : natural;
67: bp : Bracket_Polynomial;
68:
69: begin
70: put_line("Reading a bracket polynomial.");
71: put("Give the number of monomials : "); get(m);
72: for i in 1..m loop
73: declare
74: bt : Bracket_Term;
75: begin
76: put("Reading bracket monomial "); put(i,1); new_line;
77: Interactive_Read(d,bt);
78: put_line("The bracket term : "); put(bt);
79: Compare(bp,bt);
80: Add(bp,bt);
81: put_line("The bracket polynomial : "); put(bp);
82: end;
83: end loop;
84: p := bp;
85: end Interactive_Read;
86:
87: procedure Main is
88:
89: d : natural;
90: bp : Bracket_Polynomial;
91:
92: begin
93: put("Give the number of entries in the brackets : "); get(d);
94: Interactive_Read(d,bp);
95: put_line("The bracket polynomial : "); put(bp);
96: end Main;
97:
98: begin
99: Main;
100: end ts_brackpols;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>