c2-9 (779467)
Текст из файла
2.7 Sparse Linear Systems89void dsprstx(double sa[], unsigned long ija[], double x[], double b[],unsigned long n);These are double versions of sprsax and sprstx.if (itrnsp) dsprstx(sa,ija,x,r,n);else dsprsax(sa,ija,x,r,n);}The matrix is stored somewhere.void asolve(unsigned long n, double b[], double x[], int itrnsp){unsigned long i;for(i=1;i<=n;i++) x[i]=(sa[i] != 0.0 ? b[i]/sa[i] : b[i]);e is the diagonal part of A, stored in the first n elements of sa. Since theThe matrix Atranspose matrix has the same diagonal, the flag itrnsp is not used.}CITED REFERENCES AND FURTHER READING:Tewarson, R.P. 1973, Sparse Matrices (New York: Academic Press). [1]Jacobs, D.A.H.
(ed.) 1977, The State of the Art in Numerical Analysis (London: AcademicPress), Chapter I.3 (by J.K. Reid). [2]George, A., and Liu, J.W.H. 1981, Computer Solution of Large Sparse Positive Definite Systems(Englewood Cliffs, NJ: Prentice-Hall). [3]NAG Fortran Library (Numerical Algorithms Group, 256 Banbury Road, Oxford OX27DE, U.K.).[4]IMSL Math/Library Users Manual (IMSL Inc., 2500 CityWest Boulevard, Houston TX 77042). [5]Eisenstat, S.C., Gursky, M.C., Schultz, M.H., and Sherman, A.H. 1977, Yale Sparse Matrix Package, Technical Reports 112 and 114 (Yale University Department of Computer Science). [6]Knuth, D.E.
1968, Fundamental Algorithms, vol. 1 of The Art of Computer Programming (Reading,MA: Addison-Wesley), §2.2.6. [7]Kincaid, D.R., Respess, J.R., Young, D.M., and Grimes, R.G. 1982, ACM Transactions on Mathematical Software, vol. 8, pp. 302–322. [8]PCGPAK User’s Guide (New Haven: Scientific Computing Associates, Inc.). [9]Bentley, J. 1986, Programming Pearls (Reading, MA: Addison-Wesley), §9. [10]Golub, G.H., and Van Loan, C.F.
1989, Matrix Computations, 2nd ed. (Baltimore: Johns HopkinsUniversity Press), Chapters 4 and 10, particularly §§10.2–10.3. [11]Stoer, J., and Bulirsch, R. 1980, Introduction to Numerical Analysis (New York: Springer-Verlag),Chapter 8. [12]Baker, L. 1991, More C Tools for Scientists and Engineers (New York: McGraw-Hill). [13]Fletcher, R. 1976, in Numerical Analysis Dundee 1975, Lecture Notes in Mathematics, vol.
506,A. Dold and B Eckmann, eds. (Berlin: Springer-Verlag), pp. 73–89. [14]Saad, Y., and Schulz, M. 1986, SIAM Journal on Scientific and Statistical Computing, vol. 7,pp. 856–869. [15]Bunch, J.R., and Rose, D.J. (eds.) 1976, Sparse Matrix Computations (New York: AcademicPress).Duff, I.S., and Stewart, G.W. (eds.) 1979, Sparse Matrix Proceedings 1978 (Philadelphia:S.I.A.M.).Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.
Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).extern unsigned long ija[];extern double sa[];90Chapter 2.Solution of Linear Algebraic Equations2.8 Vandermonde Matrices and ToeplitzMatricesVandermonde MatricesA Vandermonde matrix of size N × N is completely determined by N arbitrarynumbers x1 , x2 , . .
. , xN , in terms of which its N 2 components are the integer powersxj−1, i, j = 1, . . . , N . Evidently there are two possible such forms, depending on whetheriwe view the i’s as rows, j’s as columns, or vice versa. In the former case, we get a linearsystem of equations that looks like this,11. ..1x1x21···x2...xNx22...x2N······−1xN1 −1 xN2·.. . −1xNNc1c2...cN = y1y2 .. .
yN(2.8.1)Performing the matrix multiplication, you will see that this equation solves for the unknowncoefficients ci which fit a polynomial to the N pairs of abscissas and ordinates (xj , yj ).Precisely this problem will arise in §3.5, and the routine given there will solve (2.8.1) by themethod that we are about to describe.Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.
Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).In §2.4 the case of a tridiagonal matrix was treated specially, because thatparticular type of linear system admits a solution in only of order N operations,rather than of order N 3 for the general linear problem. When such particular typesexist, it is important to know about them.
Your computational savings, should youever happen to be working on a problem that involves the right kind of particulartype, can be enormous.This section treats two special types of matrices that can be solved in of orderN 2 operations, not as good as tridiagonal, but a lot better than the general case.(Other than the operations count, these two types having nothing in common.)Matrices of the first type, termed Vandermonde matrices, occur in some problemshaving to do with the fitting of polynomials, the reconstruction of distributions fromtheir moments, and also other contexts. In this book, for example, a Vandermondeproblem crops up in §3.5. Matrices of the second type, termed Toeplitz matrices,tend to occur in problems involving deconvolution and signal processing.
In thisbook, a Toeplitz problem is encountered in §13.7.These are not the only special types of matrices worth knowing about. TheHilbert matrices, whose components are of the form aij = 1/(i + j − 1), i, j =1, . . . , N can be inverted by an exact integer algorithm, and are very difficult toinvert in any other way, since they are notoriously ill-conditioned (see [1] for details).The Sherman-Morrison and Woodbury formulas, discussed in §2.7, can sometimesbe used to convert new special forms into old ones. Reference [2] gives some otherspecial forms.
We have not found these additional forms to arise as frequently asthe two that we now discuss.2.8 Vandermonde Matrices and Toeplitz Matrices91The method of solution of both (2.8.1) and (2.8.2) is closely related to Lagrange’spolynomial interpolation formula, which we will not formally meet until §3.1 below.
Notwithstanding, the following derivation should be comprehensible:Let Pj (x) be the polynomial of degree N − 1 defined byPj (x) =NYn=1(n6=j)Xx − xn=Ajk xk−1xj − xnk=1N(2.8.3)Here the meaning of the last equality is to define the components of the matrix Aij as thecoefficients that arise when the product is multiplied out and like terms collected.The polynomial Pj (x) is a function of x generally. But you will notice that it isspecifically designed so that it takes on a value of zero at all xi with i 6= j, and has a valueof unity at x = xj . In other words,NXPj (xi ) = δij =Ajk xk−1i(2.8.4)k=1, whichBut (2.8.4) says that Ajk is exactly the inverse of the matrix of components xk−1iappears in (2.8.2), with the subscript as the column index.
Therefore the solution of (2.8.2)is just that matrix inverse times the right-hand side,wj =NXAjk qk(2.8.5)k=1As for the transpose problem (2.8.1), we can use the fact that the inverse of the transposeis the transpose of the inverse, socj =NXAkj yk(2.8.6)k=1The routine in §3.5 implements this.It remains to find a good way of multiplying out the monomial terms in (2.8.3), in orderto get the components of Ajk . This is essentially a bookkeeping problem, and we will let youread the routine itself to see how it can be solved. One trick is to define a master P (x) byP (x) ≡NY(x − xn )(2.8.7)n=1work out its coefficients, and then obtain the numerators and denominators of the specificPj ’s via synthetic division by the one supernumerary term.
Характеристики
Тип файла PDF
PDF-формат наиболее широко используется для просмотра любого типа файлов на любом устройстве. В него можно сохранить документ, таблицы, презентацию, текст, чертежи, вычисления, графики и всё остальное, что можно показать на экране любого устройства. Именно его лучше всего использовать для печати.
Например, если Вам нужно распечатать чертёж из автокада, Вы сохраните чертёж на флешку, но будет ли автокад в пункте печати? А если будет, то нужная версия с нужными библиотеками? Именно для этого и нужен формат PDF - в нём точно будет показано верно вне зависимости от того, в какой программе создали PDF-файл и есть ли нужная программа для его просмотра.