c2-10 (779468), страница 2
Текст из файла (страница 2)
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).void qrupdt(float **r, float **qt, int n, float u[], float v[])Given the QR decomposition of some n × n matrix, calculates the QR decomposition of thematrix Q · (R+ u ⊗ v). The quantities are dimensioned as r[1..n][1..n], qt[1..n][1..n],u[1..n], and v[1..n].
Note that QT is input and returned in qt.{void rotate(float **r, float **qt, int n, int i, float a, float b);int i,j,k;102Chapter 2.Solution of Linear Algebraic EquationsWe will make use of QR decomposition, and its updating, in §9.7.CITED REFERENCES AND FURTHER READING:Golub, G.H., and Van Loan, C.F.
1989, Matrix Computations, 2nd ed. (Baltimore: Johns HopkinsUniversity Press), §§5.2, 5.3, 12.6. [2]2.11 Is Matrix Inversion an N 3 Process?We close this chapter with a little entertainment, a bit of algorithmic prestidigitation which probes more deeply into the subject of matrix inversion. We startwith a seemingly simple question:How many individual multiplications does it take to perform the matrixmultiplication of two 2 × 2 matrices,a11a21a12a22 b11·b21b12b22=c11c21c12c22(2.11.1)Eight, right? Here they are written explicitly:c11 = a11 × b11 + a12 × b21c12 = a11 × b12 + a12 × b22c21 = a21 × b11 + a22 × b21(2.11.2)c22 = a21 × b12 + a22 × b22Do you think that one can write formulas for the c’s that involve only sevenmultiplications? (Try it yourself, before reading on.)Such a set of formulas was, in fact, discovered by Strassen [1].
The formulas are:Q1 ≡ (a11 + a22 ) × (b11 + b22 )Q2 ≡ (a21 + a22 ) × b11Q3 ≡ a11 × (b12 − b22 )Q4 ≡ a22 × (−b11 + b21 )Q5 ≡ (a11 + a12 ) × b22Q6 ≡ (−a11 + a21 ) × (b11 + b12 )Q7 ≡ (a12 − a22 ) × (b21 + b22 )(2.11.3)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).Wilkinson, J.H., and Reinsch, C. 1971, Linear Algebra, vol. II of Handbook for Automatic Computation (New York: Springer-Verlag), Chapter I/8. [1].