[BACK]Return to drivers_for_static_lifting.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Stalift

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Stalift/drivers_for_static_lifting.adb, Revision 1.1

1.1     ! maekawa     1: with integer_io;                         use integer_io;
        !             2: with Communications_with_User;           use Communications_with_User;
        !             3: with Timing_Package;                     use Timing_Package;
        !             4: with Standard_Floating_Numbers;          use Standard_Floating_Numbers;
        !             5: with Standard_Complex_Numbers;           use Standard_Complex_Numbers;
        !             6: with Standard_Integer_Vectors;           use Standard_Integer_Vectors;
        !             7: with Standard_Integer_Vectors_io;        use Standard_Integer_Vectors_io;
        !             8: with Standard_Floating_Vectors;
        !             9: with Standard_Floating_Vectors_io;       use Standard_Floating_Vectors_io;
        !            10: with Standard_Complex_Vectors;
        !            11: with Standard_Complex_Vectors_io;        use Standard_Complex_Vectors_io;
        !            12: with Standard_Integer_VecVecs;
        !            13: with Standard_Integer_VecVecs_io;        use Standard_Integer_VecVecs_io;
        !            14: with Standard_Floating_VecVecs;
        !            15: with Standard_Complex_VecVecs;
        !            16: with Standard_Complex_Poly_Systems_io;   use Standard_Complex_Poly_Systems_io;
        !            17: with Standard_Complex_Laur_Polys;        use Standard_Complex_Laur_Polys;
        !            18: with Standard_Complex_Laur_Functions;    use Standard_Complex_Laur_Functions;
        !            19: with Standard_Complex_Laur_Systems;      use Standard_Complex_Laur_Systems;
        !            20: with Standard_Complex_Laur_SysFun;       use Standard_Complex_Laur_SysFun;
        !            21: with Standard_Complex_Laur_Jacomats;     use Standard_Complex_Laur_Jacomats;
        !            22: with Exponent_Vectors;                   use Exponent_Vectors;
        !            23: with Standard_Poly_Laur_Convertors;      use Standard_Poly_Laur_Convertors;
        !            24: with Standard_Laur_Poly_Convertors;      use Standard_Laur_Poly_Convertors;
        !            25: with Lists_of_Integer_Vectors;           use Lists_of_Integer_Vectors;
        !            26: with Lists_of_Integer_Vectors_io;        use Lists_of_Integer_Vectors_io;
        !            27: with Arrays_of_Integer_Vector_Lists;     use Arrays_of_Integer_Vector_Lists;
        !            28: with Arrays_of_Integer_Vector_Lists_io;  use Arrays_of_Integer_Vector_Lists_io;
        !            29: with Arrays_of_Floating_Vector_Lists;    use Arrays_of_Floating_Vector_Lists;
        !            30: with Floating_Integer_Convertors;        use Floating_Integer_Convertors;
        !            31: with Integer_Faces_of_Polytope;
        !            32: with Floating_Faces_of_Polytope;
        !            33: with Standard_Complex_Solutions;         use Standard_Complex_Solutions;
        !            34: with Standard_Complex_Solutions_io;      use Standard_Complex_Solutions_io;
        !            35: with Power_Lists;                        use Power_Lists;
        !            36: with Transforming_Integer_Vector_Lists;  use Transforming_Integer_Vector_Lists;
        !            37: with Integer_Mixed_Subdivisions;
        !            38: with Integer_Mixed_Subdivisions_io;      use Integer_Mixed_Subdivisions_io;
        !            39: with Floating_Mixed_Subdivisions;
        !            40: with Floating_Mixed_Subdivisions_io;     use Floating_Mixed_Subdivisions_io;
        !            41: with Mixed_Volume_Computation;           use Mixed_Volume_Computation;
        !            42: with Integer_Lifting_Functions;          use Integer_Lifting_Functions;
        !            43: with Integer_Lifting_Utilities;          use Integer_Lifting_Utilities;
        !            44: with Floating_Lifting_Functions;         use Floating_Lifting_Functions;
        !            45: with Floating_Lifting_Utilities;         use Floating_Lifting_Utilities;
        !            46: with Integer_Pruning_Methods;            use Integer_Pruning_Methods;
        !            47: with Floating_Pruning_Methods;           use Floating_Pruning_Methods;
        !            48: with Driver_for_Criterion;
        !            49: with Drivers_for_Lifting_Functions;      use Drivers_for_Lifting_Functions;
        !            50: with Pruning_Statistics;
        !            51: with Integer_Polyhedral_Continuation;    use Integer_Polyhedral_Continuation;
        !            52: with Floating_Polyhedral_Continuation;   use Floating_Polyhedral_Continuation;
        !            53: --with Power_Polyhedral_Continuation;      use Power_Polyhedral_Continuation;
        !            54: with Driver_for_Polyhedral_Continuation;
        !            55:
        !            56: package body Drivers_for_Static_Lifting is
        !            57:
        !            58:   procedure Static_Lifting_Info is
        !            59:
        !            60:     i : array(1..11) of string(1..65);
        !            61:
        !            62:   begin
        !            63:     i( 1):="  Static lifting is a  general  procedure  to  construct  regular";
        !            64:     i( 2):="mixed  subdivisions  of  a tuple of polytopes.   For mixed-volume";
        !            65:     i( 3):="computation, only those cells that are  spanned  by  a  tuple  of";
        !            66:     i( 4):="edges  contribute  to  the mixed volume.  These cells are the so-";
        !            67:     i( 5):="called mixed cells in the subdivision.  The collection  of  mixed";
        !            68:     i( 6):="cells  is  computed  efficiently by pruning in the tree of lifted";
        !            69:     i( 7):="edge-edge combinations.                                          ";
        !            70:     i( 8):="  These mixed cells provide the start systems in  the  polyhedral";
        !            71:     i( 9):="homotopy methods used to solve a random coefficient start system.";
        !            72:     i(10):="Recursion is applied in case the lifting does not induce at  once";
        !            73:     i(11):="a fine mixed subdivision.                                        ";
        !            74:     for k in i'range loop
        !            75:       put_line(i(k));
        !            76:     end loop;
        !            77:   end Static_Lifting_Info;
        !            78:
        !            79:   procedure Driver_for_Mixed_Volume_Computation
        !            80:                ( file : in file_type; p : in Poly_Sys; byebye : in boolean;
        !            81:                  q : out Poly_Sys; qsols : out Solution_List;
        !            82:                  mv : out natural ) is
        !            83:
        !            84:     welcome : constant string := "Mixed-Volume Computation by Static Lifting";
        !            85:
        !            86:     permp : Poly_Sys(p'range);          -- permuted system
        !            87:     tmv,nbcells : natural;
        !            88:     mix : Standard_Integer_Vectors.Link_to_Vector;
        !            89:     imixsub : Integer_Mixed_Subdivisions.Mixed_Subdivision;
        !            90:     fmixsub : Floating_Mixed_Subdivisions.Mixed_Subdivision;
        !            91:
        !            92:    -- the switches, to do or not to do, if true then :
        !            93:
        !            94:     compmix   : boolean;   -- compute the type of mixture
        !            95:     compmisu  : boolean;   -- compute the subdivision
        !            96:     report    : boolean;   -- report during creation of the subdivision
        !            97:     misufile  : boolean;   -- put the subdivision on separate file
        !            98:     tosolve   : boolean;   -- solve the system
        !            99:     ranstart  : boolean;   -- construct random coefficient start system
        !           100:     contrep   : boolean;   -- intermediate output during continuation
        !           101:
        !           102:    -- the files :
        !           103:
        !           104:     solsft,gft : file_type;
        !           105:
        !           106:   -- AUXILIARIES :
        !           107:
        !           108:     function Select_Terms
        !           109:                  ( p : Poly_Sys; mix : Standard_Integer_Vectors.Vector;
        !           110:                    pts : Arrays_of_Integer_Vector_Lists.Array_of_Lists )
        !           111:                  return Poly_Sys is
        !           112:
        !           113:     -- DESCRIPTION :
        !           114:     --   Returns those terms of p whose exponents belong to the lists pts.
        !           115:     --   The type of mixture is in mix and pts'range = mix'range.
        !           116:
        !           117:       res : Poly_Sys(p'range);
        !           118:       ind : natural := 0;
        !           119:
        !           120:     begin
        !           121:       for i in pts'range loop
        !           122:         for j in 1..mix(i) loop
        !           123:           ind := ind + 1;
        !           124:           res(ind) := Select_Terms(p(ind),pts(i));
        !           125:         end loop;
        !           126:       end loop;
        !           127:       return res;
        !           128:     end Select_Terms;
        !           129:
        !           130:     function Select_Lifted
        !           131:                  ( p : Poly_Sys; mix : Standard_Integer_Vectors.Vector;
        !           132:                    lifsup : Arrays_of_Floating_Vector_Lists.Array_of_Lists )
        !           133:                  return Poly_Sys is
        !           134:
        !           135:    -- DESCRIPTION :
        !           136:     --   Returns the system whose terms have exponents that occur in the
        !           137:     --   lifted supports.
        !           138:
        !           139:       res : Poly_Sys(p'range);
        !           140:       intsup : Arrays_of_Integer_Vector_Lists.Array_of_Lists(lifsup'range);
        !           141:
        !           142:     begin
        !           143:       intsup := Convert(lifsup);
        !           144:       for i in intsup'range loop
        !           145:         Reduce(intsup(i),p'last+1);
        !           146:       end loop;
        !           147:       res := Select_Terms(p,mix,intsup);
        !           148:       Arrays_of_Integer_Vector_Lists.Deep_Clear(intsup);
        !           149:       return res;
        !           150:     end Select_Lifted;
        !           151:
        !           152:   -- REPORT DURING CREATION :
        !           153:
        !           154:     procedure Write_Cell ( mic : in Integer_Mixed_Subdivisions.Mixed_Cell;
        !           155:                            continue : out boolean ) is
        !           156:
        !           157:       vol : natural;
        !           158:
        !           159:     begin
        !           160:       nbcells := nbcells + 1;
        !           161:       put(file,"Cell no. "); put(file,nbcells,1); put_line(file," : ");
        !           162:       put(file," normal to cell : "); put(file,mic.nor); new_line(file);
        !           163:       put_line(file," the points in the cell : ");
        !           164:       for k in mic.pts'range loop
        !           165:         put(file,"  component "); put(file,k,1); put(file," with ");
        !           166:         put(file,Length_Of(mic.pts(k)),1); put_line(file," points :");
        !           167:         put(file,mic.pts(k));
        !           168:       end loop;
        !           169:       vol := Mixed_Volume(p'length,mix.all,mic);
        !           170:       put(file," with volume addition : ");
        !           171:       put(file,tmv,1); put(file," + "); put(file,vol,1);
        !           172:       tmv := tmv + vol; put(file," = "); put(file,tmv,1); new_line(file);
        !           173:       continue := true;
        !           174:     end Write_Cell;
        !           175:     procedure Report_and_Create1_CS is new Gen1_Create_CS(Write_Cell);
        !           176:
        !           177:     procedure Compute_Mixture
        !           178:               ( file : in file_type; n : in natural;
        !           179:                 compmixture : in boolean;
        !           180:                 supports : in out Arrays_of_Integer_Vector_Lists.Array_of_Lists;
        !           181:                 mix : in out Standard_Integer_Vectors.Link_to_Vector;
        !           182:                 permp : out Poly_Sys ) is
        !           183:
        !           184:     -- DESCRIPTION :
        !           185:     --   Computes the type of mixture and permutes if necessary,
        !           186:     --   the equations in the polynomial system.
        !           187:
        !           188:       perm : Standard_Integer_Vectors.Link_to_Vector;
        !           189:
        !           190:     begin
        !           191:       if compmixture
        !           192:        then Compute_Mixture(supports,mix,perm);
        !           193:        else perm := Compute_Permutation(n,mix.all,supports);
        !           194:       end if;
        !           195:       permp := Permute(p,perm);  Clear(perm);
        !           196:       new_line(file);
        !           197:       put(file,"TYPE OF MIXTURE : "); put(file,"#supports : ");
        !           198:       put(file,mix'last,1);
        !           199:       put(file," occurrences : "); put(file,mix);
        !           200:       new_line(file);
        !           201:     end Compute_Mixture;
        !           202:
        !           203:     function Expand
        !           204:                 ( mix : Vector;
        !           205:                   points : Arrays_of_Integer_Vector_Lists.Array_of_Lists )
        !           206:                 return Arrays_of_Integer_Vector_Lists.Array_of_Lists is
        !           207:
        !           208:     -- DESCRIPTION :
        !           209:     --   Returns a tuple of expanded lists, according to the type of mixture.
        !           210:
        !           211:       sum : integer := Standard_Integer_Vectors.Sum(mix);
        !           212:       res : Arrays_of_Integer_Vector_Lists.Array_of_Lists(1..sum);
        !           213:       cnt : natural := 0;
        !           214:
        !           215:     begin
        !           216:       for i in mix'range loop
        !           217:         for j in 1..mix(i) loop
        !           218:           cnt := cnt + 1;
        !           219:           res(cnt) := points(i);
        !           220:         end loop;
        !           221:       end loop;
        !           222:       return res;
        !           223:     end Expand;
        !           224:
        !           225:     procedure Write_Cardinalities
        !           226:                ( file : in file_type;
        !           227:                  mix,card : in Standard_Integer_Vectors.Vector ) is
        !           228:
        !           229:     begin
        !           230:       new_line(file);
        !           231:       put_line(file,"CARDINALITIES OF THE LIFTED FACES :");
        !           232:       new_line(file);
        !           233:       for i in card'range loop
        !           234:         put(file,"  #lifted "); put(file,mix(i),1);
        !           235:         put(file,"-faces of polytope "); put(file,i,1);
        !           236:         put(file," : "); put(file,card(i),1); new_line(file);
        !           237:       end loop;
        !           238:     end Write_Cardinalities;
        !           239:
        !           240:     procedure Create_Mixed_Cells
        !           241:              ( file : in file_type; n : in natural; mix : in Vector;
        !           242:                mixpts : in Arrays_of_Integer_Vector_Lists.Array_of_Lists;
        !           243:                lifted : in out Arrays_of_Integer_Vector_Lists.Array_of_Lists;
        !           244:                mixsub : in out Integer_Mixed_Subdivisions.Mixed_Subdivision ) is
        !           245:
        !           246:     -- DESCRIPTION :
        !           247:     --   The pruning algorithm will be applied to compute the mixed cells.
        !           248:
        !           249:       use Integer_Faces_of_Polytope;
        !           250:       afa : Array_of_Faces(mix'range);
        !           251:       cardafa : Standard_Integer_Vectors.Vector(mix'range);
        !           252:       nbsucc,nbfail : Standard_Floating_Vectors.Vector(mix'range)
        !           253:                     := (mix'range => 0.0);
        !           254:       timer : timing_widget;
        !           255:
        !           256:     begin
        !           257:       tstart(timer);
        !           258:       for i in afa'range loop
        !           259:         afa(i) := Create_Lower(mix(i),n+1,lifted(i));
        !           260:       end loop;
        !           261:       tstop(timer);
        !           262:       for i in afa'range loop
        !           263:         cardafa(i) := Length_Of(afa(i));
        !           264:       end loop;
        !           265:       Write_Cardinalities(file,mix,cardafa);
        !           266:       new_line(file);
        !           267:       print_times(file,timer,"Creation of the faces of lower hull");
        !           268:       new_line(file);
        !           269:       put_line(file,"PRUNING TO EXTRACT THE MIXED CELLS :");
        !           270:       tstart(timer);
        !           271:       if report
        !           272:        then nbcells := 0; tmv := 0;
        !           273:             Report_and_Create1_CS(n,mix,afa,lifted,nbsucc,nbfail,mixsub);
        !           274:        else Create_CS(n,mix,afa,lifted,nbsucc,nbfail,mixsub);
        !           275:       end if;
        !           276:       tstop(timer);
        !           277:       Pruning_Statistics(file,nbsucc,nbfail);
        !           278:       new_line(file);
        !           279:       print_times(file,timer,"Pruning for Mixed Cells");
        !           280:     end Create_Mixed_Cells;
        !           281:
        !           282:     procedure Create_Mixed_Cells
        !           283:             ( file : in file_type;
        !           284:               n : in natural; mix : in Standard_Integer_Vectors.Vector;
        !           285:               fltsup : in Arrays_of_Floating_Vector_Lists.Array_of_Lists;
        !           286:               lilifu : in Standard_Floating_VecVecs.Link_to_VecVec;
        !           287:               lifsup : in Arrays_of_Floating_Vector_Lists.Array_of_Lists;
        !           288:               fltsub : in out Floating_Mixed_Subdivisions.Mixed_Subdivision ) is
        !           289:
        !           290:       use Standard_Floating_VecVecs;
        !           291:       use Floating_Faces_of_Polytope;
        !           292:       timer : timing_widget;
        !           293:       tol : constant double_float := 10.0**(-8);
        !           294:       supfa,liffaces : Array_of_Faces(mix'range);
        !           295:       cardafa : Standard_Integer_Vectors.Vector(mix'range);
        !           296:       nbsucc,nbfail : Standard_Floating_Vectors.Vector(mix'range)
        !           297:                     := (mix'range => 0.0);
        !           298:
        !           299:     begin
        !           300:       tstart(timer);
        !           301:       if lilifu /= null
        !           302:        then for i in supfa'range loop
        !           303:               supfa(i) := Create(mix(i),n,fltsup(i),tol);
        !           304:               liffaces(i) := Linear_Lift(supfa(i),lilifu(i).all);
        !           305:             end loop;
        !           306:        else for i in liffaces'range loop
        !           307:               liffaces(i) := Create_Lower(mix(i),n+1,lifsup(i),tol);
        !           308:             end loop;
        !           309:       end if;
        !           310:       tstop(timer);
        !           311:       for i in liffaces'range loop
        !           312:         cardafa(i) := Length_Of(liffaces(i));
        !           313:       end loop;
        !           314:       Write_Cardinalities(file,mix,cardafa);
        !           315:       new_line(file);
        !           316:       print_times(file,timer,"Creation of the faces of lower hull");
        !           317:       new_line(file);
        !           318:       put_line(file,"PRUNING TO EXTRACT THE MIXED CELLS :");
        !           319:       tstart(timer);
        !           320:       Create(n,mix,liffaces,lifsup,tol,nbsucc,nbfail,fltsub);
        !           321:       tstop(timer);
        !           322:       Pruning_Statistics(file,nbsucc,nbfail);
        !           323:       new_line(file);
        !           324:       print_times(file,timer,"Pruning for Mixed Cells.");
        !           325:     end Create_Mixed_Cells;
        !           326:
        !           327:     procedure Polyhedral_Homotopy_Continuation
        !           328:                ( file : in file_type; qq : in out Poly_Sys;
        !           329:                  qqsols : in out Solution_List;
        !           330:                  lifted : in Arrays_of_Integer_Vector_Lists.Array_of_Lists;
        !           331:                  mixsub : in Integer_Mixed_Subdivisions.Mixed_Subdivision ) is
        !           332:
        !           333:     -- DESCRIPTION :
        !           334:     --   This procedure constructs and solves a random coefficient start system.
        !           335:     --   Only those monomials whose exponents occur in the subdivision are
        !           336:     --   contained in the start system.
        !           337:
        !           338:       timer : timing_widget;
        !           339:       n : constant natural := p'length;
        !           340:       lifted_lq,lq : Laur_Sys(q'range);
        !           341:       h : Eval_Coeff_Laur_Sys(q'range);
        !           342:       c : Standard_Complex_VecVecs.VecVec(h'range);
        !           343:       e : Exponent_Vectors_Array(h'range);
        !           344:       j : Eval_Coeff_Jaco_Mat(h'range,h'first..h'last+1);
        !           345:       m : Mult_Factors(j'range(1),j'range(2));
        !           346:
        !           347:     begin
        !           348:       new_line(file);
        !           349:       put_line(file,"POLYHEDRAL HOMOTOPY CONTINUATION :");
        !           350:       lq := Polynomial_to_Laurent_System(qq);
        !           351:       lifted_lq := Perform_Lifting(n,mix.all,lifted,lq);
        !           352:       Clear(lq);
        !           353:       lq := Eval(lifted_lq,Create(1.0),n+1);
        !           354:       qq := Laurent_to_Polynomial_System(lq);
        !           355:       h := Create(lq);
        !           356:       for i in c'range loop
        !           357:         declare
        !           358:           coeff_lq : constant Standard_Complex_Vectors.Vector := Coeff(lq(i));
        !           359:         begin
        !           360:           c(i) := new Standard_Complex_Vectors.Vector(coeff_lq'range);
        !           361:           for k in coeff_lq'range loop
        !           362:             c(i)(k) := coeff_lq(k);
        !           363:           end loop;
        !           364:         end;
        !           365:       end loop;
        !           366:       e := Create(lq);
        !           367:       Create(lq,j,m);
        !           368:       tstart(timer);
        !           369:       if contrep
        !           370:        then --Mixed_Solve(file,lifted_lq,mix.all,mixsub,qqsols);
        !           371:             Mixed_Solve(file,lifted_lq,lifted,h,c,e,j,m,mix.all,mixsub,qqsols);
        !           372:        else --Mixed_Solve(lifted_lq,mix.all,mixsub,qqsols);
        !           373:             Mixed_Solve(lifted_lq,lifted,h,c,e,j,m,mix.all,mixsub,qqsols);
        !           374:       end if;
        !           375:       tstop(timer);
        !           376:       new_line(file);
        !           377:       print_times(file,timer,"Polyhedral Continuation");
        !           378:       q := qq; qsols := qqsols;
        !           379:     end Polyhedral_Homotopy_Continuation;
        !           380:
        !           381:     function Select_Terms
        !           382:                 ( p : Poly_Sys;
        !           383:                   lifsup : Arrays_of_Floating_Vector_Lists.Array_of_Lists )
        !           384:                 return Poly_Sys is
        !           385:
        !           386:     -- DESCRIPTION :
        !           387:     --   Returns the system whose terms have exponents that occur in the
        !           388:     --   lifted supports.
        !           389:
        !           390:       res : Poly_Sys(p'range);
        !           391:       intsup : Arrays_of_Integer_Vector_Lists.Array_of_Lists(lifsup'range);
        !           392:
        !           393:     begin
        !           394:       intsup := Convert(lifsup);
        !           395:       for i in intsup'range loop
        !           396:         Reduce(intsup(i),p'last+1);
        !           397:       end loop;
        !           398:       res := Select_Terms(p,intsup);
        !           399:       Arrays_of_Integer_Vector_Lists.Deep_Clear(intsup);
        !           400:       return res;
        !           401:     end Select_Terms;
        !           402:
        !           403:     procedure Polyhedral_Homotopy_Continuation
        !           404:                 ( file : in file_type;
        !           405:                   n : in natural; mix : in Standard_Integer_Vectors.Vector;
        !           406:                   qq : in Poly_Sys; qqsols : in out Solution_List;
        !           407:                   lifsup : in Arrays_of_Floating_Vector_Lists.Array_of_Lists;
        !           408:                   fltsub : in Floating_Mixed_Subdivisions.Mixed_Subdivision;
        !           409:                   contrep : in boolean ) is
        !           410:
        !           411:       lq : Laur_Sys(qq'range) := Polynomial_to_Laurent_System(qq);
        !           412:       h : Eval_Coeff_Laur_Sys(qq'range);
        !           413:       c : Standard_Complex_VecVecs.VecVec(h'range);
        !           414:       e : Exponent_Vectors_Array(h'range);
        !           415:       j : Eval_Coeff_Jaco_Mat(h'range,h'first..h'last+1);
        !           416:       m : Mult_Factors(j'range(1),j'range(2));
        !           417:       timer : timing_widget;
        !           418:
        !           419:     begin
        !           420:       new_line(file);
        !           421:       put_line(file,"POLYHEDRAL HOMOTOPY CONTINUATION :");
        !           422:       h := Create(lq);
        !           423:       for i in c'range loop
        !           424:         declare
        !           425:           coeff_lq : constant Standard_Complex_Vectors.Vector := Coeff(lq(i));
        !           426:         begin
        !           427:           c(i) := new Standard_Complex_Vectors.Vector(coeff_lq'range);
        !           428:           for k in coeff_lq'range loop
        !           429:             c(i)(k) := coeff_lq(k);
        !           430:           end loop;
        !           431:         end;
        !           432:       end loop;
        !           433:       e := Create(lq);
        !           434:       Create(lq,j,m);
        !           435:       tstart(timer);
        !           436:       if contrep
        !           437:        then Mixed_Solve(file,lq,lifsup,h,c,e,j,m,mix,fltsub,qqsols);
        !           438:        else Mixed_Solve(lq,lifsup,h,c,e,j,m,mix,fltsub,qqsols);
        !           439:       end if;
        !           440:       tstop(timer);
        !           441:       new_line(file);
        !           442:       print_times(file,timer,"Polyhedral Homotopy Continuation");
        !           443:       q := qq; qsols := qqsols;
        !           444:     end Polyhedral_Homotopy_Continuation;
        !           445:
        !           446:     procedure Volume_Computation
        !           447:              ( file : in file_type;
        !           448:                n : in natural; mix : in Vector;
        !           449:                lifpts : in Arrays_of_Integer_Vector_Lists.Array_of_Lists;
        !           450:                mixsub : in out Integer_Mixed_Subdivisions.Mixed_Subdivision ) is
        !           451:
        !           452:     -- DESCRIPTION :
        !           453:     --   Computes the volumes of the mixed cells in mixsub.
        !           454:
        !           455:       timer : timing_widget;
        !           456:       mixvol : natural;
        !           457:
        !           458:     begin
        !           459:       new_line(file);
        !           460:       put_line(file,"VOLUMES OF MIXED CELLS :");
        !           461:       new_line(file);
        !           462:       tstart(timer);
        !           463:       put(file,n,mix,mixsub,mixvol);
        !           464:       tstop(timer);
        !           465:       put(file,"The total mixed volume equals ");
        !           466:       put(file,mixvol,1); new_line(file);
        !           467:       new_line(file);
        !           468:       print_times(file,timer,"Volume computation of mixed cells");
        !           469:       if compmisu
        !           470:        then mixsub := Integer_Mixed_Subdivisions.Create(lifpts,mixsub);
        !           471:             new_line(file);
        !           472:             put_line(file,"VOLUMES OF MIXED CELLS, AFTER REFINEMENT :");
        !           473:             new_line(file);
        !           474:             tstart(timer);
        !           475:             put(file,n,mix,mixsub,mixvol);
        !           476:             tstop(timer);
        !           477:             put(file,"The total mixed volume equals ");
        !           478:             put(file,mixvol,1); new_line(file);
        !           479:             new_line(file);
        !           480:             print_times(file,timer,"Volume computation of mixed cells");
        !           481:       end if;
        !           482:       mv := mixvol;
        !           483:     end Volume_Computation;
        !           484:
        !           485:     procedure Volume_Computation
        !           486:            ( file : in file_type; n : in natural; mix : in Vector;
        !           487:              mixsub : in out Floating_Mixed_Subdivisions.Mixed_Subdivision ) is
        !           488:
        !           489:       timer : timing_widget;
        !           490:       mixvol : natural;
        !           491:
        !           492:     begin
        !           493:       new_line(file);
        !           494:       put_line(file,"THE MIXED SUBDIVISION : ");
        !           495:       new_line(file);
        !           496:       tstart(timer);
        !           497:       Floating_Mixed_Subdivisions_io.put(file,n,mix,mixsub,mixvol);
        !           498:       tstop(timer);
        !           499:       put(file,"The mixed volume equals : ");
        !           500:         put(file,mixvol,1); new_line(file);
        !           501:       new_line(file);
        !           502:       print_times(file,timer,"Volume computation of mixed cells");
        !           503:       mv := mixvol;
        !           504:     end Volume_Computation;
        !           505:
        !           506:     procedure Data_Management
        !           507:                     ( mix : in out Standard_Integer_Vectors.Link_to_Vector;
        !           508:                       compmisu,compmix,fltlif : out boolean ) is
        !           509:
        !           510:     -- DESCRIPTION :
        !           511:     --   This procedure allows to use previously computed mixed subdivisions.
        !           512:
        !           513:       ans : character;
        !           514:       m : natural;
        !           515:
        !           516:     begin
        !           517:       new_line;
        !           518:       put("Do you already have a mixed subdivision ? (y/n) ");
        !           519:       Ask_Yes_or_No(ans);
        !           520:       if ans = 'y'
        !           521:        then put("Induced by integer or floating-point lifting (i/f) ");
        !           522:             Ask_Alternative(ans,"if");
        !           523:             fltlif := (ans = 'f');
        !           524:             declare
        !           525:               insubft : file_type;
        !           526:               nn : natural;
        !           527:             begin
        !           528:               put_line("Reading the name of the input file.");
        !           529:               Read_Name_and_Open_File(insubft);
        !           530:               if ans = 'f'
        !           531:                then get(insubft,nn,m,mix,fmixsub);
        !           532:                else get(insubft,nn,m,mix,imixsub);
        !           533:               end if;
        !           534:               Close(insubft);
        !           535:               new_line(file);
        !           536:               put_line(file,"Mixed subdivision supplied by user.");
        !           537:               new_line(file);
        !           538:               compmisu := false; compmix := false;
        !           539:             exception
        !           540:               when DATA_ERROR
        !           541:                 => put_line("Data not in correct format.  Will ignore it...");
        !           542:                    Close(insubft);
        !           543:             end;
        !           544:        else compmisu := true;
        !           545:             put("Do you want to enforce a type mixture ? (y/n) ");
        !           546:             Ask_Yes_or_No(ans);
        !           547:             if ans = 'y'
        !           548:              then put("Give number of different supports : "); get(m);
        !           549:                   put("Give vector indicating occurrences : ");
        !           550:                   get(m,mix);
        !           551:                   compmix := false;
        !           552:              else compmix := true;
        !           553:             end if;
        !           554:       end if;
        !           555:     end Data_Management;
        !           556:
        !           557:     procedure Main_Driver is
        !           558:
        !           559:       n : constant natural := p'length;
        !           560:       sp,qq : Poly_Sys(p'range);
        !           561:       qqsols : Solution_List;
        !           562:       totaltimer : timing_widget;
        !           563:       points : Arrays_of_Integer_Vector_Lists.Array_of_Lists(p'range);
        !           564:       ilili : Standard_Integer_VecVecs.Link_to_VecVec;
        !           565:       flili : Standard_Floating_VecVecs.Link_to_VecVec;
        !           566:       fltlif : boolean;
        !           567:       mixpts,mixpts1,ilifpts
        !           568:              : Arrays_of_Integer_Vector_Lists.Link_to_Array_of_Lists;
        !           569:       fpts,flifpts : Arrays_of_Floating_Vector_Lists.Link_to_Array_of_Lists;
        !           570:       ans : character;
        !           571:
        !           572:       outsubft : file_type;
        !           573:
        !           574:       procedure Driver_for_Integer_Lifting is
        !           575:       begin
        !           576:         if compmisu
        !           577:          then new_line;
        !           578:               put("Do you want intermediate output on file,");
        !           579:               put(" during creation ? (y/n) ");
        !           580:               Ask_Yes_or_No(ans);
        !           581:               report := (ans = 'y');
        !           582:               put("Do you want the mixed cells on separate file ? (y/n) ");
        !           583:               Ask_Yes_or_No(ans);
        !           584:               misufile := (ans = 'y');
        !           585:               if misufile
        !           586:                then put_line("Reading the name of the output file.");
        !           587:                     Read_Name_and_Create_File(outsubft);
        !           588:               end if;
        !           589:          else ilifpts.all := Induced_Lifting(n,mix.all,points,imixsub);
        !           590:         end if;
        !           591:         Driver_for_Polyhedral_Continuation
        !           592:           (file,sp,0,byebye,qq,gft,solsft,tosolve,ranstart,contrep);
        !           593:         if compmisu
        !           594:          then Create_Mixed_Cells(file,n,mix.all,mixpts.all,ilifpts.all,imixsub);
        !           595:         end if;
        !           596:         if not Integer_Mixed_Subdivisions.Is_Null(imixsub)
        !           597:          then Volume_Computation(file,n,mix.all,ilifpts.all,imixsub);
        !           598:               if compmisu and then misufile
        !           599:                then put(outsubft,n,mix.all,imixsub);
        !           600:               end if;
        !           601:               if tosolve
        !           602:                then Polyhedral_Homotopy_Continuation
        !           603:                       (file,qq,qqsols,ilifpts.all,imixsub);
        !           604:               end if;
        !           605:         end if;
        !           606:       end Driver_for_Integer_Lifting;
        !           607:
        !           608:       procedure Driver_for_Float_Lifting is
        !           609:       begin
        !           610:         if compmisu
        !           611:          then new_line;
        !           612:               put("Do you want the mixed cells on separate file ? (y/n) ");
        !           613:               Ask_Yes_or_No(ans);
        !           614:               misufile := (ans = 'y');
        !           615:               if misufile
        !           616:                then put_line("Reading the name of the output file.");
        !           617:                     Read_Name_and_Create_File(outsubft);
        !           618:               end if;
        !           619:          else -- flifpts.all := Induced_Lifting(n,mix.all,fpts.all,fmixsub);
        !           620:               flifpts.all := Occured_Lifting(n,mix.all,fpts.all,fmixsub);
        !           621:               sp := Select_Lifted(p,mix.all,flifpts.all);
        !           622:         end if;
        !           623:         Driver_for_Polyhedral_Continuation
        !           624:           (file,sp,0,byebye,qq,gft,solsft,tosolve,ranstart,contrep);
        !           625:         if compmisu
        !           626:          then Create_Mixed_Cells
        !           627:                  (file,n,mix.all,fpts.all,flili,flifpts.all,fmixsub);
        !           628:               if misufile
        !           629:                then put(outsubft,n,mix.all,fmixsub);
        !           630:               end if;
        !           631:         end if;
        !           632:         if not Floating_Mixed_Subdivisions.Is_Null(fmixsub)
        !           633:          then Volume_Computation(file,n,mix.all,fmixsub);
        !           634:               if tosolve
        !           635:                then Polyhedral_Homotopy_Continuation
        !           636:                       (file,n,mix.all,qq,qqsols,flifpts.all,fmixsub,contrep);
        !           637:               end if;
        !           638:         end if;
        !           639:       end Driver_for_Float_Lifting;
        !           640:
        !           641:     begin
        !           642:       new_line; put_line(welcome);
        !           643:       tstart(totaltimer);
        !           644:
        !           645:       points := Create(p);
        !           646:
        !           647:       Data_Management(mix,compmisu,compmix,fltlif);
        !           648:
        !           649:       if compmisu
        !           650:        then
        !           651:          Compute_Mixture(file,n,compmix,points,mix,permp);
        !           652:          mixpts1 := new Arrays_of_Integer_Vector_Lists.
        !           653:                         Array_of_Lists'(Typed_Lists(mix.all,points));
        !           654:
        !           655:          Driver_for_Criterion(file,mixpts1.all);
        !           656:
        !           657:          mixpts := new Arrays_of_Integer_Vector_Lists.
        !           658:                        Array_of_Lists'(Expand(mix.all,mixpts1.all));
        !           659:          Compute_Mixture(file,n,compmix,mixpts.all,mix,permp);
        !           660:          mixpts := new Arrays_of_Integer_Vector_Lists.
        !           661:                        Array_of_Lists'(Typed_Lists(mix.all,mixpts.all));
        !           662:
        !           663:          ilifpts := new Arrays_of_Integer_Vector_Lists.
        !           664:                         Array_of_Lists(mix'range);
        !           665:          fpts := new Arrays_of_Floating_Vector_Lists.Array_of_Lists(mix'range);
        !           666:          flifpts
        !           667:               := new Arrays_of_Floating_Vector_Lists.Array_of_Lists(mix'range);
        !           668:
        !           669:          sp := Select_Terms(permp,mix.all,mixpts.all);
        !           670:
        !           671:          new_line;
        !           672:          Driver_for_Lifting_Functions
        !           673:            (file,sp,mixpts.all,fltlif,fpts.all,ilifpts.all,
        !           674:                  flifpts.all,ilili,flili);
        !           675:        else
        !           676:          mixpts := new Arrays_of_Integer_Vector_Lists.
        !           677:                        Array_of_Lists'(Typed_Lists(mix.all,points));
        !           678:          ilifpts := new Arrays_of_Integer_Vector_Lists.
        !           679:                         Array_of_Lists(mix'range);
        !           680:          fpts := new Arrays_of_Floating_Vector_Lists.
        !           681:                      Array_of_Lists(points'range);
        !           682:          fpts.all := Convert(points);
        !           683:          flifpts := new Arrays_of_Floating_Vector_Lists.
        !           684:                         Array_of_Lists(mix'range);
        !           685:          sp := p;
        !           686:       end if;
        !           687:       if fltlif
        !           688:        then Driver_for_Float_Lifting;
        !           689:        else Driver_for_Integer_Lifting;
        !           690:       end if;
        !           691:
        !           692:       if tosolve
        !           693:        then new_line(file);
        !           694:             put_line(file,"THE RANDOM COEFFICIENT START SYSTEM :");
        !           695:             new_line(file);
        !           696:             put_line(file,qq);
        !           697:             new_line(file);
        !           698:             put_line(file,"THE START SOLUTIONS :");
        !           699:             new_line(file);
        !           700:             put(file,Length_Of(qqsols),qq'length,qqsols);
        !           701:             if ranstart
        !           702:              then new_line(gft);
        !           703:                   put_line(gft,"THE SOLUTIONS : "); new_line(gft);
        !           704:                   put(gft,Length_Of(qqsols),n,qqsols);
        !           705:                   Close(gft);
        !           706:              else put(solsft,Length_Of(qqsols),n,qqsols);
        !           707:                   Close(solsft);
        !           708:             end if;
        !           709:        end if;
        !           710:
        !           711:        tstop(totaltimer);
        !           712:        new_line(file);
        !           713:        print_times(file,totaltimer,"All Computations");
        !           714:      end Main_Driver;
        !           715:
        !           716:   begin
        !           717:     Main_Driver;
        !           718:   end Driver_for_Mixed_Volume_Computation;
        !           719:
        !           720: end Drivers_for_Static_Lifting;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>