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

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

1.1     ! maekawa     1: with Standard_Floating_Numbers;          use Standard_Floating_Numbers;
        !             2: with Standard_Complex_Numbers;           use Standard_Complex_Numbers;
        !             3: with Standard_Natural_Vectors;
        !             4: with Cayley_Embedding;                   use Cayley_Embedding;
        !             5: with Mixed_Volume_Computation;           use Mixed_Volume_Computation;
        !             6:
        !             7: package body Minkowski_Polynomials is
        !             8:
        !             9:   function Minkowski_Polynomial ( n,r : natural ) return Poly is
        !            10:
        !            11:     res : Poly := Null_Poly;
        !            12:     acc : Degrees := new Standard_Natural_Vectors.Vector'(1..r => 0);
        !            13:
        !            14:     procedure Generate_Monomials
        !            15:                   ( k,sum : in natural; deg : in out Degrees ) is
        !            16:
        !            17:     -- DESCRIPTION :
        !            18:     --   Generates all exponent vectors whose sum equals n.
        !            19:
        !            20:       t : Term;
        !            21:
        !            22:     begin
        !            23:       if k = r
        !            24:        then t.cf := Create(1.0);
        !            25:             deg(r) := n-sum;
        !            26:             t.dg := deg;
        !            27:             Add(res,t);
        !            28:        else for i in 0..(n-sum) loop
        !            29:               deg(k) := i;
        !            30:               Generate_Monomials(k+1,sum+i,deg);
        !            31:             end loop;
        !            32:       end if;
        !            33:     end Generate_Monomials;
        !            34:
        !            35:   begin
        !            36:     Generate_Monomials(1,0,acc);
        !            37:     Standard_Natural_Vectors.Clear
        !            38:       (Standard_Natural_Vectors.Link_to_Vector(acc));
        !            39:     return res;
        !            40:   end Minkowski_Polynomial;
        !            41:
        !            42:   function Convert ( dg : Degrees ) return Standard_Integer_Vectors.Vector is
        !            43:
        !            44:   -- DESCRIPTION :
        !            45:   --   Converts the degrees vector to a vector with integer numbers.
        !            46:
        !            47:     res : Standard_Integer_Vectors.Vector(dg'range);
        !            48:
        !            49:   begin
        !            50:     for i in res'range loop
        !            51:       res(i) := dg(i);
        !            52:     end loop;
        !            53:     return res;
        !            54:   end Convert;
        !            55:
        !            56:   procedure Minkowski_Polynomial
        !            57:                   ( p : in out Poly; t : in Triangulation; n : in natural;
        !            58:                     mix : in Vector; mixsub : out Mixed_Subdivision ) is
        !            59:
        !            60:     procedure Coefficient_Volume
        !            61:                   ( submix : in Vector; sub : in Mixed_Subdivision;
        !            62:                     vol : out natural ) is
        !            63:     begin
        !            64:       vol := Mixed_Volume(n,submix,sub);
        !            65:     end Coefficient_Volume;
        !            66:     procedure Coefficient_Volumes is
        !            67:       new Minkowski_Polynomial_Subdivisions(Coefficient_Volume);
        !            68:
        !            69:   begin
        !            70:     Coefficient_Volumes(p,t,n,mix,mixsub);
        !            71:   end Minkowski_Polynomial;
        !            72:
        !            73:   procedure Minkowski_Polynomial_Subdivisions
        !            74:                  ( p : in out Poly; t : in Triangulation; n : in natural;
        !            75:                    mix : in Vector; mixsub : out Mixed_Subdivision ) is
        !            76:
        !            77:     procedure Coefficient_Volume ( tt : in out Term; cont : out boolean ) is
        !            78:
        !            79:       wrkmix : Vector(mix'range) := Convert(tt.dg);
        !            80:       wrksub : Mixed_Subdivision := Extract_Mixed_Cells(n,wrkmix,t);
        !            81:       vol : natural;
        !            82:
        !            83:     begin
        !            84:       Deflate(n,wrksub);
        !            85:       Process(wrkmix,wrksub,vol);
        !            86:       tt.cf := Create(double_float(vol));
        !            87:       if wrkmix = mix
        !            88:        then mixsub := wrksub;
        !            89:        else Deep_Clear(wrksub);
        !            90:       end if;
        !            91:       cont := true;
        !            92:     end Coefficient_Volume;
        !            93:     procedure Coefficient_Volumes is new Changing_Iterator(Coefficient_Volume);
        !            94:
        !            95:   begin
        !            96:     Coefficient_Volumes(p);
        !            97:   end Minkowski_Polynomial_Subdivisions;
        !            98:
        !            99: end Minkowski_Polynomials;

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