home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / maths / progs / maths1 / A_Pole / Readme < prev   
Encoding:
Text File  |  1989-07-20  |  5.4 KB  |  122 lines

  1.                 *** BASIC V Maths Library Functions ***
  2.  
  3.                              Andy Pole
  4.                              
  5.                              
  6. The library contains functions to perform the following fundamental
  7. matrix algebraic operations: transposition; identity matrix;
  8. solution to linear equations determinant; inverse; decomposition; 
  9. (operations related to eigenstructure are expected in the not too distant 
  10. future!). Also included are routines for cubic spline fitting and interpolation 
  11. for one and two (bicubic) dimensions. Many of the routines are based on FORTRAN
  12. functions contained in "Numerical Recipes. The Art of Scientific
  13. Computing," by W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T.
  14. Vetterling (CUP). Finally there are a group of utilities for displaying numeric
  15. arrays.
  16.  
  17. All routines have been tested under a variety of conditions and have
  18. given correct results. However, all usual disclaimers apply!
  19.  
  20.  
  21. NOTE Error checking for things such as a square matrix
  22. for determinant calculation is *NOT* performed---anyone who wants
  23. this can easily make the required alterations.
  24.  
  25.                         === Matrix Algebra ===
  26.  
  27. Function DET(X()):  returns the determinant of the n by n
  28. matrix X. This will work for any square matrix by using the LU decomposition. 
  29.  
  30. Function}CDET(X()): similar to DET but specifically for symmetric
  31. positive definite matrices. Here Cholesky decomposition is used which
  32. is, of course, much faster than LU.
  33.  
  34. Procedure IDMAT(RETURN I()): sets up the identity matrix. Note
  35. that dimension checking is not performed which means that an array
  36. comprising more columns than rows will be accepted. In this case the
  37. `additional' columns will be ignored. This is a useful feature in some
  38. applications where certain kinds of augmented structure are required.
  39.  
  40. Procedure IMAT(M(), RETURN IM()): The inverse of the n by n
  41. matrix M is computed and returned in IM.
  42.  
  43. Procedure LUDCMP(RETURN A(), N\%, RETURN INDX\%(), RETURN D\%):
  44. Given an N% by N% matrix A, this routine replaces it by the LU
  45. decomposition of a rowwise permutation of itself. U is the upper
  46. triangular part of this, L the strict lower part together with the unit
  47. diagonal. INDEX% is an output
  48. N%-vector which records the row permutation effected by the partial
  49. pivoting. D% is output  as +/- 1 depending on whether the number of
  50. row interchanges was even or odd respectively. This routine is used in
  51. combination with LUBKSB to solve linear equations or invert a matrix.
  52.  
  53. Procedure LUBKSB(A(),  N%, INDEX%(), B()): Solves the set of
  54. linear equations A.X=B. Here A is input, not as the matrix A but rather
  55. its LU decomposition, determined by the routine LUDCMP. INDEX% is
  56. input as the permutation vector returned by LUDCMP. B is input as the
  57. right-hand side vector B, and returns with the solution vector X. A and
  58. INDEX% are not modified by this routine and can be left in place for
  59. successive calls with different right-hand sides B. This routine takes
  60. into account the possibility that B will begin with many zero elements,
  61. so it is efficient for use in matrix inversion.
  62.  
  63. Procedure CHOLESKY(X(), RETURN U()): The Cholesky decomposition of
  64. the symmetric positive definite matrix X is returned in U. (The
  65. algorithm is not in Numerical Recipes but can be found in good algebra
  66. or statistics texts. One example is G.A.F. Seber, "An Introduction
  67. to Linear Regression Analysis.")
  68.  
  69. Procedure ISPDMAT(X(), RETURN IX()): The inverse of the spd matrix
  70. X is returned in IX. Inversion is performed via the Cholesky
  71. decomposition which is considerably faster than LU decomposition in this
  72. special case.
  73.  
  74. Procedure TRANSPOSE(X(), RETURN XT()): Returns the transpose of X
  75. in XT. (Once again, no error checking is performed on argument dimensions.)
  76. _______________________________________________________________________________
  77.  
  78.                  === Spline Fitting and Interpolation ===
  79.  
  80. Procedure C_SPLINE(X(), Y(), RETURN Y2()): Given arrays X and Y
  81. containing a tabulated function, Y(i)=f[X(i)], with X(1)<X(2)<...<X(n),
  82. this routine returns an array of the second derivatives of the
  83. interpolating function at the tabulated points X. The local variables
  84. YP1 and YPN are set to use the so-called `not-a-knot' end conditions.
  85.  
  86. Procedure C_SPLINT(X(), Y(), Y2(), x, RETURN y): Given arrays X
  87. and Y as in C_SPLINE and Y2 as returned from C_SPLINE, and given a value
  88. of x, this function returns a cubic spline interpolated value y.
  89.  
  90. Procedure C2_SPLINE(X1(), X2(), Y(), RETURN Y2()): Given tabulated
  91. independent variables X1 (dimension m) and X2 (dimension n)
  92. and corresponding function values Y (dimension m by n), this
  93. routine constructs one-dimensional cubic splines of the rows of Y and
  94. returns the second derivatives in the (m by n) array Y2.
  95.  
  96. Procedure C2_SPLINT(X1(), X2(), Y(), Y2(), x1, x2, RETURN y):
  97. given X1, X2 and Y as in C2_SPLINE and Y2 as produced by that routine,
  98. and given a desired interpolating point (x1, x2),   this routine returns
  99. an interpolated function value y by bicubic spline interpolation.
  100. _______________________________________________________________________________
  101.                      
  102.                        === Array Display Routines ===
  103.  
  104. Procedure PRINTVEC(V()) prints a REAL vector.
  105.  
  106. Procedure PRINTVECI(V%()) prints an INTEGER vector.
  107.  
  108. Procedure PRINTMAT(M()) prints a REAL matrix.
  109.  
  110. Prodcedure PRINTMATI(M%()) prints an INTEGER matrix.
  111. _______________________________________________________________________________
  112.  
  113. Comments/bugs/queries to:
  114.  
  115.  Dr. Andy Pole
  116.  48 Thorney Road
  117.  Coventry
  118.  CV2 3PH
  119.  
  120.  
  121. 15 October 1988.
  122.