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

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Dynlift/black_mixed_volume_computations.adb, Revision 1.1

1.1     ! maekawa     1: with Standard_Complex_Numbers;           use Standard_Complex_Numbers;
        !             2: with Standard_Complex_Vectors;
        !             3: with Standard_Complex_VecVecs;
        !             4: with Standard_Complex_Poly_Randomizers;  use Standard_Complex_Poly_Randomizers;
        !             5: with Standard_Complex_Laur_Polys;        use Standard_Complex_Laur_Polys;
        !             6: with Standard_Complex_Laur_Functions;    use Standard_Complex_Laur_Functions;
        !             7: with Standard_Complex_Laur_Systems;      use Standard_Complex_Laur_Systems;
        !             8: with Standard_Complex_Laur_SysFun;       use Standard_Complex_Laur_SysFun;
        !             9: with Standard_Complex_Laur_Jacomats;     use Standard_Complex_Laur_Jacomats;
        !            10: with Standard_Poly_Laur_Convertors;      use Standard_Poly_Laur_Convertors;
        !            11: with Standard_Laur_Poly_Convertors;      use Standard_Laur_Poly_Convertors;
        !            12: with Lists_of_Integer_Vectors;           use Lists_of_Integer_Vectors;
        !            13: with Power_Lists,Vertices;               use Power_Lists,Vertices;
        !            14: with Integer_Lifting_Utilities;          use Integer_Lifting_Utilities;
        !            15: with Cayley_Trick;                       use Cayley_Trick;
        !            16: with Triangulations;                     use Triangulations;
        !            17: with Dynamic_Triangulations;             use Dynamic_Triangulations;
        !            18: with Triangulations_and_Subdivisions;    use Triangulations_and_Subdivisions;
        !            19: with Flatten_Mixed_Subdivisions;         use Flatten_Mixed_Subdivisions;
        !            20: with Mixed_Volume_Computation;           use Mixed_Volume_Computation;
        !            21: with Exponent_Vectors;                   use Exponent_Vectors;
        !            22: with Continuation_Parameters;
        !            23: with Integer_Polyhedral_Continuation;    use Integer_Polyhedral_Continuation;
        !            24:
        !            25: package body Black_Mixed_Volume_Computations is
        !            26:
        !            27:   procedure Black_Box_Mixed_Volume_Computation
        !            28:                  ( p : in out Poly_Sys; mix : out Link_to_Vector;
        !            29:                    lifsup : out Link_to_Array_of_Lists;
        !            30:                    mixsub : out Mixed_Subdivision; mv : out natural ) is
        !            31:
        !            32:     n : constant natural := p'length;
        !            33:     supports : Array_of_Lists(p'range) := Create(p);
        !            34:     verpts : Array_of_Lists(p'range);
        !            35:     tmix,perms : Standard_Integer_Vectors.Link_to_Vector;
        !            36:     tmixsub : Mixed_Subdivision;
        !            37:
        !            38:     procedure Collect_Flattening ( t : in Triangulation; l : List ) is
        !            39:
        !            40:     -- DESCRIPTION :
        !            41:     --   Updates the subdivision tmixsub with the flattened cells.
        !            42:     --   The triangulation on entry contains the whole triangulation,
        !            43:     --   not just the new cells.
        !            44:
        !            45:       cells : Mixed_Subdivision;
        !            46:
        !            47:     begin
        !            48:       if Is_Null(tmixsub)
        !            49:        then cells := Deep_Create(n,t);
        !            50:        else cells := Non_Flat_Deep_Create(n,t);
        !            51:             Construct(Head_Of(tmixsub),cells);
        !            52:       end if;
        !            53:       Flatten(cells);
        !            54:       tmixsub := cells;
        !            55:     end Collect_Flattening;
        !            56:     procedure C_Dynamic_Lifting is
        !            57:       new Dynamic_Triangulations.Dynamic_Lifting_with_Flat(Collect_Flattening);
        !            58:
        !            59:   begin
        !            60:     for i in supports'range loop
        !            61:       verpts(i) := Vertex_Points(supports(i));
        !            62:     end loop;
        !            63:     Compute_Mixture(verpts,tmix,perms);
        !            64:     p := Permute(p,perms);
        !            65:     declare
        !            66:       pts,lifted : Array_of_Lists(tmix'range);
        !            67:       last : List;
        !            68:       t : Triangulation;
        !            69:       nt : natural;
        !            70:       lastcells : Mixed_Subdivision;
        !            71:     begin
        !            72:       if tmix'length = 1
        !            73:        then C_Dynamic_Lifting(verpts(1),false,false,0,lifted(1),last,t);
        !            74:             if Is_Null(tmixsub)
        !            75:              then tmixsub := Deep_Create(n,t);
        !            76:              else lastcells := Non_Flat_Deep_Create(n,t);
        !            77:                   Construct(Head_Of(tmixsub),lastcells);
        !            78:                   tmixsub := lastcells;
        !            79:             end if;
        !            80:             Clear(t);
        !            81:             Mixed_Volume(n,tmix.all,tmixsub,mv);
        !            82:        elsif tmix'length <= n/2
        !            83:            then
        !            84:              pts := Typed_Lists(tmix.all,verpts);
        !            85:              Dynamic_Cayley(n,tmix.all,pts,false,false,0,lifted,tmixsub,nt);
        !            86:              Mixed_Volume(n,tmix.all,tmixsub,mv);
        !            87:            else
        !            88:              Mixed_Volume(n,tmix.all,verpts,lifted,tmixsub,mv);
        !            89:       end if;
        !            90:       lifsup := new Array_of_Lists'(lifted);
        !            91:     end;
        !            92:     mix := tmix; mixsub := tmixsub;
        !            93:   end Black_Box_Mixed_Volume_Computation;
        !            94:
        !            95:   procedure Black_Box_Polyhedral_Continuation
        !            96:                  ( p : in Poly_Sys; mix : in Vector;
        !            97:                    lifsup : in Array_of_Lists; mixsub : in Mixed_Subdivision;
        !            98:                    q : in out Poly_Sys; qsols : in out Solution_List ) is
        !            99:
        !           100:     n : constant natural := p'length;
        !           101:     lq,llq : Laur_Sys(p'range);
        !           102:     h : Eval_Coeff_Laur_Sys(q'range);
        !           103:     c : Standard_Complex_VecVecs.VecVec(h'range);
        !           104:     e : Exponent_Vectors_Array(h'range);
        !           105:     j : Eval_Coeff_Jaco_Mat(h'range,h'first..h'last+1);
        !           106:     m : Mult_Factors(j'range(1),j'range(2));
        !           107:
        !           108:   begin
        !           109:     q := Complex_Randomize1(p);
        !           110:     lq := Polynomial_to_Laurent_System(q);
        !           111:     llq := Perform_Lifting(n,mix,lifsup,lq);
        !           112:     Clear(lq); Clear(q);
        !           113:     lq := Eval(llq,Create(1.0),n+1);
        !           114:     q := Laurent_to_Polynomial_System(lq);
        !           115:     Continuation_Parameters.Tune(0);
        !           116:    -- Mixed_Solve(llq,mix,mixsub,qsols);   too expensive !!!!
        !           117:     h := Create(lq);
        !           118:     for i in c'range loop
        !           119:       declare
        !           120:         coeff_lq : constant Standard_Complex_Vectors.Vector := Coeff(lq(i));
        !           121:       begin
        !           122:         c(i) := new Standard_Complex_Vectors.Vector(coeff_lq'range);
        !           123:         for k in coeff_lq'range loop
        !           124:           c(i)(k) := coeff_lq(k);
        !           125:         end loop;
        !           126:       end;
        !           127:     end loop;
        !           128:     e := Create(lq);
        !           129:     Create(lq,j,m);
        !           130:     Mixed_Solve(llq,lifsup,h,c,e,j,m,mix,mixsub,qsols);
        !           131:     Set_Continuation_Parameter(qsols,Create(0.0));
        !           132:     Clear(lq); Clear(llq);
        !           133:     Clear(h); Clear(j); Clear(m);
        !           134:     Standard_Complex_VecVecs.Clear(c);
        !           135:   end Black_Box_Polyhedral_Continuation;
        !           136:
        !           137: end Black_Mixed_Volume_Computations;

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