Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Stalift/mixed_coherent_subdivisions.adb, Revision 1.1
1.1 ! maekawa 1: with Integer_Faces_of_Polytope; use Integer_Faces_of_Polytope;
! 2: with Integer_Lifting_Functions; use Integer_Lifting_Functions;
! 3: with Integer_Pruning_Methods; use Integer_Pruning_Methods;
! 4:
! 5: package body Mixed_Coherent_Subdivisions is
! 6:
! 7: -- a polynomial system as lifting function :
! 8:
! 9: function Mixed_Coherent_Subdivision
! 10: ( n : natural; mix : Vector; points : Array_of_Lists;
! 11: lift : Poly_Sys ) return Mixed_Subdivision is
! 12:
! 13: res : Mixed_Subdivision;
! 14: lifted : Array_of_Lists(mix'range);
! 15: nbsucc,nbfail : Standard_Floating_Vectors.Vector(mix'range)
! 16: := (mix'range => 0.0);
! 17:
! 18: begin
! 19: Mixed_Coherent_Subdivision(n,mix,points,lift,lifted,nbsucc,nbfail,res);
! 20: Deep_Clear(lifted);
! 21: return res;
! 22: end Mixed_Coherent_Subdivision;
! 23:
! 24: procedure Mixed_Coherent_Subdivision
! 25: ( n : in natural; mix : in Vector; points : in Array_of_Lists;
! 26: lift : in Poly_Sys; lifted : in out Array_of_Lists;
! 27: nbsucc,nbfail : in out Standard_Floating_Vectors.Vector;
! 28: mixsub : out Mixed_Subdivision ) is
! 29:
! 30: fa : Array_of_Faces(mix'range);
! 31: index : natural := points'first;
! 32:
! 33: begin
! 34: for k in lifted'range loop -- generate lower faces
! 35: lifted(k) := Polynomial_Lift(lift(k),points(index));
! 36: fa(k) := Create_Lower(mix(k),n+1,lifted(k));
! 37: index := index + mix(k);
! 38: end loop;
! 39: Create_CS(n,mix,fa,lifted,nbsucc,nbfail,mixsub); -- prune for mixed cells
! 40: Shallow_Clear(fa);
! 41: end Mixed_Coherent_Subdivision;
! 42:
! 43: -- a user-defined lifting function :
! 44:
! 45: function Mixed_Coherent_Subdivision
! 46: ( n : natural; mix : Vector; points : Array_of_Lists;
! 47: linear : boolean; lift : VecVec )
! 48: return Mixed_Subdivision is
! 49:
! 50: res : Mixed_Subdivision;
! 51: lifted : Array_of_Lists(mix'range);
! 52: nbsucc,nbfail : Standard_Floating_Vectors.Vector(mix'range)
! 53: := (mix'range => 0.0);
! 54:
! 55: begin
! 56: Mixed_Coherent_Subdivision
! 57: (n,mix,points,linear,lift,lifted,nbsucc,nbfail,res);
! 58: Deep_Clear(lifted);
! 59: return res;
! 60: end Mixed_Coherent_Subdivision;
! 61:
! 62: procedure Mixed_Coherent_Subdivision
! 63: ( n : in natural; mix : in Vector; points : in Array_of_Lists;
! 64: linear : in boolean; lift : VecVec;
! 65: lifted : in out Array_of_Lists;
! 66: nbsucc,nbfail : in out Standard_Floating_Vectors.Vector;
! 67: mixsub : out Mixed_Subdivision ) is
! 68:
! 69: fa : Array_of_Faces(mix'range);
! 70: index : natural := points'first;
! 71:
! 72: begin
! 73: for k in lifted'range loop -- compute lower faces
! 74: if linear
! 75: then lifted(k) := Linear_Lift(lift(k).all,points(index));
! 76: else lifted(k) := Point_Lift(lift(k).all,points(index));
! 77: end if;
! 78: fa(k) := Create_Lower(mix(k),n+1,lifted(k));
! 79: index := index + mix(k);
! 80: end loop;
! 81: Create_CS(n,mix,fa,lifted,nbsucc,nbfail,mixsub); -- prune for mixed cells
! 82: Shallow_Clear(fa);
! 83: end Mixed_Coherent_Subdivision;
! 84:
! 85: -- a randomly generated lifting function :
! 86:
! 87: function Mixed_Coherent_Subdivision
! 88: ( n : natural; mix : Vector; points : Array_of_Lists;
! 89: linear : boolean; low,upp : Vector )
! 90: return Mixed_Subdivision is
! 91:
! 92: res : Mixed_Subdivision;
! 93: lifted : Array_of_Lists(mix'range);
! 94: nbsucc,nbfail : Standard_Floating_Vectors.Vector(mix'range)
! 95: := (mix'range => 0.0);
! 96:
! 97: begin
! 98: Mixed_Coherent_Subdivision
! 99: (n,mix,points,linear,low,upp,lifted,nbsucc,nbfail,res);
! 100: Deep_Clear(lifted);
! 101: return res;
! 102: end Mixed_Coherent_Subdivision;
! 103:
! 104: procedure Mixed_Coherent_Subdivision
! 105: ( n : in natural; mix : in Vector; points : in Array_of_Lists;
! 106: linear : in boolean; low,upp : in Vector;
! 107: lifted : in out Array_of_Lists;
! 108: nbsucc,nbfail : in out Standard_Floating_Vectors.Vector;
! 109: mixsub : out Mixed_Subdivision ) is
! 110:
! 111: fa : Array_of_Faces(mix'range);
! 112: index : natural := points'first;
! 113:
! 114: begin
! 115: for k in lifted'range loop -- compute lower faces
! 116: if linear
! 117: then lifted(k) := Random_Linear_Lift(low(k),upp(k),points(index));
! 118: else lifted(k) := Random_Lift(low(k),upp(k),points(index));
! 119: end if;
! 120: fa(k) := Create_Lower(mix(k),n+1,lifted(k));
! 121: index := index + mix(k);
! 122: end loop;
! 123: Create_CS(n,mix,fa,lifted,nbsucc,nbfail,mixsub); -- prune for mixed cells
! 124: Shallow_Clear(fa);
! 125: end Mixed_Coherent_Subdivision;
! 126:
! 127: end Mixed_Coherent_Subdivisions;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>