Annotation of OpenXM_contrib/PHC/Ada/Homotopy/standard_complex_solutions.ads, Revision 1.1
1.1 ! maekawa 1: with Standard_Floating_Numbers; use Standard_Floating_Numbers;
! 2: with Generic_Lists;
! 3: with Standard_Complex_Numbers; use Standard_Complex_Numbers;
! 4: with Standard_Complex_Vectors; use Standard_Complex_Vectors;
! 5:
! 6: package Standard_Complex_Solutions is
! 7:
! 8: -- DESCRIPTION :
! 9: -- This package provides an abstraction of a list and an array
! 10: -- of solutions as vectors of standard complex numbers.
! 11:
! 12: -- DATA STRUCTURES :
! 13:
! 14: type Solution ( n : natural ) is record
! 15: t : Complex_Number; -- continuation parameter t
! 16: m : natural; -- multiplicity of the solution
! 17: v : Vector(1..n); -- the solution
! 18: err : double_float; -- error = |correction| from Newton
! 19: rco : double_float; -- inverse of condition number
! 20: res : double_float; -- norm of residual vector
! 21: end record;
! 22:
! 23: type Link_to_Solution is access Solution;
! 24:
! 25: package List_of_Solutions is new Generic_Lists(Link_to_Solution);
! 26: type Solution_List is new List_of_Solutions.List;
! 27:
! 28: type Solution_Array is array ( positive range <> ) of Link_to_Solution;
! 29:
! 30: -- CREATORS :
! 31:
! 32: function Create ( sl : Solution_List ) return Solution_Array;
! 33: function Create ( sa : Solution_Array ) return Solution_List;
! 34:
! 35: -- DESCRIPTION :
! 36: -- Allows the transition from a list to an array and vice versa.
! 37:
! 38: -- COMPARISON and COPYING :
! 39:
! 40: function Equal ( s1,s2 : Solution; tol : double_float ) return boolean;
! 41:
! 42: -- DESCRIPTION :
! 43: -- Returns true if for each component
! 44: -- |s1.v(i)-s2.v(i)|/|s1.v(i)| < tol, for i in s1.v'range.
! 45:
! 46: function Equal ( s1,s2 : Solution_List; tol : double_float ) return boolean;
! 47: function Equal ( s1,s2 : Solution_Array; tol : double_float ) return boolean;
! 48:
! 49: -- DESCRIPTION :
! 50: -- Returns true if both lists of arrays are equal to each other, upon
! 51: -- the given tolerance for the relative error.
! 52:
! 53: procedure Equals ( sols : in out Solution_List; flag : in natural;
! 54: tol : in double_float; same : out boolean );
! 55: -- DESCRIPTION :
! 56: -- The solutions that are equal to each other are marked with a flag.
! 57:
! 58: procedure Equals ( sa : in Solution_Array; x : in Vector; i : in natural;
! 59: tol : in double_float; j : in out natural );
! 60: -- DESCRIPTION :
! 61: -- Compares the first i-1 vectors in sa with x.
! 62:
! 63: -- ON ENTRY :
! 64: -- sa a solution array, containing at least i-1 elements;
! 65: -- x a vector;
! 66: -- i an index, normally the entry of x in sa;
! 67: -- tol tolerance for relative error on two vectors;
! 68: -- j must be equal to sa'first.
! 69:
! 70: -- ON RETURN :
! 71: -- j the entry for which sa(j) equals x.
! 72:
! 73: procedure Copy ( s1 : in Solution_List; s2 : in out Solution_List );
! 74: procedure Copy ( s1 : in Solution_Array; s2 : in out Solution_Array );
! 75:
! 76: -- DESCRIPTION :
! 77: -- Makes a deep copy of the list or the array of solutions.
! 78:
! 79: -- SELECTORS :
! 80:
! 81: function Number ( sols : Solution_List; flag : natural ) return natural;
! 82:
! 83: -- DESCRIPTION :
! 84: -- Returns the number of solutions in the list with a multiplicity
! 85: -- equal to flag.
! 86:
! 87: function Is_In ( sols : Solution_List; s : Solution; tol : double_float )
! 88: return boolean;
! 89: function Is_In ( sa : Solution_Array; s : Solution; tol : double_float )
! 90: return boolean;
! 91:
! 92: -- DESCRIPTION :
! 93: -- Returns true if the solution s belongs to the list or to the array.
! 94:
! 95: function Get ( sols : Solution_List; pos : positive ) return Solution;
! 96:
! 97: -- DESCRIPTION :
! 98: -- Returns the solution at the given position.
! 99:
! 100: -- REQUIRED : pos <= Length_Of(sols).
! 101:
! 102: -- CONSTRUCTORS :
! 103:
! 104: procedure Append ( first,last : in out Solution_List; s : in Solution );
! 105:
! 106: -- DESCRIPTION :
! 107: -- The solution sol is appended to the list first;
! 108: -- last is a pointer to the last element of the list first.
! 109:
! 110: procedure Add ( sols : in out Solution_List; s : in Solution );
! 111:
! 112: -- DESCRIPTION :
! 113: -- The solution sol is appended to the list sols.
! 114:
! 115: procedure Add ( sols : in out Solution_List; s : in Solution;
! 116: tol : in double_float; other : out natural );
! 117:
! 118: -- DESCRIPTION :
! 119: -- Append the solution to the list, if it does not already belong to it.
! 120:
! 121: -- MODIFIERS :
! 122:
! 123: procedure Change ( sols : in out Solution_List; pos : in positive;
! 124: s : in Solution; tol : in double_float;
! 125: other : out natural );
! 126:
! 127: -- DESCRIPTION :
! 128: -- Changes the solution at the given position into s, if the solution
! 129: -- does not already occur.
! 130:
! 131: -- REQUIRED : pos <= Length_Of(sols).
! 132:
! 133: procedure Set_Continuation_Parameter
! 134: ( sols : in out Solution_List; t : in Complex_Number );
! 135:
! 136: -- DESCRIPTION :
! 137: -- All solutions in the list will be given the continuation parameter t.
! 138:
! 139: procedure Change_Multiplicity
! 140: ( sols : in out Solution_List; pos : in positive;
! 141: m : in natural );
! 142:
! 143: -- DESCRIPTION :
! 144: -- Changes the multiplicity of the solution with the given position
! 145: -- into m.
! 146:
! 147: -- REQUIRED : pos <= Length_Of(sols).
! 148:
! 149: procedure Remove ( sols : in out Solution_List; pos : in positive );
! 150:
! 151: -- DESCRIPTION :
! 152: -- Removes the solution with given position from the list.
! 153:
! 154: -- REQUIRED : pos <= Length_Of(sols).
! 155:
! 156: generic
! 157: with function To_Be_Removed ( flag : in natural ) return boolean;
! 158: procedure Delete ( sols : in out Solution_List );
! 159:
! 160: -- DESCRIPTION :
! 161: -- Removes all solutions in s for which To_Be_Removed(s.m) holds.
! 162:
! 163: procedure Remove_All ( sols : in out Solution_List; flag : in natural );
! 164:
! 165: -- DESCRIPTION :
! 166: -- All solutions with a multiplicity equal to flag are removed.
! 167:
! 168: -- DESTRUCTORS :
! 169:
! 170: procedure Clear ( sa : in out Solution_Array );
! 171: procedure Clear ( ls : in out Link_to_Solution );
! 172: procedure Shallow_Clear ( sl : in out Solution_List );
! 173: procedure Deep_Clear ( sl : in out Solution_List );
! 174:
! 175: -- DESCRIPTION :
! 176: -- Deallocation of the occupied memory space.
! 177: -- A shallow clear only deallocates the pointers,
! 178: -- so that the data may still be accessible by sharing,
! 179: -- whereas a deep clear also makes the data inaccessible.
! 180:
! 181: end Standard_Complex_Solutions;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>