Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Dynlift/driver_for_minkowski_polynomials.adb, Revision 1.1.1.1
1.1 maekawa 1: with integer_io; use integer_io;
2: with Timing_Package; use Timing_Package;
3: with Standard_Complex_Numbers; use Standard_Complex_Numbers;
4: with Standard_Integer_Vectors_io; use Standard_Integer_Vectors_io;
5: with Standard_Complex_Polynomials; use Standard_Complex_Polynomials;
6: with Integer_Mixed_Subdivisions_io; use Integer_Mixed_Subdivisions_io;
7: with Minkowski_Polynomials; use Minkowski_Polynomials;
8:
9: procedure Driver_for_Minkowski_Polynomials
10: ( file : in file_type;
11: n : in natural; mix : in Vector; t : in Triangulation;
12: alltri : in boolean; mixsub : out Mixed_Subdivision ) is
13:
14: mp : Poly;
15: timer : timing_widget;
16:
17: procedure Coefficient_Subdivision
18: ( submix : in Vector; sub : in Mixed_Subdivision;
19: vol : out natural ) is
20:
21: len : constant natural := Length_Of(sub);
22: wrksub : Mixed_Subdivision := sub;
23: volu : natural;
24:
25: begin
26: put(file,"#Cells of type "); put(file,submix); put(file," is " );
27: put(file,len,1); new_line(file);
28: if len = 0
29: then volu := 0;
30: else put(file,n,submix,wrksub,volu);
31: end if;
32: put(file,"The volume equals : "); put(file,volu,1); new_line(file);
33: new_line(file);
34: vol := volu;
35: end Coefficient_Subdivision;
36: procedure Coefficient_Subdivisions is
37: new Minkowski_Polynomial_Subdivisions(Coefficient_Subdivision);
38:
39: procedure Write_Minkowski_Polynomial ( file : in file_type; p : in Poly ) is
40:
41: first : boolean;
42: cnt : natural := 0;
43:
44: procedure Minkowski_Term ( t : in Term; cont : out boolean ) is
45: begin
46: if first
47: then first := false;
48: else put(file," + "); cnt := cnt + 3;
49: end if;
50: put(file,integer(REAL_PART(t.cf)),1); cnt := cnt + 2;
51: for i in t.dg'range loop
52: if t.dg(i) /= 0
53: then put(file,"*l"); put(file,i,1); cnt := cnt + 3;
54: if t.dg(i) /= 1
55: then put(file,"^"); put(file,t.dg(i),1);
56: cnt := cnt + 2;
57: end if;
58: end if;
59: end loop;
60: if cnt > 60
61: then new_line(file); cnt := 0;
62: end if;
63: cont := true;
64: end Minkowski_Term;
65: procedure Minkowski_Terms is new Visiting_Iterator(Minkowski_Term);
66:
67: begin
68: Minkowski_Terms(p);
69: end Write_Minkowski_Polynomial;
70:
71: begin
72: tstart(timer);
73: mp := Minkowski_Polynomial(n,mix'last);
74: if not alltri
75: then Minkowski_Polynomial(mp,t,n,mix,mixsub);
76: else Coefficient_Subdivisions(mp,t,n,mix,mixsub);
77: end if;
78: tstop(timer);
79: put_line(file,"the Minkowski-polynomial : ");
80: Write_Minkowski_Polynomial(file,mp);
81: new_line(file);
82: new_line(file);
83: print_times(file,timer,"computing the Minkowski-polynomial");
84: Clear(mp);
85: end Driver_for_Minkowski_Polynomials;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>