File: [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Stalift / mixed_coherent_subdivisions.adb (download)
Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:31 2000 UTC (23 years, 10 months ago) by maekawa
Branch: PHC, MAIN
CVS Tags: v2, maekawa-ipv6, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, HEAD Changes since 1.1: +0 -0
lines
Import the second public release of PHCpack.
OKed by Jan Verschelde.
|
with Integer_Faces_of_Polytope; use Integer_Faces_of_Polytope;
with Integer_Lifting_Functions; use Integer_Lifting_Functions;
with Integer_Pruning_Methods; use Integer_Pruning_Methods;
package body Mixed_Coherent_Subdivisions is
-- a polynomial system as lifting function :
function Mixed_Coherent_Subdivision
( n : natural; mix : Vector; points : Array_of_Lists;
lift : Poly_Sys ) return Mixed_Subdivision is
res : Mixed_Subdivision;
lifted : Array_of_Lists(mix'range);
nbsucc,nbfail : Standard_Floating_Vectors.Vector(mix'range)
:= (mix'range => 0.0);
begin
Mixed_Coherent_Subdivision(n,mix,points,lift,lifted,nbsucc,nbfail,res);
Deep_Clear(lifted);
return res;
end Mixed_Coherent_Subdivision;
procedure Mixed_Coherent_Subdivision
( n : in natural; mix : in Vector; points : in Array_of_Lists;
lift : in Poly_Sys; lifted : in out Array_of_Lists;
nbsucc,nbfail : in out Standard_Floating_Vectors.Vector;
mixsub : out Mixed_Subdivision ) is
fa : Array_of_Faces(mix'range);
index : natural := points'first;
begin
for k in lifted'range loop -- generate lower faces
lifted(k) := Polynomial_Lift(lift(k),points(index));
fa(k) := Create_Lower(mix(k),n+1,lifted(k));
index := index + mix(k);
end loop;
Create_CS(n,mix,fa,lifted,nbsucc,nbfail,mixsub); -- prune for mixed cells
Shallow_Clear(fa);
end Mixed_Coherent_Subdivision;
-- a user-defined lifting function :
function Mixed_Coherent_Subdivision
( n : natural; mix : Vector; points : Array_of_Lists;
linear : boolean; lift : VecVec )
return Mixed_Subdivision is
res : Mixed_Subdivision;
lifted : Array_of_Lists(mix'range);
nbsucc,nbfail : Standard_Floating_Vectors.Vector(mix'range)
:= (mix'range => 0.0);
begin
Mixed_Coherent_Subdivision
(n,mix,points,linear,lift,lifted,nbsucc,nbfail,res);
Deep_Clear(lifted);
return res;
end Mixed_Coherent_Subdivision;
procedure Mixed_Coherent_Subdivision
( n : in natural; mix : in Vector; points : in Array_of_Lists;
linear : in boolean; lift : VecVec;
lifted : in out Array_of_Lists;
nbsucc,nbfail : in out Standard_Floating_Vectors.Vector;
mixsub : out Mixed_Subdivision ) is
fa : Array_of_Faces(mix'range);
index : natural := points'first;
begin
for k in lifted'range loop -- compute lower faces
if linear
then lifted(k) := Linear_Lift(lift(k).all,points(index));
else lifted(k) := Point_Lift(lift(k).all,points(index));
end if;
fa(k) := Create_Lower(mix(k),n+1,lifted(k));
index := index + mix(k);
end loop;
Create_CS(n,mix,fa,lifted,nbsucc,nbfail,mixsub); -- prune for mixed cells
Shallow_Clear(fa);
end Mixed_Coherent_Subdivision;
-- a randomly generated lifting function :
function Mixed_Coherent_Subdivision
( n : natural; mix : Vector; points : Array_of_Lists;
linear : boolean; low,upp : Vector )
return Mixed_Subdivision is
res : Mixed_Subdivision;
lifted : Array_of_Lists(mix'range);
nbsucc,nbfail : Standard_Floating_Vectors.Vector(mix'range)
:= (mix'range => 0.0);
begin
Mixed_Coherent_Subdivision
(n,mix,points,linear,low,upp,lifted,nbsucc,nbfail,res);
Deep_Clear(lifted);
return res;
end Mixed_Coherent_Subdivision;
procedure Mixed_Coherent_Subdivision
( n : in natural; mix : in Vector; points : in Array_of_Lists;
linear : in boolean; low,upp : in Vector;
lifted : in out Array_of_Lists;
nbsucc,nbfail : in out Standard_Floating_Vectors.Vector;
mixsub : out Mixed_Subdivision ) is
fa : Array_of_Faces(mix'range);
index : natural := points'first;
begin
for k in lifted'range loop -- compute lower faces
if linear
then lifted(k) := Random_Linear_Lift(low(k),upp(k),points(index));
else lifted(k) := Random_Lift(low(k),upp(k),points(index));
end if;
fa(k) := Create_Lower(mix(k),n+1,lifted(k));
index := index + mix(k);
end loop;
Create_CS(n,mix,fa,lifted,nbsucc,nbfail,mixsub); -- prune for mixed cells
Shallow_Clear(fa);
end Mixed_Coherent_Subdivision;
end Mixed_Coherent_Subdivisions;