Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Implift/transforming_solutions.adb, Revision 1.1
1.1 ! maekawa 1: package body Transforming_Solutions is
! 2:
! 3: procedure Transform ( t : in Transfo; s : in out Solution ) is
! 4: begin
! 5: Apply(t,s.v);
! 6: end Transform;
! 7:
! 8: function Transform ( t : Transfo; s : Solution ) return Solution is
! 9:
! 10: res : Solution(s.n);
! 11:
! 12: begin
! 13: res.m := s.m;
! 14: res.t := s.t;
! 15: res.v := t*s.v;
! 16: return res;
! 17: end Transform;
! 18:
! 19: procedure Transform ( t : in Transfo; l : in out Solution_List ) is
! 20:
! 21: tmp : Solution_List;
! 22:
! 23: begin
! 24: if not Is_Null(l)
! 25: then declare
! 26: n : natural := Head_Of(l).n;
! 27: s : Solution(n);
! 28: begin
! 29: tmp := l;
! 30: while not Is_Null(tmp) loop
! 31: Apply(t,Head_Of(tmp).v);
! 32: tmp := Tail_Of(tmp);
! 33: end loop;
! 34: end;
! 35: end if;
! 36: end Transform;
! 37:
! 38: function Transform ( t : Transfo; l : Solution_List ) return Solution_List is
! 39:
! 40: res,res_last,tmp : Solution_List;
! 41:
! 42: begin
! 43: tmp := l;
! 44: while not Is_Null(tmp) loop
! 45: Append(res,res_last,Transform(t,Head_Of(tmp).all));
! 46: tmp := Tail_Of(tmp);
! 47: end loop;
! 48: return res;
! 49: end Transform;
! 50:
! 51: function Insert ( c : Complex_Number; i : integer; s : Solution )
! 52: return Solution is
! 53:
! 54: res : Solution(s.n+1);
! 55:
! 56: begin
! 57: res.m := s.m;
! 58: res.t := s.t;
! 59: for j in res.v'first..(i-1) loop
! 60: res.v(j) := s.v(j);
! 61: end loop;
! 62: res.v(i) := c;
! 63: for j in (i+1)..res.v'last loop
! 64: res.v(j) := s.v(j-1);
! 65: end loop;
! 66: return res;
! 67: end Insert;
! 68:
! 69: procedure Insert ( c : in Complex_Number; i : in integer;
! 70: l : in out Solution_List ) is
! 71: begin
! 72: if not Is_Null(l)
! 73: then declare
! 74: tmp : Solution_List;
! 75: res,res_last : Solution_List;
! 76: sol : Solution(Head_Of(l).n+1);
! 77: begin
! 78: tmp := l;
! 79: while not Is_Null(tmp) loop
! 80: declare
! 81: ls : Link_to_Solution := Head_Of(tmp);
! 82: begin
! 83: sol.m := ls.m;
! 84: sol.t := ls.t;
! 85: for j in sol.v'first..(i-1) loop
! 86: sol.v(j) := ls.v(j);
! 87: end loop;
! 88: sol.v(i) := c;
! 89: for j in (i+1)..sol.v'last loop
! 90: sol.v(j) := ls.v(j-1);
! 91: end loop;
! 92: Append(res,res_last,sol);
! 93: end;
! 94: tmp := Tail_Of(tmp);
! 95: end loop;
! 96: Clear(l); l := res;
! 97: end;
! 98: end if;
! 99: end Insert;
! 100:
! 101: function Insert ( c : Complex_Number; i : integer; l : Solution_List )
! 102: return Solution_List is
! 103:
! 104: res : Solution_List;
! 105:
! 106: begin
! 107: if not Is_Null(l)
! 108: then declare
! 109: tmp,res_last : Solution_List;
! 110: begin
! 111: tmp := l;
! 112: while not Is_Null(tmp) loop
! 113: Append(res,res_last,Insert(c,i,Head_Of(tmp).all));
! 114: tmp := Tail_Of(tmp);
! 115: end loop;
! 116: end;
! 117: end if;
! 118: return res;
! 119: end Insert;
! 120:
! 121: function Insert ( cv : Vector; i : integer; s : Solution )
! 122: return Solution_List is
! 123:
! 124: res,res_last : Solution_List;
! 125:
! 126: begin
! 127: for j in cv'range loop
! 128: Append(res,res_last,Insert(cv(j),i,s));
! 129: end loop;
! 130: return res;
! 131: end Insert;
! 132:
! 133: end Transforming_Solutions;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>