ebook img

DTIC ADA261511: NSWC Library of Mathematics Subroutines PDF

463 Pages·20.4 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview DTIC ADA261511: NSWC Library of Mathematics Subroutines

AD-A261 511 NSWCDD/TR-92/425 yOI!J NSWC LI3RARY OF MATHEMATICS SUBROUTINES BY ALFRED H. MORRIS, JR. STRATEGIC AND SPACE SYSTEMS DEPARTMENT JANUARY 1993 FEB 2 5 1993 Approved for public release; distribution unlimited. 93-03904 NAVAL SURFACE WARFARE CENTER DAHLGREN DIVISION Dahigren, Virgini3 22448-5000 f 1) Bjy II S DLP- AHI MFNT (o)f COMM .fl- C _ - IN['JI/)" (, 1I) ),',,A1A i1(I) r (,ý1 jr I I( ýIAfI )! - "PF ? -I i IFfI ) VAq :"') NSWCDD/TR-92/425 NSWC LIBRARY OF MATHEMATICS SUBROUTINES BY ALFRED H. MORRIS, JR. STRATEGIC AND SPACE SYSTEMS DEPARTMENT JANUARY 1993 Approved for public release; distribution unlimited. NAVAL SURFACE WARFARE CENTER DAHLGREN DIVISION Dahigren, Virginia 22448-5000 FOREWORD In 1976 development of the NSWC library of general purpose numerical mathematics subroutines began. Since that time six editions of the library have been released. for general use. This report describes the subroutines in the 1993 edition of the library, the seventh edition. The report supersedes N1WC TR 90-21 (1990). The development of the library is funded by the Computing Systems and Networks Division, Strategic and Space Systems Department, NSWCDD. Approved by: R. L. SCHMIDT, Head Strategic and Spa-e Systems Department L A~ '75(cid:127),.on For f -] -DI - -4- (cid:127)-= I i ii. .... . .... . ABSTRACT The NSWC library is a libi'ary of general purpose Fortran subroutines that provide a basic computational capability for a variety of mathematical activities. Emphasis has been placed on the transportability of the codes. Subroutines are available in the following areas: elementary operations, geometry, special functions, polynomials, vectors, matrices, large dense systems of linear equations, banded matrices, sparse mr'trices, eigenvalues and eigenvectors, t4 solution of linear equations, least-squares solution of linear equations, op- timization, transforms, approximation of functions, curve fitting, surface fitting, manifold fitting, numerical integration, integral equations, ordinary diffe:,ential equations, partial differential equations, and random number generation. ---- _ CONTENTS Page Introduction ............................... .......................................... 1 Elementary Operations Machine Constants - SPMPAR,DPMPAR,IPMPAR ............................ 3 Argument Bounds for the Exponential Function - EPSLN,EXPARG,DEPSLN,DXPARG ................................... 5 Sorting Lists - ISHELL,SHELL,AORD,RISORT,SHELL2,DSORT, DAORD,DISORT,DDSORT,QSORTI,QSORTR,QSORTD.,IORDER, RO RDER,D O RDER .................................................... 7 Cube Root - CBRT,DCBRT .................................................. 11 Four Quadrant Arctangent - ARTNQ,DARTNQ .............................. 1.1 Length of a Two Dimensional Vector - CPABS,DCPABS ...................... 11 Reciprocal of a Complex Number - CREC,DCREC .......................... 13 1 Division of Complex Numbers - CDVI,DIVID ................................. 13 Square Root of a Double Precision Complex Number - DCSQRT ............ 13 Conversion of Polar to Cartesian Coordinates - POCA ....................... 15 Conversion of Cartesian to Polar Coordinates - CAPO ...................... .15 Rotation of Axes - RO TA .................................................... 15 Planar Givens Rotations - SROTG,DROTG .................................. 17 Three Dimensional Rotations - ROT3 ......................................... 19 Rotation of a Point oni the Unit Sphere to the North Pole - CONSTR ......... 21 Computation of the Angle Between Two Vectors - ANG ....................... 23 Trigonometric Functions - SIN1,COS1,DSIN1,DCOS1 ......................... 25 Hyperbolic Sine and Cosine Functions - SNIICSH ............................. 27 Exponentials - REXP,DREXP ................................................ 29 Logarithms - ALNREL,RLOG ,RLOG1,DLNREL,DRLOG,DRLOG 1 ........... 31 Geometry Determining if a Point is Inside or Outside a Polygon - LOCPT .............. 33 I Intersection of a Straight Line and Polygonal Path -- PFIND .................. 35 The Convex Hull for a Finite Planar Set -- HULL .............................. 37 Areas of Planar Polygons -- PAREA ........................................... 39 H am iltonian C ircuits - H C .................................................... 41 Special Functions Error Function -- CEItF,CERtF'C,ERF,EItFC,ERF C ,I)Cl(E'RF,DCIFti'., i)E1iF,DER1FC,I)ERIC1 ...................................... 45 lnverse Error Function -ERlFI,I) FI F1 .................. ..................... 51 Diffvrencc ,f Error Functions - AERF,I)AEPFt ......... ............ ......... 53 Normal Probability Distribution Function -- PNI .... ... . 55 Inverse N,,rnriu Pl obability Distribution Function - 'NI,I)PN1 I...... ......... 57 ID aw son's Integral l)AW ,J) I)I)A W ........................................... 59 vii Complex F'resnel Integral - CFRNLI ....................................... 61 Real Fresnel Integrals - FRNL.............................................. 63 Exponential Integral Function - CEXPLI,EXPLI,DEI)DEI1 .................. 65 Sine ana Cosine Integral Functions - SI,CIN ................... I.... I.........69 IExponential E'xponential Integral Function - CEXEXI ....................... 71 Dilogarithm Function - CLI,ALI............................................ 73 Gamma Function - CG AMMA,G AMMA,GAMLN,DCG AMA, DGAMMA,DGAMLN ............................................... 75 Digamma Function - CPSI,PSI,DCPSI,DPSI ................................ 79 Derivatives of the Digamma Function - PSIDF............................... 81 Incomplete Gamma Ratio Functions - G RATIO, RCOMP, DG RAT DRCOMP ...................................................... ... 83 Inverse Incomplete Gamma Ratio Function - GAMINV,DGINV ............... 85 Logarithm of the Beta Function - BE'2ALN,DBETLN ........... I.............87 Incomplete Beta Function - BRATIO,ISUBX,BRCOMP ................ ...... 89 Bessel Function Ji,(z) - CBSSLJ,BSSLJ,BESJ............................... 91 Bessel Function Y,,(z) - BSSLY ..................... ....................... 93 Modified Bessel Funct)*on 1,(z) - CBSSLI,BSSLI,BESI ....................... 95 IModified Bessel Function K1,(z) - CBESK,CBSSLK,BSSLK ................... 97 Airy functions - CAI,CBI,AI,AIE,BI,BIE.................... I............... 99 Complete Complex Elliptic Integrals of the First and Second Kinds - CK,CKE............................ ............ ...... I.......... 103 Real Elliptic Integrals of the First and Second Kinds - ELLPI,RF VAL, RDVAL,D ELLPI,DRF VAL,DRDVAL .................. 107 Real Elliptic Integrals of the Third Kind - EPI,RJVAL, DEPI,DRJVAL......................... ........................... 11ll Jacobian Elliptic Functions - ELLPF,ELPFC1 .......................... ... 115 Weierstrass Elliptic Function for the Equianharmonic and Lemniscatic Cases -- PEQPEQ1,PLEM,PLEM1 ................... 119 Integral of the Bivariate Density Function over Arbitrary Polygons and Semi-infinite Angular Regions - VALR2................. 123 Circular Coverage Function - CIRCV ...................................... 125 Elliptical Coverage Function - PKILL .................................... 127 Polynomials Copying Polynomials - PLCOPY,DPCOPY................................. 129 Addition of Polynomials - P.ADD,DPADD.................................. 131 Subtrartion of Polynomials -- PSUBT,DPSUBT............................. 133 Multiplication of Polynomials -- PMt.LT,DPMUIJT.......................... .135 lDivision of Polynomials- PDIV,DPD1V.................................... 137 Real Powers of lPotyriomials - PILIWR?,D1PLPWR ........................... 139 Inverses of Power Series -- PIN1VL)P1NV................................. 141 Derivatives and1 Integrals of Polynomials -- MIPLNMV........ ............... 143 Evaluation of Cliebysliev Expansions -- C1SEVL I)CSEVI .................... 145 Lagrange Polynoial~s -- l(RNG N,,G RNG V,LG RNXX ......................147 Orthogonal lPolynoImiiJ2, on' Finite Seits OIITILOS,Ol{THIOV, Oft'F'l X.......................................................... 149 voli Solutions of Nonlinear Equations IZeros of Continuows Functions-. ZEROIN,DZERO............... .......... 151 Solution of Systems of Nonlinear Equatiors - HBRD .... .......... 153 Solutions of Quadratic, Cubic, and Quartic Equations QD)CR.T,CI3CRT,QTCRT,DLQDCRT,DCBCRT,DQTCRT.ý....... ..... 155 Double Precision Roots of Polynomxials - DRPOLY,DCPOLY ............... 157 1A ccuracy of the Roots of Polynomnials - RBND,CBND...................... 159 Vec tors Copying Vectors - SCOPY,DCOPY,CCOPY .............................. 161 Interchanging Vectors - SSWAP,DSWAP,CSWAP.......................... 163 Planar Retation, of Vectors - SROT,DROT,CSROT..................... ... 1165 1Modified Givens Rotations - SROTMG,DROTMG,SROTM,D.ROTN/M.........167 Dot Products of Vectors - SDOT,DDOT,CDOTC,CDOTU ......... ......... 171 Scaling Vectors - SSCAL,DSCAL,CSCAL,CSS CAL............ ............ 173 Vector Addition - SAXPY,DAXPY,CAXPY................. ............. 175 L, Normn of a Vector - SASUM,DASUM,SCASUM ......................... 177 L2 Norm of a Vector - SNRM2,DNRM?,SCNRM2 ...... I.... I.............. 179 L,, Norm of a Vector - ISAMAX,IDAMAX,ICAMAX...................... 181 Matrices Packing and Unpacking Symmetric Matrices - MCVFS,DMCVFS, M4CVSF,D-MCVSF........................ ....................... 183 Conversion of Real Matrices to and from Double Precision Form - MCVRD,MCVDR ............................................... 185 Storage of Real Matrices in the Complex Matrix Format - MCVR.C..........187 The Real and Imaginary Parts of a Complex Matrix - CMREAL,CMIMAG................................... .......... 189 Copying M~atrices -- MCOPY,SMCOPY,DMCOPY,CMCOPY ............... 191 Computation of the Conjugate of a Complex Matrix - CMCONJ ............. 193 Transposing Matrices -- TPOSE,DTPOSE,CTPOSE,TIP,DTIP,CTIP ......... 195 Computing Adjoints of C"omnpkx Matrices - CMADJ,CTRANS............... 197 Matrix Addition --M ADD,SMADD,DMADD,CMADD ..................... 199 ~~Matrix Subt-raction -- MSLUI3T,SMSUBT,DMSUBT,rCMSUBT ............... 201 4 Matrix Multiplication - MTMS,DMTMS,CMTMS,MPROD,DMPROD, CMPROD............................... ....................... 203 Product of a Packed Symmu-etric Matrix and a Vector - SVPRD,I,-SVPRD ............... . ý............................... 205 Transpose Matrix Products - TIMPROD .......... ............. ......... 207 Symmetr~ic Matrix Products -. SMPROI)......... ... ................ ... 209 Kronecker Product of Matriccos -- KPROD,DKPROD, 'KP.OL ............. I2t1 R1ank of a Reai Matrix- RNK,D)RNK ......... ....... ................... 213 Inverting Generai Peal Matrices and Solving General Sy stemrs of Real Linear Equations --CR0 UT, KRI01T,r NPIIVOTI',MSIV , )MSILV ,NS1N,DýlLMSV! .................... ...... 215 Soluiton f Real Eqjuations wvithý Iterative Imnprovement -- S LVMI ........... 22 0 ix Solution of Almost Block Diagonal Systems of Linear Equations - ARCECO,ARCESL ...................................... 223 Solution of Almost Block Tridiagonal Systems of Linear Equations - BTSLV .................................... .............. 225 Inverting Symmetric Real Matrices and Solving Symmetric Systems of Real Linear Equations - SMSLV,DSMSLV ................. 227 Inverting Positive Definite Symmetric Matrices and Solving Positive Definite Symmetric Systems of Linear Equations - PCHOL,DPCtIOL ................................ 231 Solution of Toeplitz Systems of Linear Equations - TO PLX ,D TO PLX .................................................... 233 Inverting General Complex Matrices and Solving General Systems of Complex Linear Equations- CMSLV,CMSLV1, D C M SLV ............................................................. 235 Solution of Complex Equations with Iterative Improvement - C SLV M P ................... ..... ................................. 239 Singular Value Decomposition of a Matrix -- SSVDC,DSVDC, C S V D C ...... ..... .................................................. 241 Evaluation of the Characteristic Polynomial of a Matrix - DET,DPDET,CDET ................................................. 243 Solution of the Matrix Equation AX + XB C - ABSLV,DABSLV ........... 245 Solution of the Matrix Equation AeX + XA C when C is Symmetric - TASLV,DTASLV ........................................ 247 Solution of the Matrix Equation AX 2 + BX -+-C = 0 -- SQUINT ............ 249 Exponential of a Real Matrix - MEXP,DMEXP .............................. 251 Large Dense Systems of Linear Equations Solving systems of 200-400 Linear Equations -- LE,DPLE,CLE ............... 253 Sanded Matrices B and M atrix Storage ...................... ............................. ... 255 Conversion of Banded Matrices to and from the Standard Format - CVBR,CVBD,CVBC,CVRB,CVDB,CVCB,CVRB 1, CVDB1,CVCB1 ................................................... 257 Conversion of Banded Matrices to and from Sparse Form - MCVBS,DMCVBSCMCVBS,M(CVSB,DMCVSB,CMCVSB ........... 259 Conversion of Banded Real Matrices to and from Double Precision Form -- BCVRD,BCVDR ........ ...................... 261 The Real and Imaginary Parts of a Banded Complex Matrix -- B R EA L ,B IM A G ........................... ............... .......... 263 Computing A + Bi for Banded Real Matrices A and B IBCVRC ............ 265 Transposing Banded Matrices - BPOSE,DIBPOSE,CII OSF. 267 Addition of Banded Matrices - BADD,DBADD,C3ADI) ................. 269 Subtraction of Banded Matrices - BSIJiB,D3SUti,,CUB t .............. 271 Multiplication of Banded Matrices - BPROD, DIBPROD,CBPROIb .......... 271 Product of a Real lBanded Matrix and Vector - BVPRI),JIVPHI 1), BT1P Rl),BT P~R D I ................................................... 2 75 x Product of a Double Precision Banded Matrix and Vector - DB3VPD,DI WPDI ,DBTPDDBTPD1 ............................... 277 Product of a Complex Banded Matrix and Vector - CBV]?D, CBVPD1,CBTPD,CBTPD1 .......................................... 279 L, Norm of a Real Banded Matrix - B1NRM,DBINRM ...................... 281 L, Norm of a Real Banded Matrix - BNRM,DBNRM ...................... 283 Solution of Banded Systems of Real Linear Equations - B SLV ,B SLV 1 ................................................. ...... 285 Computation of the Condition Number of a Real Banded M atrix -- B 1C N D ............ ........................................ 287 Double Precision Solution of Banded Systems of Real Linear Equations - DBSLV,DBSLVI ................. ... ..................... 289 Computation of the Condition Number of a Double Precision Banded M atrix - DB1CND ..................... ..................... 291 Solution of Banded Systems of Complex Linear Equations - C B SLV ,C B SLV i ...................................................... 293 Sparse Matrices Storage of Sparse M atrices ................................................... 295 Conversion of Sparse Matrices to and from the Standard Format - CVRSCVDS,CVCS,CVSR,CVSD,CVSC .................. 297 Conversion of Sparse Real Matrices to and from Double Precision Form - SCVRD,SCVDR ................................... 299 The Real and Imaginary Parts of a Sparse Complex Matrix - C SIZEA L,C SIM A G ................................................... 301 Coi(cid:127)puting A + Hi for Sparse Real Matrices A and B - SCVRC .............. 303 Copying Sparse Matrices - RSCOPY,DSCOPY,CSCOPY ................... 305 Computing Conjugates of Sparse Complex Matrices - SCONJ ................ 307 Transposing Sparse Real Matrices -- RI OSE,RPOSE1 ........................ 309 Transposing Sparse Double Precision Matrices - DPOSE,DPOSE1 ........... 311 Transposing Sparse Complex Matrices -- CPOSE,CPOSEI .................. 313 Addition of Sparse Matrices- SADI),DSADD,CSAID ...................... 315 Subtrac~tion of Sparse Matrices SS1JBTr,DSSUBT,CSSU ITr. ............... 317 Multiplication of Sparse Matrices - SPROD,DSPROI),CStIRO) ............. 319 Product of a Real Sparse Matrix arid Vector - MVPR1),MVPRDI, M Tl IPI ),M T'lRIID ........................ ......................... 3ý1 l'roduct of a l)ouble Precision Spz.rse Matrix and Vector- I)VI1RI),)VIJ)RI) I ,DTI)TlI),l)TPRlI)1 .............................. 323 ProdAct of a. Complex Sparse Matrix and Vector CV PR!), CVI I,(I' ) ,l'lII) 1.......... . .......................... 325 "L, Norm ,f a Sparse I cal Matrix SIN RM,I)SIN!?M ...................... 32 I.._ Norm (f a Spare R{eal Matrix SN1?M I)SNIHN ..... )rdvriog the )WS (If ifa Spas NI attrix by ho revasilg Ic lig t h S P O(I NI ) .. ........... ......................... . . ... ....... 3 3 1 lP(.r&.rii,(cid:127) SpLerse .ncir ic-(cid:127) jtWb Ick Triaogular l"')rin l i) ................... ... . .... ........ ... ... '(i Solution of Sparse Systems of Real Linear Equations - SPSLV ,RSLV ,TSLV ................................................... 335 Computation of the Condition Number of a Real Sparse M atrix - S1C N D .............................................. ....... 339 Double Precision Solution of Sparse Systems of Real Linear Equations - DSPSLV,DSLV,DTSLV ................................ .41 Computatior of the Condition Number of a Double Precision Sparse M atrix -- DSICND ............................................. 345 Solution of Sparse Systems of Complex Linear Equations - CSPSLV ,CSLV,CTSLV ................................................ 347 Eigenvalues and Eigenvectors Computation of Eigenvalues of General Real Matrices - EIG,EIG1 .................. ....................................... 351 Computation of Eigenvalues and Eigenvectors of General Real Matrices -- EIGV,EIGV1 ...................................... 353 Double Precision Computation of Eigenvalues of Real M atrices - D EIG ....................... ............................. 355 Double Precision Computation of Eigenvalues ai Eigenvectors of Real Matrices - DEIGV ............................... 357 Computation of Eigenvalues of Symmetric Real Matrices - SE IG ,SE IG I .......................................................... 359 Computation of Eigenvalues and Eigenvectors of Symmetric Real M atrices - SEIGV,SEIGV1 ...................................... 361 Double Precision Computation of Eigenvalues of Symmetric Real M atrices - DSEIG .............................................. 363 Double Precision Computation of Eigenvalues and Eigenvcctors of Symmeuric Real Matrices - DSEIGV .................. 365 Computation of Eigenvalucs of Complex Matrices - CEIG .................... 367 Computation of Eigenvalues and Eigenvcctors of Complex M atrices - C EIG V .................................................... 369 Double Precision Computation of Eigerivalues of Complex Miet -.. ,I11 (,... 371i Matrices D ACI(................. ......................... 371 Double Precision C(omputation of Eigenvalues and Eigenvectors of Complex Matrices - !)CEIG V ....................... 373 t, Solution of Linear Equations f, Solution of Systems of Linear EI'quations with Equality and hInquality Co;istrkiints CIA .................................. 375 Least Squares Solution of Linear Equations L east Squ:.ires Solitioi, of S ' stems of Linear Equations 1,LSQ, LSQ tI,l IF'TI,I I F''I2 ................ ......... . ......... 177 Lva-,.t Squarcs Solutionl of Overdeterwitir'l Svs..crns of lInear q'A(tolitos "wit ~h Iter;.ti vc lIoproveinent 1,1 QM P .... . .. . 3v3 )0oblet''r ecision lexcit. Sq(tuAVres S;iltioln of S(cid:127)ysteuis of linear Eqtations l)LII Q ,I)I1 11 'I'1,1) 11 2 ....... :s85 xii

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.