Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Supports/givens_rotations.ads, Revision 1.1
1.1 ! maekawa 1: with Standard_Floating_Numbers; use Standard_Floating_Numbers;
! 2: with Standard_Integer_Vectors;
! 3: with Standard_Floating_Vectors; use Standard_Floating_Vectors;
! 4: with Standard_Floating_Matrices; use Standard_Floating_Matrices;
! 5:
! 6: package Givens_Rotations is
! 7:
! 8: -- DESCRIPTION :
! 9: -- This package contains operations to construct and perform
! 10: -- Given rotations on vectors and matrices.
! 11: -- The procedures in this package are listed in order like
! 12: -- they have to be applied to write a right hand side vector
! 13: -- as a linear combination of the column vectors of a matrix.
! 14:
! 15: procedure Givens_Factors ( v : in Vector; i,j : in integer;
! 16: cosi,sine : out double_float );
! 17: -- DESCRIPTION :
! 18: -- Computes the cosine and sine of the angle to be used in the
! 19: -- Givens rotation on the vector.
! 20:
! 21: -- REQUIRED : v(i) /= 0 and v(j) /= 0, with i<j.
! 22:
! 23: procedure Givens_Factors ( mat : in Matrix; i,j : in integer;
! 24: cosi,sine : out double_float );
! 25: -- DESCRIPTION :
! 26: -- Computes the cosine and sine of the angle to be used in the
! 27: -- Givens rotation on the matrix.
! 28:
! 29: -- REQUIRED : mat(i,i) /= 0 and mat(j,i) /= 0, with i<j.
! 30:
! 31: procedure Givens_Rotation ( v : in out Vector; i,j : in integer;
! 32: cosi,sine : in double_float );
! 33: -- DESCRIPTION :
! 34: -- Performs one Givens rotation on the vector
! 35: -- with given cosine and sine of the angle.
! 36:
! 37: -- REQUIRED : v(i) /= 0 and v(j) /= 0, with i<j.
! 38:
! 39: procedure Givens_Rotation ( mat : in out Matrix; lastcol,i,j : in integer;
! 40: cosi,sine : in double_float );
! 41: procedure Givens_Rotation ( mat : in out Matrix; i,j : in integer;
! 42: cosi,sine : in double_float );
! 43:
! 44: -- DESCRIPTION :
! 45: -- Performs one Givens rotation on the matrix,
! 46: -- with given cosine and sine of the angle.
! 47: -- The parameter lastcol is the index of the last column of interest
! 48: -- in the matrix.
! 49:
! 50: -- REQUIRED :
! 51: -- mat(i,i) /= 0 and mat(j,i) /= 0, with i<j.
! 52: -- It will be assumed that mat is already upper triangular up
! 53: -- to the ith row and colum, i.e. mat(k,l) = 0, l<i, k>l.
! 54:
! 55: procedure Givens_Rotation ( v : in out Vector; i,j : in integer );
! 56:
! 57: -- DESCRIPTION :
! 58: -- Performs one Givens rotation on the vector v.
! 59:
! 60: -- REQUIRED : v(i) /= 0 and v(j) /= 0, with i<j.
! 61:
! 62: procedure Givens_Rotation ( mat : in out Matrix; i,j : in integer );
! 63: procedure Givens_Rotation ( mat : in out Matrix; lastcol,i,j : in integer );
! 64:
! 65: -- DESCRIPTION :
! 66: -- Performs one Givens rotation on the matrix.
! 67: -- The parameter lastcol is the index of the last column of interest
! 68: -- in the matrix.
! 69:
! 70: -- REQUIRED :
! 71: -- mat(i,i) /= 0 and mat(i,j) /= 0, with i<j.
! 72: -- It will be assumed that mat is already upper triangular up
! 73: -- to the ith row and colum, i.e. mat(k,l) = 0, l<i, k>l.
! 74:
! 75: procedure Upper_Triangulate
! 76: ( row : in integer; mat : in out Matrix; tol : in double_float;
! 77: ipvt : in out Standard_Integer_Vectors.Vector;
! 78: pivot : out integer );
! 79:
! 80: -- DESCRIPTION :
! 81: -- Makes the matrix upper triangular by updating the current row of
! 82: -- the matrix. If pivot = 0 on return, then the matrix is singular.
! 83:
! 84: -- REQUIRED :
! 85: -- The matrix is upper triangular up to current row, which means that
! 86: -- abs(max(i,i)) > tol, for i in mat'first(1)..row-1.
! 87:
! 88: procedure Upper_Triangulate ( mat : in out Matrix; tol : in double_float );
! 89: procedure Upper_Triangulate ( mat : in out Matrix; tol : in double_float;
! 90: ipvt : out Standard_Integer_Vectors.Vector );
! 91: -- DESCRIPTION :
! 92: -- Makes the matrix upper triangular by means of Givens rotations.
! 93: -- The parameter tol is used to determine whether an element is zero.
! 94: -- Column interchangements are performed when necessary.
! 95: -- The pivoting information will be returned in the vector ipvt.
! 96: -- Stops when a zero row is encountered.
! 97:
! 98: -- REQUIRED : mat'first(1) = mat'first(2).
! 99:
! 100: procedure Upper_Triangulate ( mat : in out Matrix; rhs : in out Vector;
! 101: tol : in double_float );
! 102: procedure Upper_Triangulate ( mat : in out Matrix; rhs : in out Vector;
! 103: tol : in double_float;
! 104: ipvt : out Standard_Integer_Vectors.Vector );
! 105: -- DESCRIPTION :
! 106: -- Makes the matrix upper triangular and
! 107: -- performs all Givens rotations as well on the right hand side vector.
! 108: -- The parameter tol is used to determine whether an element is zero.
! 109: -- Column interchangements are performed when necessary.
! 110: -- The pivoting information will be returned in the vector ipvt.
! 111: -- Stops when a zero row is encountered.
! 112:
! 113: -- REQUIRED : mat'first(1) = mat(first(2).
! 114:
! 115: procedure Solve ( mat : in Matrix; rhs : in Vector; tol : in double_float;
! 116: x : out Vector );
! 117:
! 118: -- DESCRIPTION :
! 119: -- Solves the system defined by mat*x = rhs.
! 120: -- In case rank(mat) < mat'length(1), then only
! 121: -- x(mat'first(1)..mat'first(1)+rank(mat)-1) will be meaningful.
! 122:
! 123: -- REQUIRED :
! 124: -- mat is upper triangular and mat(i,i) /= 0, for i in 1..Rank(mat).
! 125:
! 126: -- NOTE :
! 127: -- Eventually, when column interchangements where applied during
! 128: -- the triangulation of the matrix, then x is not the decomposition
! 129: -- of the right hand side vector in terms of the first column of
! 130: -- the matrix.
! 131:
! 132: procedure Solve ( mat : in Matrix; rhs : in Vector; tol : in double_float;
! 133: rank : in natural; x : out Vector );
! 134:
! 135: -- DESCRIPTION :
! 136: -- Solves the system defined by mat*x = rhs.
! 137: -- Here only the first rows in columns up to the given rank are
! 138: -- considered. So only x(mat'first(1)..mat'first(1)+rank-1) will
! 139: -- be meaningful.
! 140:
! 141: -- REQUIRED :
! 142: -- The matrix is upper triangular up to its rank
! 143: -- and mat(i,i) /= 0, for i in 1..rank.
! 144:
! 145: end Givens_Rotations;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>