scientific computations

329
ΕΠΙΣΤΗΜΟΝΙΚΟΣ ΥΠΟΛΟΓΙΣΜΟΣ Ι Ευστράτιος Γαλλόπουλος Καθηγητής ΗΥ343 Τμήμα Μηχανικών Η/Υ και Πληροφορικής Πανεπιστήμιο Πατρών Φθινόπωρο 2008 c 2008, Ευστράτιος Γαλλόπουλος

Upload: panmerge

Post on 08-Apr-2016

288 views

Category:

Documents


14 download

DESCRIPTION

Scientific Computations

TRANSCRIPT

  • pi

    343 /

    pi

    pi 2008c2008, pi

  • pi pi pi-. pi pi, pi pi pi pi pi . - pi pi pi pi . pi pi - pi pi pi I pi / pi- . pi pi pi pi pi pi pi.

    http://scgroup.hpclab.ceid.upatras.gr/class/sc.html.

    pipi pi pi (pi , , , pi ,pi, on-line pi pi, , pi, pi.) .

    . pi . pi pi pi pi . pi - (pi RISC SVD). pi , pi.. cos 1. pi pi2:

    1 . pi, . -, . . pi (. : 1992),

    2 (. pi : ,1976).

    pi matrix pi pi pipi pi. pi pi , , pi , pi pi pi pi pipi ( pi ) pi array table. pi, polyval.m MATLAB POLYVALM Matrix polynomial evaluation. If V is a vector who-se elements are the coefficients of a polynomial, then POLYVALM(V,X) is thevalue of the polynomial evaluated with matrix argument X. See POLYVAL for

    1 pi , . pi - Strang pi pi .

    2 pi pi pi .

  • 4polynomial evaluation in the regular or array sense. pi , pi Mathematica, , . pi pi pi pi- pi pi 3. pi -pi pi pi, , . 4.

    pi pipi pi , pi pi pi pi pi pi /. pi, pi , : )110 (2 .): , ) 240 (4 .): pi. pi pi pi 261 (3.) ( pi) 205 ( ).

    pi, , () () G. Strang, / (1996) .. .. , / (1997). pi ( -) pi MATLAB ( version 7). pipi pi, ., pi pi , pi Scilab pi pi pi MATLAB , (pi http://www.scilab.org/)!

    pi : 1) G. Golub and C. F. Van Loan.Matrix Computations. The Johns Hopkins University Press, Baltimore, thirdedition, 1996. 2) N.J. Higham. Accuracy and Stability of Numerical Algorithms.SIAM, Philadelphia, 2002, 2nd. ed. pi C.W. Ueberhuber.Numerical Computation, volumes 1 and 2. Springer, Berlin, 1997. pi pi .

    pi , . pi pi - pi pi pi. pi pi pi pi pi pi. pi . pipi, pi- pipi pi . pi pi- pi pipi ( ). pi pi pi pi pi . pi

    3 pi pi pi, matrix, pi , 2 (. xxxiv).

    4 . 1xvii 2 pi.

  • 5pi, pi, pi, , -pi, . pi pi pi pi pi pi. pi pi pi pi pi pi ().

    pi pi - . . pi, , , , . -, pi pi, pi, pi-, , , pi, , pi pi pi- .pi pi, , , pi, , pi, pi pi pi -. pi pi LaTEX pi pi . pi pi pi .

    pi pi pi pi pi-. , pi pi . pi, pi, - , pi pi pipi . , pi pi- pi pi .

    . pi 2008

  • 1 51.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.4 pi . . . . . . . . . . . . . . . . . . . . . . . . 12

    1.4.1 . . . . . . . . . . . . . . . . . . . . 121.4.2 , , pi -

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141.5 . . . . . . . . . . . . . . . . . . . . . . . . . 161.6 . . . . . . . . . . . . . . . . . . . . . . 161.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181.8 . . . . . . . . . . . . . . . . . 19

    2 pi 272.1 pi . . . . . . . 28

    2.1.1 pi pi . . . . . . . . . . . 322.2 pi . . . . . . . . . . . . . . . . . . . . . . . . . 33

    2.2.1 pi . . . . . . . . . . 342.3 . . . . . . . . . . . . . . . . . . . . . . 392.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412.5 . . . . . . . . . . . . . . . . . 41

    3 pi 473.1 pi . . . . . . . . . . . . . . . . . . . . . 483.2 pi . . . . . . . . . . . . . . 49

    3.2.1 pi, pi . . . . . . . . . . 513.2.2 pi bit . . . . . . . . . . . . . . . 533.2.3 ... . . . . . . . . . . . . . . . . 543.2.4 . . . . . . . . . . . . . . . . . . . . 55

    3.3 pi . . . . 583.4 pipi pi . . . . . . 63

    3.4.1 pi pipi . . . . . . . . . . . . . 653.4.2 pipi pi . . . 663.4.3 . . . . . . . . . . . . 683.4.4 Fused Multiply and Add (FMA) . . . . . . . . . . . 683.4.5 pi Java . . . . . . . . . . . . . . . . . . . . . . 70

    3.5 pi pi . . . . . . . . . . . 713.6 pi . . . . . 86

    1

  • 2

    3.6.1 . . . . . . . . . . . . . . . . . . . . . . 873.6.2 . . . . . . . . . . . . . . . . . . . . 87

    3.7 . . . . . . . . . . . . . . . . . . . . . . . 893.8 . . . . . . . . . . . . . . . . . . . . . . 913.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983.10 . . . . . . . . . . . . . . . . . 106

    4 1114.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

    4.1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . 1124.1.2 pi pi . . . . . . . 113

    4.2 . . . . . . . 1144.2.1 . . . . . . . . . . . . . . . . 1144.2.2 . . . . . . . . . . . . . . . . 1184.2.3 pi . . . . . . . . . . 1214.2.4 -: pi . . . . . . . . 1234.2.5 pi pipi . . . . . . . . . . . . 1274.2.6 BLAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    4.3 pi . . . . . . . . . . . . . . . . 1324.4 pi . . . . . . . . . . . . . . . . . . . . . . . . 1324.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1384.6 . . . . . . . . . . . . . . . . . . . . . . 1394.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

    5 II 1515.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1515.2 pi . . . . . . . . . . . . . . . . . . . . . . . . . . 1535.3 pi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1575.4 pi pi . . . . . . . . . . . . . . . 165

    5.4.1 pi pi . . . 1665.4.2 . . . . . . . . . . . . . . . . 168

    5.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 1715.6 pi . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

    5.6.1 pi . . . . . . . . . . . . . . . . 1785.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

    5.7.1 pi . . . . . . . . . . 1865.8 pi .1 . . . . . . . . . . . . . . . . . . . . . . . 1925.9 . . . . . . . . . . . . . . . . . 194

    5.9.1 pi Cholesky . . . . . . . . . . . . . . . . . . 1945.10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1975.11 pi . . . . . . . . . . . . . . . . . . . . . . . . . 2005.12 pi . . . . . . . . . . . . . . . . . . . . . 2005.13 . . . . . . . . . . . . . . . . . . . . . . 2015.14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

    6 III 2176.1 pi QR . . . . . . . . . . . . . . . . . 2186.2 pi . . . . . . . . . . . . . . . . . . 218

    6.2.1 pi . . . . . . . . . . . . . . . . . . . . . . 2196.2.2 pi Gram-Schmidt . . . . . . . . . . . . 220

  • 3

    6.2.3 pipi GS . . . . . . . . . . . . . . . . 2226.2.4 Householder pi . . . . . . . . . 2236.2.5 pi . . . . . . . . . . . . . . . 225

    6.3 pi QR: Householder . . . . . . . . . . . . 2266.3.1 pi pipi QR . . . . . . . . . . 2276.3.2 QR Householder . . . . . . . . . . . . . . 2286.3.3 pi .2 QR . . . . . . . . . . . . . . . . . . . . . 2306.3.4 . . . . . . . . . . . . . . . 2316.3.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

    6.4 Givens . . . . . . . . . . . . . . . . . . . . . . . . . . 2346.4.1 pi pi . . . . . . . . . . . . . . . . . . . 2356.4.2 pi Givens . . . . . . . . . . . . . . . . 2366.4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2376.4.4 QR Givens . . . . . . . . . . . . . . . . . . . . . . . . . 2376.4.5 . . . . . . . . . . . . . . . . . . . . . . . . 238

    6.5 . . . . . . . . . . . . . . . . . . . . . . 2406.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241

    7 IV 2457.1 / . . . . . . . . . . . . . . . . . . . . . . . . . 2467.2 . . . . . . . . . . . . . . . . . . . . . . . . 251

    7.2.1 : . . . . . . . . . . 2517.2.2 Vandermonde . . . . . . . . . . . . . . . . . . . . . 2537.2.3 Toeplitz . . . . . . . . . . . . . . . . . . . . . . . . 2597.2.4 pi Toeplitz . . . . . . . . . . . . . 2607.2.5 . . . . . . . . . . . . . . . . . . . . . . . 265

    7.3 . . . . . . . . . 2677.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

    8 2758.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

    8.1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2788.2 pi pipi . . . . . . . . . . . . . 278

    8.2.1 pi pipi . . . . . . . . . . . 2798.2.2 pi pi . . . . . . . . . . . . . 2878.2.3 Euler . . . . . . . . . . . . . . . . . . . . . . . . . . 2908.2.4 Taylor, Runge-Kutta pi Richardson . . 2988.2.5 - : . 304

    8.3 . . . . . . . . . . . . . . . . . . . . . . 3108.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3108.5 . . . . . . . . . . . . . . . . . 314

    317.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

    .1.1 . . . . . . . . . . . . . . . . . . . . . . . 317.1.2 . . . . . . . . . . . . . . . . . . . . . . . . . 318

    .2 Lipschitz . . . . . . . . . . . 319.3 . . . . . . . . . . . . . . . . . . 320

  • 4

  • 1

    1.1

    pi pi pi , pi 1 pi pi pi . pipipi :

    1980 pipi pi , pi pi . pi pi-pi Future Directions in ComputationalMathematics, Algorithms and Scientific Software. - : The use of modern computers in scientific and engineering researchand development over the last three decades has led to the inescapableconclusion that a third branch of scientific methodology has been created.It is now widely acknowledged that, along with the traditional theoreticaland experimental methodologies, advanced work in all areas of scienceand technology has come to rely critically on the computational approa-ch. (pi [33]).

    It is becoming clear that dramatic increases in computing power are ne-cessary but insufficient to making high-performance computing a reality.Necessary is also the construction of a large body of applications capableof using that computational power effectively ( [3] pi Alpern Carter2.)

    It is essential to recognize the fact that computer experiments can bothbe a two-way bridge between Physical Experiments and MathematicalModels, as well as an independent source of physical understanding.Such experiments have a mind-bending potential for future explorationsof natures secrets, which is only vaguely recognized today. (pi

    1pi, . pi 2.2 Bowen Alpern Larry Carter Computer Scientists IBM Yor-

    ktown Heights. Carter University of California, San Diego (UCSD).

    5

  • 6 1. c2008, .

    Jackson3 [23]).

    : pipi, pi pi, pi, pi , pi-pi pi . pi, - pipi pi pi. , pi pi pi, pi , pi . - pi pi pi pipi - pi pi . pi, pi pi pi: pi pi pi pi pi pi .(pi pi Michel Serres4 [35])

    pi pi pi. , pi computational science and enginee-ring . pi Computational Science and Engineering[12]. pi pi pi Golub Ortega5 [14, . 2]:

    Scientific computing is the collection of tools, techniques, and the-ories required to solve on a computer mathematical models of pro-blems in science and engineering.

    pi :

    , pi, pi pi pi pi -pi pi .

    pi pi pi pi pi- pipi . pi Mathe-matical Modelling pi pi pi pi [4, pi. 220].

    pipi pi pi pi pi(, , pi.) pi pi pi . pi pi pi pi.

    3 Atlee Jackson Center for Complex Systems Research Be-ckmann Center University of Illinois at Urbana-Champaign. pi Santa FeInsitute.

    4 Michel Serres 5 Gene Golub pi Stanford James Ortega

    University of Virginia.

  • 1.2. c2008, . 7

    1.1: [26]

    1 2 3 4 5 6 7 8 9 10 . . . * . . . * * *pi . . . . * * . . . . * . * . * * * . . . * * . . . . . . . . pi . * . . * . . . . . * . * * . . . . . .pi * . * . . * * . * .pi * . * . . . . * . . * * * * * * * . . ./pi * * * . . . . * * * pi * * . * . . . . . .pi . * * * * * * * . . *. pi. * . . * . . . . . .

    1. 2. . / pi. . .3. 4. pi. 5. (FFT, pi) 6. pi pi7. pipi (=multigrid) 8. pi 9. Monte Carlo 10.

    1.2

    pi : 1) pi-, 2) (, ), 3) pi pi , 4) pi pi pi pi.

    1.1, pi pi [26],pi pi pi pi pi pi pi pipi - .

    pi pi pi pi- pi pi pi pi. [26] (pi pi pi) pi pi pi pipi pi pi pi 6 pi . , pi pi. 1) pi pi pi pi- pi pi (restructuring compiler) 2) pi pi pi pipi pi- pi pi.. pi . pi pi pipi pi

    1. pi pi pi,

    6 pi (= legacy) (= dusty-deck) .

  • 8 1. c2008, .

    2. pi .

    pi 1.1 pi pi pi- . pi pi pi, pi pi pipi (= computational kernels). pi, pi pi pi Fourier pi pi . pi pipi pi pi pi Fourier ( pi FFT) pi ( -pi Gauss pi pi ). pi - pi . (pi pi ) pi pi pi pi pi pi. pi pi pi pi pi pi pi pi .

    1.2.1. pi (-) Fourier , pi - - pi pipi pi Fourier pi pi- pipi . 7.

    pipi , pi- pi pi pi pi pipi .

    pi pi pi pi ( pi pi pi pi pi7 ) . [24, 34].

    pi pi pi pi 1.1 pi pi pi -, pi pipi pi. pi, pi pi -pi pi pi pi pi.. pi pi pi, pi . - pi pipi pi pi pi (- ) pi . pi pi- (=input-output tables). pipi 8. -pi pi pi pi pi (= derivatives) [6]. -, pi

    7Grand Challenges of Computational Science [22].8 Wassily Leontief ( pi ) [28] -

    pi (pi) .

  • 1.3. c2008, . 9

    - - pi pi [11] pi pi .

    www.cs.sandia.gov/tech_reports/ripryor/Aspen.html.

    1.3

    pi pi pi pi :

    1.

    2.

    3.

    pi pi pi . pi pi pi pi pi pi, pi . - John Rice (Purdue University)9: Whatis an Answer? : pi , pi - pi pi pi - , . pi , pi pi pi pi pi10. pi pi pi pi, . , . pi-pi, pi pi pi. pi pi pi pi pi 1) , 2) pi- , 3) pi pi pi (..) pi , pi- . 4) pi pipi pi- pipi pi, .. , , pi. - , pi pi pi pi . 5) pi pi pi pi pi.

    pi , pipi pi pi. pi pi , pi pipi pi pi pi . pi pi- pi pi pi pi pi pi . () pi ...

    9 pi HERMIS, 1996.10 pi pi pi

    pi (particle methods).

  • 10 1. c2008, .

    pi pi pi pi pi pipi . pi pi pipi,pi.. pi Gauss pi Hotelling[19], pi n , pipi 4n pi . John von Neumann pi pi pi pi 11. pi pi [5]:

    In the elimination method a series of n compound operations isperformed each of which depends on the proceeding. An error atany stage affects all succeeding results and may become greatlymagnified; this explains roughly why instability should be expected.It should be noticed that at each step a division is performed bya number whose size cannot be estimated in advance and whichmight be so small that any error in it would be greatly magnified bydivision...

    pi pi pi -, John Wilkinson, almost every statement in it is either wrong ormisleading. , pi pi pi pi pi pi . pi pi von Neumann, Herman Goldstine, , von Neumann (pi- Turing), pi pi pi, pi pi Gauss [13] . pi [17].

    pi (pi Oscar Wilde)

    pi pi pi pi pi.

    , pi pi pi pi, pi.. pipi pi pi pi pipi . pi pi : pi ( pi pi !) pipi pi pi pi , , pi .

    As soon as an Analytical Engine exists, it will necessarily guide thefuture course of science. Whenever any result is sought by its aid,the question will then arise - By what course of calculation can theseresults be arrived at by the machine in the shortest time? .... Charles Babbage, [Passages from the Life of a Philosopher, 1864]

    pi pi . - (pi pipi

    11 .

  • 1.3. c2008, . 11

    pi pi O(1) pipe

    (vectorizing compilers)pi13 BLAS1 BLAS3 (1)(. + . + .) pi (. pi.) FFT (n/ logn)

    1.2: pi pi pi

    pi) pipi pi pi pipi. pi - pi pi pi pi pi-12 1.2. pipi pi pi pi pi pi pipi pi.

    pi . pi, pi - pi , pi pi . pi, pipi pi pi (pi.. pi,pi) pi pi - pi pi14. pi pi pi - : pi.. RAM PRAM pi pi .

    pi pi pi (benchmarks) . pi- Linpack benchmark pi pi pi- , pi pi pi pi pi .

    . pi pi - pi, pi pi .

    pi, pi pipi pi, pi pipi pi pi . pi pi pi pi pi . pi pi pi pi pi, .. ACM, pi LAPACK, .. .

    12 pi pi The Federal High Performance Computing Programpi pi 1989.

    13 Alpern Carter pi performance programming [3].14 pi Beresford Parlett [30].

  • 12 1. c2008, .

    :

    , pi, pi, .

    pi pi pi. , pi pipi pi, pipi pi , :

    1. pi .

    2. pi pi pi pipi pi .

    3. pipi pi pi pi- (pi.. RAM) pi pipi .

    1.3.1. Fourier pipi (pi (n2) (n log n) ) pi pi pi pi pi : pi n, pi pi pi pipi pi, pi pi pi .

    1.3.2. pi pipi Strassen, pi pipi (nlog 7) O(n3),pi pi pi pi pi pi pi-. pi pi : pi pipi , pi Strassen pi pi pi ! pi pi pi pi pi pi pi.

    1.4 pi

    pi pi pipi pi pi pi. pi pi .

    1.4.1

    pi - pi pi pi pipi . pi pi pi pi pi pi -. pi , pi pi pi pi. - :

  • 1.4. pi c2008, . 13

    1. RISC : - (register files), -pi LOAD-STORE, pipelining) . [8] pi pi RISC . pi pi pi URL

    http://www.ee.siue.edu/ mvinant/g_info/cpu_hist.htm#RISC.

    2. pi (, - , , /). pi (pi ), pi pi pi- pi pi pi pi. , pi chip (single-chip processor), pins chip pi pi pi pi- pi pi single-chip pi pi15 pi pi- pi chip pi. pi on-chip pipi- pi pi pi pi off-chip. on-chip :

    () (register files). (instruction cache). (data cache).

    , pi pi pi on chip pi. pi pi , pi- pipi pi. pi pi pi pi pi pipi -pi pi - pi ( ) pi pi . pi pi :

    ... the operation count is not necessarily an adequate figureofmerit in comparing theoretically the value of algorithms innumerical analysis [ . . . ] Other factors, such as [ . . . ] thepattern in which memory banks of the computer are referenced,may be as important as the operation count in determining thespeed of a program... [18]

    3. pi - pi, pi.. pi (superscalar)

    15 pi single-chip pi pin-bandwidth limitated.

  • 14 1. c2008, .

    pi, pi (= clusters), - (networks of workstations = NOW) (Grid) pi pipi pi-.

    pi pi . [16]. pi .

    pi pi pi pi pi- pi ( ) , pi pi pi, pi, pi pi (pi.. pi RISC, pi ). pi , , pi- pi pipi pi . pi, SIMD = Single Instruction Multiple Data) - streaming Intel, pi pi (GPU = graphics processing units).

    1.4.2 , , pi -

    pipi pi. pi -, , pi pi ., pi pi , pi pi- (pipi ) pi pi pi pi pi pi pi-. pi pi pi pi pi pi pi pi pi pi. pi , pi , pipi pi -, . pi , -pi pi pi (= semantic gap) pi . , pi, pi pi -pi pi pi pi pi. pi pi pi - ( pi.. [7, 21]) pi pi pi - () (= Problem Solving Environments) (. [21]). pi pi pipi ELLPACK [20] pi pi pi , , pi - . ELLPACK pi pi pipi. , pi pipi pi pi pi pi pipi pi pi pi pi pi . , pi, Mathematica [36], Maple [2], Matlab [1], Scilab [15]). pi pi -

  • 1.4. pi c2008, . 15

    pi scripting16 [29] (pi Python [27]) pi pi pi pi pi- pipi pi pi pi pi pipi [25].

    pi pi -

    pi pi pi pi ;

    pi . pi pi - pi pi pipi. pi pi- . , pi pi pi pi pi pi .

    pi pi, pi pi Fortran. C ( pi , pi.. C++), - . Fortran, . Fortran-90, pi, pipi , , pipi pi pi, pi.pi John Backus17

    I dont know what the technical characteristics of the standard lan-guage for scientific and engineering computation in the year 2000will be ... but I know it will be called Fortran.

    , pi pi pi pi-, pi pi pi pi. pi, pi - . pi pi pi. pi pi . pi [10] [31] The Influence of the Compiler on theCost of Mathematical Software - in Particular on the Cost of Triangular Facto-rization. pipi, pi pi pi pi18. pi pi- . pipi pipi pi .

    16 .17 (1924-2007) Fortran

    BNF.18 pi pi pi pi pi.

    pi pi . pi pipi - . [32, 9].

  • 16 1. c2008, .

    1.5

    1.1 (-) pi pi pi pi ,

    A A+ xyT (1.1)

    pi A n x, y - n. pi pi pi pi :

    1. pi pi Fortran (pi -pi),

    2. pi pi pi pi

    3. pi pi pi pi .

    pi ) pi pi (1.1)pi pi Unix dtime user system ) () pi ... pi (Mflop/s) pi n = 30 n = 800.

    1.6

    1.6.1. pi pi pi pi;

    pi. [, . 1.1] , -pi, pi pi pi pi pi pi .

    1.6.2. pi pi; 3 pi- pi.

    pi. [, . 1.1] (pi pi pipi- pi pi - - - pi) pi pi pi pi . , pi pi pi pi (pi.. , .pi.) : )pi , ) Fourier, ) .

    1.6.3. pi pi pi ;

    pi. [, . 1.3] pi pi pi pi ) , ), ) .

    1.6.4. pi pi pi- pi.

  • 1.6. c2008, . 17

    0 100 200 300 400 500 600 700 8000

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    4

    n

    time

    in s

    ec

    0 100 200 300 400 500 600 700 8000

    10

    20

    30

    40

    50

    60

    70

    80

    n

    Mflo

    p/s

    1.1: ) pi SGI Indigo-2 piR4400 @ 250 MHz, 2 MB cache. 1 (pi) pi, pi . pi pi pi . ) pi pi Mflop/s SGI Indigo-2 R4400 @ 250 MHz, 2 MB cache. 1 (pi) pi, pi . pi pi pi .

  • 18 1. c2008, .

    pi. [, . 1.3] pi pi pi pi pi 1) , 2) -pi , 3) pi pi - pi (..) pi , pi . 4) pi pipi pi- pipi pi, .. , , pi. , pi pi pi pi - . 5) pi pi pi pi pi.

    1.6.5. pi pi pi pi pi pi pi pi.

    pi. [, . 1.3] pi LAPACK pi pipi pi n. n 1000.

    1.6.6. / - pi pi pi pi.

    pi. [, . 1.4] ) RISC, ) , ) pi, pipi .

    1.7

    1.7.1. pi p(x) =n1

    j=0 jxj pin1 6= 0. )

    pi m 1, ..., m pi pipi V a. , V a. ) pi Horner, pi.. MATLAB , pi pi V a V . ) n = m, pi (pi pipi) pipi V a O(n logn) pi ... pi ; pi V a (, j j ).

    pi.

    ) Vandermonde :

    V =

    1 1 1 . . . 11 2 3 . . . m21

    22

    23 . . .

    2m

    . . . . . . . . .. . . . . .

    n11 n12

    n13 . . .

    n1m

    pi pi m 1, 2, . . . , m pi- pipi Vandermon-de :

    a =[0 1 2 . . . n1

    ]>

  • 1.8. c2008, . 19

    ) MATLAB pipi ( MATLAB pi ). -, a(i) pi i1.

    g = a(n)*ones(m, 1);for i=n-1:-1:1,

    g=g.*z + a(i)*ones(m, 1);end

    ) Fourier x pi n

    y(j) =n1k=0

    x(k)ei2kjpi/n, j = 0, ..., n 1.

    Vandermonde pi :

    z =[1 2 3 . . . m

    ]>=

    [1 ei2(1)pi ei2(2)pi . . . ei2(n1)pi

    ]> pipi V a pi Fourier a, pi O(n log n).

    1.7.2. , pi pi, pi p(z) =n1

    j=0 jxj pi

    n1 6= 0, pi pipi V a pi pi pi 8n logn pi .. pi pi pi pi lyes-mach, - pi pi , lno-mach, pi pi , - pi. pi, lno-mach, pi pipi V a, pi 2n2 pi. pi pi (pi.. pi- pi ) pi pi pi lno-mach.

    1.8

    1.8.1. Fourier x pi n

    y(j) =n1k=0

    x(k)ei2kjpi/n, j = 0, ..., n 1.

    pi pipi Vandermonde x. ) pi Vandermonde pi Fourier pi pi - pi Fourier pi pipi

  • 20 1. c2008, .

    . ) pi fft MATLAB : pi- flops n = 128 : 4 : 512. tic, toc, etime, cputime. pi ; - pi pipi pipipi O(n2) O(n logn). pi , pi pi -pi pi pi pi pi . pi .

    pi.

    ) pi MATLAB pi Vander-monde.

    function V=vand_fft(n)

    for j=1:n, v(j, 1) = exp(-2*pi*sqrt(-1)*(j-1)/n); endV=zeros(n);V(:, 1)=ones(n, 1);for i=2:n,

    V(:, i)=V(:, i-1).*v;end

    1.8.2. pi pi pi 1.3 pi ( pi). pi . MATLAB pi for-loops pi . pi pi pi pi- . pi pi pi pi pi. profile pi find.

    n = 500 : 100 : 20000 pi m = 50 : 50 : 200,n = 50 : 50 : 300 . pi pi pi m,n. pipi pi. pi pi

    pi. pi pi . pi pi pi- for-loops pi (pi pi pi pro-file). pi 1.4. pipi pi pi pi- . 1.2 pi pi pi- ( pi, pi pi pi pi pi pi 100 m,n). pi pi MATLAB pi pi.

  • 1.8. c2008, . 21

    tic;n=20000;rand(state,0);figure;for k=1:1:n,

    A(k)=k;endfor k=1:1:n,

    B(k)=round(rand(1)*n);endfor k=1:1:n,

    C(k)=A(k)+B(k);endfor k=1:1:n,

    plot(B(k),C(k),.r);hold on;

    endhold off;toc

    tic;m=100;n=200;rand(state,0);figure;for j=1:1:nfor i=1:1:mA(i,j)=rand(1);

    endendfor i=1:1:mfor j=1:1:nB(i,j)=rand(1);

    endendfor i=1:1:mfor j=1:1:nC(i,j) = A(i,j) + B(i,j);

    endendfor i=1:1:mfor j=1:1:nif C(i,j)>0.5,C(i,j)=1;

    elseif C(i,j)

  • 22 1. c2008, .

    tic;n=20000;rand(state,0);figure;A=(1:n);B=round(rand(1, n)*n);C=A+B;plot(B,C,.r);toc

    tic;m=100;n=200;rand(state,0);figure;A=rand(m, n);B=rand(n, m);C=A+B;C(find(C>0.5))=1;C(find(C==0))=-10;C(find(C0))=0;[i, j]=find(C==-10);plot(i,j,.k);hold on;[i, j]=find(C==0);plot(i,j,.y);hold on;[i, j]=find(C==1);plot(i,j,.m);hold on;title(Given);hold off;toc

    1.4: pi 1.8.2

    0 0.5 1 1.5 2x 104

    0

    5

    10

    15

    20

    n

    time

    (sec)

    Execution time for code 1

    0 0.5 1 1.5 2x 104

    0.008

    0.01

    0.012

    0.014

    0.016

    0.018

    0.02Execution time for optimized code 1

    n

    time

    (sec)

    50100

    150200

    0

    200

    4000

    20

    40

    60

    m

    Execution time for code 2

    n

    time

    (sec)

    50100

    150200

    0

    200

    4000

    0.05

    0.1

    m

    Execution time for optimized code 2

    n

    time

    (sec)

    1.2: ( 1.8.2).

  • 23

    [1] MATLAB: The Language of Technical Computing. Inhttp://www.mathworks.com/products/matlab/.

    [2] http://www.maplesoft.com/, 2007.

    [3] B. Alpern and L. Carter. Performance programming: A science waiting tohappen. In U. Vishkin, editor, Developing a Computer Science Agenda forHigh-Performance Computing. ACM Press, New York, 1994.

    [4] R. Aris. Mathematical Modelling Techniques. Dover, Mineola, NY, 1994(originally published in 1974).

    [5] V. Bargmann, D. Montgomery, and J. von Neumann. Solution of linearsystems of high order. In A.H. Taub, editor, John von Neumann CollectedWorks, volume V. Pergamon, Oxford, UK, 1963.

    [6] E. Barucci, L. Landi, and U. Cherubini. Computational methods in fi-nance: Option pricing. IEEE Computational Science & Engineering Mag.,pages 6680, Spring 1996.

    [7] R.F. Boisvert and E.N. Houstis, editors. Computational Science, Mathema-tics and Software. Purdue University Press, 1999.

    [8] L. Carter. RISC from a performance programmers perspective. Invi-ted talk at RISC in 1995 Symposium, 1995. Available from URLhttp://www-cse.ucsd.edu/users/carter/ppbib.html.

    [9] L. DeRose, K. Gallivan, E. Gallopoulos, B. Marsolf, and D. Padua. FALCON:A MATLAB Interactive Restructuring Compiler. In C.-H. Huang, et al.,editor, Lecture Notes in Computer Science: Languages and Compilers forParallel Computing, pages 269288. Springer-Verlag, New York, 1995.

    [10] J. J. Dongarra, F. G. Gustavson, and A. Karp. Implementing linear algebraalgorithms for dense matrices on a vector pipeline machine. SIAM Rev.,26(1):91111, January 1984.

    [11] From Quadnet. Economic modeling from the ground up. IEEE Parallel andDistributed Technology Mag., page 80, Summer 1996.

    [12] E. Gallopoulos and A.H. Sameh. CSE: Content and product. IEEE Compu-tational Science & Engineering Mag., 4(2):3943, 1997.

    [13] H.H. Goldstine. The Computer from Pascal to von Neumann. PrincetonUniv. Press, Princeton, 5th edition, 1993.

    [14] G. Golub and J.M. Ortega. Scientific Computing: An Introduction withParallel Computing. Academic Press, Inc., San Diego, CA, 1993.

    [15] Scilab Group. Scilab home page, 2007. Online athttp://www.scilab.org/index.php.

    [16] J.L. Hennessy and D.A. Patterson. Computer Architecture: A QuantitativeApproach. Morgan Kaufmann, San Mateo, CA, first edition, 1990.

  • 24

    [17] N.J. Higham. Accuracy and Stability of Numerical Algorithms. SIAM, Phi-ladelphia, 2nd edition, 2002.

    [18] R. Hockney. Computers, compilers, and Poisson solvers. In U. Schumann,editor, Computers, Fast Elliptic Solvers, and Applications: Proc. GAMM W-orkshop, 1977.

    [19] H. Hotelling. Some new methods in matrix calculation. Ann. Math. Statist.,14(1):134, 1943.

    [20] E.N. Houstis, T.S. Papatheodorou, and J.R. Rice. Parallel ELLPACK: Anexpert system for the parallel processing of partial differential equations.In Intelligent Mathematical Software Systems, pages 6373. North-Holland,Amsterdam, 1990.

    [21] E.N. Houstis, J.R. Rice, E. Gallopoulos, and R. Bramley, editors. EnablingTechnologies For Computational Science: Frameworks, Middleware, andEnviroments. Kluwer, 2000.

    [22] Grand Challenges: High Performance Computing and Communications. Areport by the committee on Physical, Mathematical, and Engineering Scie-nces. Office of Science and Technology Policy, 1991.

    [23] E. A. Jackson. A first look at the second metamorphosis of science. Tech-nical Report Report CCSR-95-1, Santa Fe Institute, 1995.

    [24] W.J. Kaufmann III and L.L. Smarr. Supercomputing and the Transformationof Science. Scientific American Library, New York, 1993.

    [25] G. Kollias and E. Gallopoulos. Jylab: A system for portable scientificcomputing over distributed platforms. In E-SCIENCE 06: Proceedings ofthe Second IEEE International Conference on e-Science and Grid Computing,page 97, Washington, DC, USA, 2006. IEEE Computer Society.

    [26] D.J. Kuck, E. S. Davidson, D. L. Lawrie, and A.H. Sameh. Parallel su-percomputing today and the Cedar approach. Science, 231:967974, Fe-bruary 1986.

    [27] H. P. Langtangen. Python Scripting for Computational Science. Springer,2006.

    [28] W. Leontief. The Structure of the American Economy. 1945.

    [29] J. K. Ousterhout. Scripting: Higher-level programming for the 21st cen-tury. Computer, 31(3):2330, 1998.

    [30] B. N. Parlett. Progress in numerical analysis. SIAM Rev., 20(3):443455,July 1978.

    [31] B. N. Parlett and Y. Wang. The influence of the compiler on the cost of ma-thematical software - in particular on the cost of triangular factorization.ACM TOMS, 1(1):3546, March 1975.

  • 25

    [32] C. Polychronopoulos, M. Girkar, M. Haghighat, C-L. Lee, B. Leung, andD. Schouten. Parafrase-2: An environment for parallelizing, synchroni-zing, and scheduling programs on multiprocessors. International J. HighSpeed Computing, 1(1), May 1989.

    [33] W. C. Rheinboldt. Computational Modeling and Mathematics Applied to thePhysical Sciences. Washington DC, 1984.

    [34] J.R. Rice. Computational science and the future of computing research.IEEE Computational Science and Engineering Magazine, pages 3541, W-inter 1995.

    [35] M. Serres. pi . Le Monde Diplomatique,(197), Nov. 2001. .

    [36] S. Wolfram. Mathematica: A System for Doing Mathematics by Computer.Addison-Wesley, Boston, second edition, 1991.

  • 26

  • 2

    pi

    model: pipi. [ ]: ... 2. (.) pi pi, pi-pi... 6. pi -... 7. (.) pi pi pi .... [. pipi .]model: I. Representation of structure. 2e. A simplified descriptionof a system, process, etc., put forward as a basis for theoretical orempirical understanding; f. (Math) A set of entities that satisfiesall the formulae of a given formal or axiomatic system. .... [TheNew Shorter Oxford English Dictionary]What is a model? the term mathematical model ... will be u-sed for any complete and consistent set of mathematical equationswhich is thought to correspond to some other entity, its prototype.The prototype may be a physical, biological, social, psychological orconceptual entity... Being derived from modus (a measure) theword model implies a change of scale in its representation ... Inso far as the prototype is a physical or natural object, the mathema-tical model represents a change on the scale of abstraction. Certainparticularities will have been removed and simplifications made inobtaining the model. - Rutherford Aris [4, Chapter 1].Models. ... It is customary nowadays, for example, to refer to acomputer model of the atmosphere, even though this consists ofnothing more than a programme for manipulating observed mea-surements of temperature, pressure, humidity, etc., according tothe dynamical equations of meteorology. The notion of a modelthus extends into a purely symbolic domain, where there is onlyan abstract similarity between the original system and its model.- John Ziman [17, Chapter 2.12]., pi. pi pi pi pi, pipi pi pi pi. pi , pi pi pi, , - Claude Levi-Strauss [11, .38].

    27

  • 28 2. pi c2008, .

    , pi pi , pi pipi pi , pi pi pi , pi pi pi . pi, - pi . pi pi pi pi pi . [15, . 263].

    pi pi -, pi, pi pi pi - pi pi pi . pi . , .

    2.1 pi

    ... pi pi pi pi pi ... pi pi- pi .[Pierre Simon de Laplace, Theorie analytique des probabilites.]One shouldnt always include all the effects in a mathematical mo-del; a huge simulation of the exact equations (even if one knowsthem) may be no more enlightening than the experiments that ledto these equations. There are virtues in simplicity, even in carica-ture (...) Solving is not the same as simulating. Our Modelsare Our Metaphors: Princeton pi- American Academy of Arts and Sciences, PhilipHolmes (SIAM News, June 2002.)

    . pi- : pi modus, . , - modello. pi pi - pi Unesco ( , , 1972). pi pipi , , pi pi - pi pi. pi pipi, . pi , - pi , pi , pi pi pi , pi pi pi pi pipi..

    pi pi pi (pi.. pi -

  • 2.1. pi c2008, . 29

    pi pi pi pi pi pi.)

    pi , pi , pi - . pi pi- (pi.. , , , ) pipi (pi.. ). - pi pi pi pi pi pi pipi - pi (pi.. pi -) , , . pi pi pi, pi pi pi pi, pipi pi pi pi pipi- pi. pi pi , pi pi, , pi pipi pi pipi, pi.1

    pi, pi pi- pi . - pi, pi - pi pi pi pi, , , pi pi. - pi pi pi pi pi . 2 pi (, ) pi pi .

    pi , pi pi , pi.. pi , pi pi , pi pi , pi pi . , pi pi pi3. pi- pi pi pi /. pi pi pi- pi, pi pi4.

    pi pi pi pi pi pi pi, pi pi - pi pi pipi.

    pi , pi pi pi pi -

    1pi pi, Unesco ( , , 1972).2pi pi.3pi: pi pi

    , pi, pi pi pi - pi [ , . pipi.]

    4pi Simulation as a source of new knowledge The Sciences of the Artificial [12] - - pi Carnegie Mellon ..., Herbert Simon ( pi).

  • 30 2. pi c2008, .

    2.1: pi pi pi.

    , pi, pi pi pi pi - /, pipi pi. pi pi, pi pi pi.

    2.1.1. pi pi Evariste Galoispi 1830, pi 5 pi pi pi pi pi .

    2.1.2. pi pi , Newton pi pi xi+1 = xi f(xi)/f

    (xi) pi pi

    . pi pi- ( ) , f . , pi pi.. pi pi pi , pi pi pi pi. pi pi, pi , pipi pi xi+1 = xi f(xi) xixi1f(xi)f(xi1) . Taylor, f(xi1) = f(xi) + f

    (xi)(xi1 xi) + f () pi

    xi1 xi. pi f(xi) f(xi1)

    xi xi1 (2.1)

    pi pi f(xi). pi

    pi (2.1) pi Newton . pi

  • 2.1. pi c2008, . 31

    pi pipi pi, pi (2.1) pi pi.

    2.1.3. pi pipi pi pi pi . pi - pi pi pi pi pi- pi pi .

    pi pi pi pipi pi pi - . / ( pi pi pi pi) pi pi - pi pi pi, , pi pi pi pi .

    pi pi pi pi . pi pi pi pipi - pi pi pi pi pi /.

    2.1.1. pi pi pi pi pi , pi.. pi, pi pi pi pi . pi pi pi pi pi .

    2.1.2. pi pi, -pi pi pi pi. , pi, pi pi MIT, Paul Krugman, - . pi pi, Krugman pi pi - pi pi . (. [9, . 47]):

    pi-pi . pi - pi pi , pipi- . pi - pipi pipi , pi pi pi , :- pi, , pi pi - , pi pi pi . - , pi pi( pi pi pi ). pi pi, pi , , , pi, pi pi pi pi.

  • 32 2. pi c2008, .

    2.1.1 pi pi

    The study of computational complexity requires that one agrees ona model of computation, normally called a machine model, for effe-ctuating algorithms. Unfortunately many different machine modelshave been proposed in the past, ranging from theoretical devices li-ke the Turing machine to more or less realistic models of the randomaccess machines and parallel computers... [16]

    pi pi, pi , pi.. - pi, , pi , . : pi . -

    .

    . pi pi -.

    . pi 8 . : pi pi pi pi pi pi.

    pi pipi pi pi pi pi / pi, pi -pi. pi, pi pi, pi pi pi pi pi pi . pi pi pi pi, pi pi, pi pi , pipi (artifacts) ( ).

    2.1.3. pi pi - pi. pi David Deutsch5 The Fabric of Reality - The Science of Parallel Uni-verses and its Implications [5]:

    ... What makes the general theory of relativity so important is notthat it can predict planetary motions a shade more accurately thanNewtons theory can, but that it reveals and explains previously un-suspected aspects of reality, such as the curvature of space and time.This is typical of scientific explanation.... But the ability of a theoryto explain what we experience is not its most valuable attribute. Itsmost valuable attribute is that it explains the fabric of reality itself.... Yet some philosophers - and even some scientists - disparage therole of explanation in science. To them, the basic purpose of a scien-tific theory is not to explain anything, but to predict the outcomes ofexperiments: its entire content lies in its predictive formulae. ... Thisview is called instrumentalism because it says that a theory is nomore than an instrument for making predictions...

    5 David Deutsch , pi pi

    pi . Dirac pipi pi pi.

  • 2.2. pi c2008, . 33

    2.2 pi

    pi pi pi pi- . - pi pi (pi.. ) pipi pi pi pi- pi .

    RAM

    pi pi pi - RAM (= Random Access Machine). pi pipipi (. [3] ), pi pi pi pi pi pi. , pipi- pi pi. pi pi pi pi pi pi .

    2.2.1. Horner pi pi pi p(x) = 0 + 1x + + nxn. :

    s = anfor i = n 1 : 1 : 0

    s = s x+ aiend

    pi pi, pipi T (n) =2n pi pi.

    2.2.1. pipi RASP (=Random Access Stored Program) uniform cost criterion pi (=straight-line), . pi pi - branch pi pi pi pi .

    pi pi pi pi pi pi pi pi / pi pi -, pi pi6 pi pi pi pi. - , pi pi pi pi pi pi pi pi pi - /. pi , pi pi pi pi. pi, pi pi .

    pi pipi, pipi pi pi pi pi pi pi

    6 , pipi RAM - pi pi pi , pi pi pi .

  • 34 2. pi c2008, .

    pi /, pi:

    pi pi-,

    pi pi- pi

    pi pi pi pi7. pi pi pi , pi 1.1 (-) pi pi pipi pi pi pi ( RAM pipi pipi-) pi pi !

    pi 8pi . , pi, pi- pi pi pi pi -pi pi pi pi .

    2.2.1 pi

    I gradually and slowly found out that there were two things to talkabout; the fact that knowledge is acquired, so to speak, by memory;but that when you know anything, memory doesnt come in. At anymoment that you are conscious of knowing anything, memory playsno part.... You have a sense of the immediate... - Gertrude Stein [14, p. 152].

    Finally, we can combine LOAD and STORE into the arithmetic ope-rations by replacing sequences such as { LOAD a; ADD b; STORE c} by c a+ b... - A. Aho, J. Hoprcroft and J. Ullmann [3].

    pi pi pi pi RAM / pi pi :

    pi, , , .

    :

    pi pipi pi pi load/store.

    7 pi pi pi pi pi pi pi pi .

    8 RASP pi pi !

  • 2.2. pi c2008, . 35

    K MK .

    pi pi pi ,, / ... .

    load pi pi , pi pi .

    load pi pi pi pi (0) .

    pi, pi -

    pi pi pi .

    pi pi pi pi pi pi RAM pipi pi . pi pi- , pi pipi pi RAM pi pi pi pi pi pi pi . pi pipi:

    pi pi (0) = 0, pi pi .

    2.2.2. pi pi, Horner pi- pi :

    load x, ans = anfor i = n 1 : 1 : 0

    load ais = s x+ ai

    endstore s

    2.2.2. pipi pi

    pipi . , pi - pi pi pi K pipi , pi pipi k = 0, ...,K 2m(k) pi f(k), m f pipi 0 [2].

    pi

    pi , pi pi pi pi. pipi, pi .

  • 36 2. pi c2008, .

    : pi ... (flops). , -, pi pi ... ... pi pi.

    : .

    min: pi pi pi pi pipi.

    pi pi . pi .

    2.2.1. n pi pi pi, min n+ 1.

    pi. pi pi-, pipi pi , load n. pi pi pi-, store.

    pi pipi, pim pi, min =n+m.

    2.2.3. Horner, pi pi pi pi 2.2.2 = 2n = n + 3. pipi , min n+ 3 pi = min.

    pi pi pi- pi / pi pi

    Mflop/s: pi pi Million Floating Point Opera-tions Per Second pi pi pi pi . pi- , pi Mflops. pi - pi [8], pi pipipi Million Floating Point OperationS. - pi pi . pi pi .

    , pi pi . pi pi pi pi , pi pi pi- , pi ,min pi , pi pi .

    pipi, T pi

    T = T + T= + ,

    T = T

    (1 +

    ),

  • 2.2. pi c2008, . 37

    pi := / . pi - pi, min = min/ pi ...

    T = T

    (1 +

    ) T

    (1 + min

    )

    pi pi pi pi pi ,pi pi pi .

    pi pi pi- . pi 4.

    pi (. = 0), T = T. pi , pi pi pi RAM, pi pi pi pi ... pipi pi pi .

    pi ,pi pi pipi pi- pi pi . pipi . pi pi ; -, pi pi pi RAM. pipi pi pi pi pi- pi pi .

    pi pi

    pi -

    pi pi pipi (pi.. pipi, )

    pi pi pi pi pi pipi pi pi

    (pi.. pi pi) pipi - pi pi : IBM RS/6000 DEC Alpha 21064 pipi ... .

    pi pi pi pi

  • 38 2. pi c2008, .

    9. pi pi pi pi pi, pi .

    2.2.3. pipi (,) pi pi . - pi pi min. pi (bandwidth) - pi pi pi, pi , pipi . pi Bmax Mbytes/sec. , -pi pi pi pi 8 bytes (pi. IEEE), pi Mflop/sec

    max :=Bmax8min

    .

    pi, pi pi max pi pi pi pi pi Mflop/sec.

    , pi , pi pipi pi pi pi . pipi - pi.. pi pipi. pi pi pi min, pi pipi pi pi . , pi pi pi pi pi pi pi ( ) pi .

    2.2.4. pi pi -

    pi pi , pi- pi (= prefetching). , pipi pi, pi pi. pi pi pi :

    : - pi pi . pi pi- pi pi runtime system.

    (=explicit) : pi pi pi pi .

    pi pi, pi T pi, pipi T , pi pi pi pi . pi :

    1. pi P1, pi pi P2 pi - pi P2 pi P1.

    9pi / pi (timers, monitors), pi.. pi pi.

  • 2.3. c2008, . 39

    2. pipi pi pi P1 pi- P2 pi pi P2 pi P1.

    3. pi - pi pi

    pi pi pi . pi- [1]. ToddMowry Stanford ( pipi Carnegie Mellon) Tolerating Latency Through Software-Controlled Data Prefetching10, pi - :

    This dissertation proposes and evaluates a new compiler algorithmfor inserting prefetches into code. (...) The algorithm can prefetch bothdense-matrix and sparse-matrix codes, thus covering a large fractionof scientific applications (...) The results of our detailed architecturalsimulations demonstrate that the speed of some applications can beimproved by as much as a factor of two, both on uniprocessor andmultiprocessor systems...

    MATLAB pi pi pi. , pi pi - pi, pi pi pi.. pi11.

    2.2.5. pi -pi pi pi pi MFLOPS, pi- . [13, 6]. pi , pi MFLOPS - pi. 1970, pi pi - pi pi ( pi pi Livermore loops), Linpack benchmark, - pi pi Perfect pi SPEC.

    pi pi . [7] pi D. Kuck [10].

    Linpack benchmark . URL www.netlib.org/benchmark/ pi [6].

    pi on-line . SPEC (= SystemPerformance Evaluation Cooperative) URL www.spec.org.

    2.3

    2.3.1. pi (pipi) C C + AB pi C Rn1n2 , A Rn1n3 B Rn3n2 . , min =

    10 www.cs.cmu.edu/ tcm/thesis/thesis_tech.html11 pipi MATLAB, pi- (predefinition)

    pi.

  • 40 2. pi c2008, .

    min/ pi pi ... min .

    1. pi min n1 = n2 = 1 n3 = n.

    2. pi min n2 = n3 = 1 n1 = 1.

    3. pi min n1 = n2 = n3 = n.

    4. min pi pi pi pi - pi min.

    pi.

    1. min = min =2n+22n

    2. min = min =42 = 2

    3. min = min =4n2

    2n3 =2n

    4. pi 2.2.3.

    2.3.2 (, , 03-makeup). A Rnn, x Rn, R, I pi y = (A I)x. pi , min, pi ... (-pi ) pi pi pi O(n) (LOAD) (STORE).

    pi. pi pi pi:

    y = (A I)x = Ax x pi pi pi min = n2 +2n+ 1. pipi pi O(n) , pi A. :

    LOAD , xfor i = 1 : n

    LOAD A(i, :)yi = A(i, :)x xi

    endSTORE y

    pi pipi 2n2 + n, pimin = n

    2+2n+12n2 .

    2.3.3. for i = 1:n, y(i) = a*x(i)+y(i),end. pi b = 3.

    pi. pi pi rem - r = rem(n,m) m,n pi pipi , . n = pm + r, pi 0 r m 1, pi :

  • 2.4. c2008, . 41

    r = rem(n,b);for i = 1:r, y(i) = a*x(i)+y(i); end;for i = r+1:3:n

    y(i) = a*x(i)+y(i);y(i+1) = a*x(i+1)+y(i+1);y(i+2) = a*x(i+2)+y(i+2);

    end

    2.4

    2.4.1. pi pn(x) =nj=1(x j). , MATLAB , pi

    pn(x). pi. :

    a(2) = 1; a(1) = -r(1); a(3:n+1) = 0for j = 2:nt(2:j+1) = a(1:j), t(1) = 0a(1:j+1) = t(1:j+1)-r(j)*a(1:j+1)

    end

    2.5

    2.5.1. MATLAB pi, k,

    Aj = rand(2kj+1, 2kj), j = 1, . . . , k

    Aj pipi Aj pipi eval, num2str, rand.

    n = 2k. , pi pi k = 1 : 10. pi Bk = A1A2A3 . . . Ak.

    1. pi pi a pi Bk n pi :

    Bk = (. . . ((A1A2)A3) . . . Ak1)Ak.

    2. pi pi pi Bk n pi :

    Bk = A1(A2(A3 . . . (Ak1Ak)) . . .).

    3. pipi pi pi- /a n.

  • 42 2. pi c2008, .

    4. pi pi MATLAB B = A1 A2 A3 . . . Ak. pi- pipi . pi pipi pipi MATLAB pipi ;

    5. pi, (3) pi pi pipi ( pi pi ).

    pi. k (k = 10 pipi )

    pi :

    for j=1:k,eval([A num2str(j) =rand(2(k-j+1), 2(k-j))]);

    end

    1. pipi C Rmn, D Rnk m(2n 1)k = 2mnk mk pi. pipi pi pi :

    1: (A1A2) = 2nn2n4 nn4 = n

    3

    4 n2

    4 .

    2: (A1A2A3) = 2nn4n8 nn8 = n

    3

    16 n2

    8 .

    3: (A1A2 . . . A4) = 2nn8n16 n n16 = n

    3

    64 n2

    16 .. . . k 1: (A1A2 . . . Ak) = 2n n2k1 n2k n n2k = n

    3

    22(k1) n2

    2(k1)+1 .

    pi j pi n3

    22j n2

    2j+1 pi, pi pi pi :

    a =k1j=1

    (n3

    22j n

    2

    2j+1) =

    n3 4n3

    n2 2n2

    =n3

    3 n

    2

    2+2n3

    2. pi : 1: (Ak1Ak) = n

    2

    22(k2) n2k2 (= 12). . . k 3: (A3 . . . Ak1Ak) = 2n4 n8 n4 = n

    2

    16 n4 k 2: (A2 . . . Ak1Ak) = 2n2 n4 n2 = n

    2

    4 n2 k 1: (A1 . . . Ak1Ak) = 2nn2 n = n2 n

    pi j pi n2

    22(kj1) n2kj1 pi, pi pi pi :

    =k1j=1

    (n2

    22(kj1) n2kj1

    ) =4n2 16

    3 (2n 4) = 4n

    2

    3 2n 4

    3

    3. pi pi a pi /a pi:

  • 2.5. c2008, . 43

    0 50 100 150 200 250 3000

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    1.4

    n

    /

    a

    2.2: () /a ( 2.5.1).

    Omega_a=sym((n3/3)-(n2/2)+(2*n/3));Omega_delta=sym((4*n2/3)-(2*n)+(4/3));k=(1:8);flops_a=zeros(length(k), 1);flops_delta=zeros(length(k), 1);

    for i=1:length(k),n=2k(i);flops_a(i)=eval(Omega_a);flops_delta(i)=eval(Omega_delta);

    endplot(2.k, flops_delta./flops_a, -);xlabel(n);ylabel(\Omega_a/\Omega_\delta);

    2.2 .

    4. pi, pipi pi pi pi . pi pi - pipi pi.pipi pi pi pi MATLAB pi . pi 2.3. pi pi pi pi MATLAB pi-pi pi pi , pi pi !

  • 44 2. pi c2008, .

    k_max=10;n=2.(2:k_max);t_left=zeros(k_max-1, 1);t_right=zeros(k_max-1, 1);t_mat=zeros(k_max-1, 1);

    for k=2:k_max,an=sprintf(Matrix multiplication for n=%d, n(k-1));disp(an);for j=1:k,

    eval([A num2str(j) =rand(2(k-j+1), 2(k-j));]);end

    for m=1:100,tic;left_ex=A1;for j=2:k,

    left_ex=left_ex*eval(strcat(A, num2str(j)));endt_left(k-1)=t_left(k-1)+toc;

    endt_left(k-1)=t_left(k-1)/100;

    for m=1:100,tic;right_ex=eval(strcat(A, num2str(k)));for j=k-1:-1:1,

    right_ex=eval(strcat(A, num2str(j)))*right_ex;endt_right(k-1)=t_right(k-1)+toc;

    endt_right(k-1)=t_right(k-1)/100;

    for m=1:100,tic;mat_ex=A1;for j=2:k,

    mat_ex=strcat(mat_ex, *, strcat(A, num2str(j)));endmat_ex=strcat(mat_ex, ;);eval(mat_ex);t_mat(k-1)=t_mat(k-1)+toc;

    endt_mat(k-1)=t_mat(k-1)/100;

    end

    5. 2.4 pi, pi pi.

  • 2.5. c2008, . 45

    0 200 400 600 800 1000 12000

    0.05

    0.1

    0.15

    0.2

    0.25

    n

    time

    (sec)

    left to rightright to leftmatlab

    2.3: pipi ( 2.5.1).

    0 200 400 600 800 1000 12000

    0.5

    1

    1.5

    2

    2.5

    n

    /

    a

    2.4: (pi) /a ( 2.5.1).

  • 46

    [1] R.C. Agarwal, F.G. Gustavson, and M. Zubair. Improving performance oflinear algebra algorithms for dense matrices, using algorithmic prefetch.IBM J. Res. Develop., 38(3):265275, 1994.

    [2] A. Aggarwal, B. Alpern, A. K. Chandra, and M. Snir. A model of hiera-rchical memory. In Proc. Nineteenth Annual ACM Symposium on Theory ofComputing, pages 305314, May 1987.

    [3] A. Aho, J. E. Hopcroft, and J. D. Ullman. The Design and Analysis ofComputer Algorithms. Addison-Wesley, 1974.

    [4] R. Aris. Mathematical Modelling Techniques. Dover, Mineola, NY, 1994(originally published in 1974).

    [5] D. Deutsch. The Fabric of Reality. Penguin, 1997.

    [6] R. Giladi. Evaluating the MFLOPS measure. IEEE Micro, pages 6975,Aug. 1996.

    [7] J.L. Hennessy and D.A. Patterson. Computer Architecture: A QuantitativeApproach. Morgan Kaufmann, San Mateo, CA, first edition, 1990.

    [8] R.W. Hockney. The Science of Computer Benchmarking. SIAM, Philadelph-ia, 1996.

    [9] P. Krugman. . , 2000.

    [10] D.J. Kuck. The Structure of Computers and Computations. Wiley, 1978.

    [11] C. Levi-Strauss. La pensee Sauvage. Plon, Paris, 1962.

    [12] H. A. Simon. The Sciences of the Artificial. MIT Press, Cambridge, Mass.,second edition, 1981.

    [13] J.E. Smith. Characterizing computer performance with a single number.Comm. ACM, pages 12021206, Oct. 1988.

    [14] Gertrude Stein. How Writing is Written. Black Sparrow Press, Los Angeles,1974.

    [15] . . pi. , , 1974.

    [16] P. van Emde Boas. Machine models and simulations. In J. van Leeuwen,editor, Handbook of Theoretical Computer Science. Volume A: Algorithmsand Complexity, chapter 1, pages 166. The MIT Press, Cambridge, MA,1990.

    [17] J. Ziman. An Introduction to Science Studies. Cambridge University Press,Cambridge, 1984.

  • 3

    pi

    - (...) pi pi , (...) (...) pi - . Edgard Morin [29].

    pi pi pi pi 1.1, pipi - - , pi- pi pi pi ! , pi pi pi - pi 2.1, pipi pi , pi:

    pi pipi pi pi.

    pi pipi pi pipi pi :pi.. pi , , pi.

    pi-.

    , pi pi pi (pi.. pi ), pi pi pi -. , pi , - pi . pipi , pi , 1) pi pi pipi pi, 2) pi pi pi pi pi pi pi.

    pi- pi , pi pi pi

    47

  • 48 3. pi c2008, .

    pipi pi, . pi pipi . pi pi 1. - pi Nick Higham2 ([17]) pi pi pi pi pi.

    pi pi -, pi pi pi pi pi .

    3.1 pi

    pi pi x x. pi- pi

    pi Eabs(x) = |x x|,

    Erel(x) =|x x||x| .

    |x| pi pi , pi pi .

    pi pi pi pi . pi- , pi pi (pi ) pi ; pipi , pi pipi pi, pi pi , pi . , x pi -pi pi x (pi pi ). pi pi - pi . pi , pipipi (. pi ). pi pipi pi, pi , pi pi, ( ).pi pi x pi pi pi x pi pi pi , . Eabs(x) = x x Erel(x) = xxx .

    pi pi - , pipi, pi pi , , .

    1pi pi .2 pi Manchester.

  • 3.2. pi c2008, . 49

    3.1.1. p1 = [1, 0, , 0] R1000 p2 = [103, , 103] R1000 pi pipi x pi x1 x2 . 1 = p11 =p21 pi pi x1 pi 2 : 1000 x.

    pi pi pi pi pi pi -pi, , pi pi pi . , pipi pi pi pi Cn x Cn,

    y = |x| yi = |xi|, i = 1 : n.

    pi pi. x, y Rn

    x y xi yi, i = 1 : n. pi, pi pi pipi -. pipi pi - Rmn Cmn. pi , x pi x pi -pi |x x| [|x1 x1|/|x1|, . . . , |xn xn|/|xn|. pi pi () ( = relativecomponentwise error)

    maxi

    |xi xi||xi| .

    pi pi pi pi pi (normwise analysis)pi (normwise analysis), pi pi pi.

    3.2 pi

    Floating point arithmetic is by nature inexact, and it is not dif-ficult to misuse it so that the computed answers consist almostentirely of noise. One of the principal components of numericalanalysis is to determine how accurate the results of certain nume-rical methods will be David Knuth [22]I would be afraid to fly in an airplane that was designed with floa-ting point arithmetic. pi (1960) Alston Householder

    pi pi pi pi bytes pi pi pi pi pi pi pi pi (...). pi- pi ... pi / pi pi 3 pi

    3. pi L.N. Trefethen Predictions for Scientific Computing50 years from now pi

  • 50 3. pi c2008, .

    . pi , pi pi pi pi pi pi /.

    , pi pi , ..., pi pi pi .

    ... F pi R

    y = m et, (3.1)

    pi t . , F . F ... pi F . = 2 pi - (pi.. = 16 IBM/360) pi pi = 10. t pi -pi pi m . pi, m (pi pi y), m/t < 1 , pi y. pi mantissa4 (pi 2) y. - Knuth pipi mantissa : ... but it isan abuse of terminology to call the fraction part a mantissa, since the concepthas quite a different meaning in connection with logarithms. Furthermore theEnglish word mantissa means a worthless addition. [22, page 199].

    :

    ... (3.1) pi bytes, pi..4 8 pi /. pi pi bit pi pi, () pi m, pipi pi e.

    F pi pi pipi pi .

    F pi pi M =mmax emaxt = mmin emint. pi, pi, F pipi -. F pi , pi pi- . pi - pi pi 32 64 bits pi pipi [,M ].

    4 pi . pi pi pi mantis(s)a pi , , . pi pi pi pi pi. pipi , , mantissa pi pi ( ). mantissa . pi pi .

  • 3.2. pi c2008, . 51

    pi pi (3.1) ... pi e pi t. , t pi F .

    pipi, pi pi F - pi pi, pi pi pi Wil-kinson:

    pi ,

    t pi m pi ,

    (emin, emax) pi e, . emin e emax, ,

    F(, t, emin, emax). pi-

    :

    pi pipi .

    pi .

    pi. pi pi .

    3.2.1 pi, pi

    F pi pi F . R F pi fl

    fl : R F

    fl(x) F F pi x, pi(pi) . fl pi pi ( continuum) pipi . pi G F

    G := {x R : |x| M} {0} R ,

    pi M ... pi pi pi .

    pi pi fl(x). pi pipi :

    x F pi fl(x) = x, . pi pi x.

    x G x 6 F , pi fl(x) 6= x. pi x fl(x) F pi- pi x. fl(x) 6= x, pi pi . pi pi, pi pi pi.

  • 52 3. pi c2008, .

    R

    G

    F

    x1

    x3x2 x4

    3.1: pi R pi pi F .

    x 6 G pi, |x| > M pi |x| < x 6= 0 pi. pipi pi fl(x) / F . pi pi, pi pi F 5

    3.1 pipi pipi. 3.2.1. = 10 pi t = 2

    . x = 1.9, y = 0.66 pi z = x y = 1.254. - fl(z) = 1.2 fl(z) = 1.3. pi pipi 0.0431 = |1.254 1.2|/1.254 0.0367 = |1.2541.3|/1.254. pipi pi u = 12/2 = 0.05 pi pi. pi (. 3.4.4), pi( ) pi pi /.

    Cause when you are up you are up,and when you are down you are down,but when you are only half way upyou are neither up or down!

    [The Grand Old Duke of York, pi Mother Goose NurseryRhymes.]

    pi pi pi pi pi pi-pi pi pipi, . x G x 6 F .

    pi pi pi, . fl(x) ... y F pi pi x:

    y = fl(x) pi y = arg minyF

    |y x|.

    (y, y+), pi y, y+ F pipi x. pi fl(x), pipi

    5 R pi .

  • 3.2. pi c2008, . 53

    pi x (y, y+). pipi , pi , . y y+ pi pi .

    3.2.2. ... F(10, 4,9, 9) x1 =0.10005, x2 = 0.10015. fl(x1) = 0.1000 fl(x2) = 0.1002.

    3.2.3. pi pi pi - pi pi pi pi pi MATLAB SciLab, eps pi 1+ 1. pipi pi pi, 2 pi .

    16- 1 + eps/2 1 3ff00000000000001 + eps 1.0000 3ff0000000000001

    1 + eps+ eps/2 1.0000 3ff00000000000021 + 2 eps 1.0000 3ff0000000000002

    1 + 2 eps+ eps/2 + eps/4 1.0000 3ff0000000000002

    pi pi pi - pi 0. pi pi . pi pi pi pi-pi, pi, pi pi (y, y+) pi pi x y, y+ F , fl(x) = sign(x)max(|y, y+|).

    3.2.2 pi bit

    pi pi pi ... pipi pipi, pi pi pi pi pi.. y = 0.d10000e y = 0.0d10000e+1. pi pi pi . pi - pi, pi pi pi m ( ) , . y R F d1 6= 0. pi pi = 2, d1 6= 0 d1 = 1. , pi pi 2 (pi -pi pi pi ), pi pi bit m pi 1. pi, pi pi- . pipi, , pi pi pi ( pi pipipi) pi bit.

    3.2.1. pipi pi pi bit pi (pi pi- pi pi pi pi). pi pipi - , pi.., pi pi pi pipi pi bit pi pi.

    pi bit pi / pi-, bit .

  • 54 3. pi c2008, .

    pi y F y = e .d1d2 dt

    pi0 di 1, d1 6= 0.

    3.2.3 ...

    ... F , y 6= 0 pi F . pi :

    y F y 6= 0 emin1 |y| emax(1 t)

    z G z, z+ pi pi pi z, . z [z, z+] pi ... z, z+ pi z < z z z+ < z+.

    z = .t x x e

    pi pipi (pi pi) pi z z = m et z+ = (m + 1) et. pi z+ z = et. pi, pi z pi pi pi z , pi, pi pi pi, |z fl(z)| = et2 pi z.

    |z fl(z)| .t

    0 0 e

    2t1e

    et

    2.

    z G

    |z fl(z)z

    | et

    2/1e

    =1t

    2= u.

    u pi (=unit roundoff ) -pi (-).

    z G fl(z) = z(1 + ), pi || < u. (3.2)

  • 3.2. pi c2008, . 55

    ... pi (- pipi ) pi pi ... (wobbling)

    |met (m+ 1)et| = et|me+1t (m+ 1)e+1t| = e+1t

    pi pi pi e e+1.

    3.2.4

    pi pi pi pi pi pi pi pi . pi pi pi - pi pi 1+x = 0pi x6! , ... pi () pi ... x .. 0 x < pi 1+x = 0. pi, pi pi pi pi, y = 1+5.5511 1017, y pi ... 1.

    3.2.4. MATLAB 6.5, pi, - pi :

    p1 = 5.5511e-0171+p1

    >> ans = 1(1+p1==1)

    >> ans = 1

    pipi pi pi ... - pi pipi-

    pi ... - pi ..., x, pi- ..., x+, . ... pi x < x+ ... . , ... x pi pi , (x, x+) = x+ x, pi pi ... x+. pi . pi, pi pi y1 y2,pi pi , pi pi, [y1, y2] pi pi pi .

    pipi pi - ... pi :

    3.2.1. , pi M , pi pi 1 ..., .

    M := (1, 1+). (3.3)6 pi , pi pi pi pi -

    pi !

  • 56 3. pi c2008, .

    pi, pi

    pi:

    M ... pi 1+ 1:

    M := argmin>0

    {fl(1 + ) > 1} (3.4)

    pi, pi pi pi (3.3).

    pipi, M pi - ... ... pi t 1 pi, 1 1 + 21t, 3.2.1 pipi M = 21t.

    3.2.2. pi u = 2t.pi, M = 2u.

    3.2.3. pi pi , pi pi pi pi (pi.. MATLAB) pi- (pi : pi pi, pi,):

    t=1.0while (1.0 +t > 1.0)t=t/2.0;

    endt=t*2.0;

    pi pipi pi pi pi- ... pi. pi pi pi pi pi , pi pi pi pi . pi pi.

    3.2.4. Fortran 90 M pi pi , EPSILON.

    3.2.5. pi pi pi M . MATLAB pi eps. pi, pi Toshiba 320CDT pi pi Pentium IIpi :

    >> epseps = 2.2204e-16>> 1+eps >1ans = 1>> 1+eps/2 >1ans = 0

    3.2.1. pi pi pi-

    3.2.3 pi MATLAB eps pi- pi M . ,

  • 3.2. pi c2008, . 57

    pi pi pi pi pi MATLAB. pi pi piPentium pi MATLAB

    > test = (eps/2*(1+eps) +1 >1)test = 1

    pi e1 = eps/2*(1+eps) pi 1+ e1 >1pi pi pi e1 < eps. pi eps pi pi pi MATLAB pi 1+eps > 1. pipi pi pi M ;

    3.2.6. M pi pi. pi MATLAB:

    EPS Floating point relative accuracy.EPS is a permanent variable whose value is initially the distancefrom 1.0 to the next largest floating point number. EPS may bereassigned any value. EPS is used as a default tolerance by PINVand RANK.

    3.2.7. pi

    EPS MATLAB pi . , ... pi pi pi. , pi7,

    >> floor(0.75/0.25)ans = 3>> floor(0.075/0.025)ans = 2

    pi , pi ... pipi (pi.. IEEE), pi pi . pi pi

    >> 0.75/0.25ans = 3>> 0.075/0.025ans = 3.0000v = 3-0.075/0.025v = 4.4409e-16

    v 2 eps. v, pi pi. pi pi- , 16 pi pi.

    >> format hex>> 0.25ans = 3fd0000000000000>> 0.75/0.25ans = 4008000000000000

    7 pi . . pi.

  • 58 3. pi c2008, .

    >> 0.075ans = 3fb3333333333333>> 0.025ans = 3f9999999999999a>> 0.075/0.025ans = 4007ffffffffffff

    pi 0.075 pi pi pi pi pi 3, pi pi floor 2.

    3.3 pi

    ... pi (pi pi) pi pi / pi pi . pipi pi pi pi.

    pi pi F pi pi met , pi pi {+,,, /}, pi x, y F x y 6 F . pi R .

    3.3.1. pipi pi ... t pi 2t .

    3.3.2. M F , pipi pi , pi F .

    pi pi pi pi pi pi . pi pi pi pi ... pi pi- /. pi pi pi pi pi pi pi 8

    pi pi - pi ; , pi, , pi pi ... . -, pi pi (ALU) pi pi. , pi - pi Pentium bug pi Intel , pi pi pi. pi pi -, pipi pi pi (pi.. pi). , pi, pi

    8... pipi ! , pi pi pi- .

  • 3.3. pi c2008, . 59

    pi pi pi pi pi - . pi pi, pi pi pipi pi.

    pi pi , x, y F

    x y = fl(x y) F (3.5)

    . pi pi - pi R (. x y) pi pi. -, (=exact roun-ding).

    pi pi , pi pipi pipi pi . , pi pipi -pi pi z = x y pi z pi pi pipi pi pi -pi. pi , pi pi . pi, pi - pi pi pi pi , pi , pi pi (guard digit).

    3.3.3. ... pi = 2, t = 3 u =213/2 = 1/8.

    pi pi+ 21 0.100 21 0.100 20 0.111 20 0.111

    21 0.100 21 0.100 21 0.011|1 21 0.011= 21 0.0001 21 0.001= 22 0.100 21 0.100

    pi pi pi - pi (. pi (3.5) ), pipi

    |22 0.1 21 0.1

    22 0.100 | = 1 = 8u

    pi pi (3.5). pi pi bits pi-

    pi , (3.5) pi bits( pi, (guard, round digits) sticky bit) . pi .4 [16], [12]. pi [23] pi

  • 60 3. pi c2008, .

    pi pi pi pi pi pi pi pipi IEEE.

    3.3.1. pipi (Cray C-90) pi pi

    pi pi pi . 3.3.2. pi

    :

    fl(x y) = (1 + )x (1 + )y, ||, || u

    pi pi , pi R pi +, pipi. , x, y, z R , pi pi.

    pi 0 x+ y R .1 pi : x+ y = y + x.2 pi pi x+ (y + z) = (x+ y) + z.3 pi 0 x+ 0 = x x R .4 x R pi x R pi

    pi, . x+ (x) = 0. pipi 0 x y R .

    1 pipi: x y = y x.2 pipi: x (y z) = (xy) z.3 pi 1 x 1 = x x R .4 x pi pi pipi-

    1x R x ( 1x ) = 1. pi : x (y + z) = x y + x z.

    pipi pi R F pi pi ... pi-pi pi (3.5). pi pi pipi . 1, 3,4 1, 3. 0 0 pi F .

    3.3.4. 2: pi t1 = fl(x+ y) s1 = fl(y + z)t2 = fl(t1 + z) s2 = fl(x+ s1)

    pi t1 = (x+ y)(1 + 1) t2 = (t1 + z)(1 + 2)

    t2 = ((x+ y)(1 + 1) + z)(1 + 2), pi |j | u.

    s2 = (x+ (y + z)(1 + 2))(1 + 1) pi |j | u.

  • 3.3. pi c2008, . 61

    pi , pipi t2 6= s2 pi pi ... .

    3.3.5. 4: pi, x F z =fl( 1x ) =

    1x (1 + 1) x z = x 1x (1 + 1)(1 + 2) pi

    . pi pi MATLAB pipi 1 y 200 pi ( 1y ) y 6= 1:index = [];for i=1:200

    if ((1/i)*i = 1)index = [index i];

    end;end;

    pi pi NEC Versa SX pi Pentium 2pi x = [49, 98, 103, 107, 161] pi pi (1/x) x 6= 1.

    pi F pi, pi - pipi pi pi R . pipi pi , pi.. pi pi -, pi pi pipi pi. pi, pi pi pi pi ... x1, x2 x3, x4 x1 + x2 + x3 + x4 pi pi pi ((x1+x2)+x3)+x4 pi (x1+x2)+(x3+x4). pi , pi pi . pi, pi pi - , pi , pi , pi . pipi pi - pi pi pi 3.4.4 pi 3.2.3.

    pi pi pi pi - ... pi , pi pi pi . pi ) pi - pi pi pi pi pi pi ... ) pi pipi pi .

    (), x, y F pi pi-, . x y G,

    |fl(x y) (x y)||x y| u, x y 6= 0, {+,,, /}. (3.6)

    (3.5), pi fl(x y) x y pipi pi pi pipi pi pi pi pi pi.

    pi pipi pipi - :

  • 62 3. pi c2008, .

    3.3.1. x, y F x y G,

    fl(x y) = (x y)(1 + ), pi || u

    fl(x y) = x y1 +

    , pi || u x y F = 0. pi F pi x y pi x, y F .

    3.3.3.

    x y fl(x y) = (x y)(1 + ),

    pi (), pi - pi ... pi pi - pi ( R ) x = x(1 + ), y = y(1 + ). , pi pipi , . = = /, pi ... pi pi pi ( R ) x = x, y = y(1 + ), x = x(1+ ), y = y, pi pipi x y pi (x y)(1 + ). pi pi - pi pi 3.5.

    3.3.2. pi .

    fl(ij) = ij(1 + ij), |ij | u,|fl(A)A| |A|u

    fl(A) = A+ E, |E| u|A|,fl(A+B) = (A+B) + E, |E| u|A+B|,

    pi pi pi

    pi pi 3.1. pi , (3.6)

    pi pipi pi, pi .

    pi (3.6) pi pi pi pipi pi /.

    3.3.6. ... x, y F pi x2 + y2 G pi pipi pi 0 < x F 9 fl(x) = x(1 + ) pi|| u. pi pipi pi z = x

    x2+y2. pi pi pi .

    pi pi pi pipi pi :

    9 , fl(x) pi ...

    pi ... pi pix.

  • 3.4. pipi pi c2008, . 63

    ... pi pit1 fl(x x) x2(1 + 1)t2 fl(y y) y2(1 + 2)t3 fl(t1 + t2) (t1 + t2)(1 + 3)t3 fl(

    t3)

    t3(1 + 4)

    t1 fl( xt3 ) xt3 (1 + 5)pi pi-

    pi:

    t1 =x

    t3(1 + 5)

    =x

    t3(1 + 4)(1 + 5)

    =x

    (t1 + t2)(1 + 3)(1 + 4)(1 + 5)

    =x

    (x2(1 + 1) + y2(1 + 2))(1 + 3)(1 + 4)(1 + 5)

    pi j pi pi u. pipi , pi pi pi pi pi z t1. pi 3.5 pi pi pi pi pipi pipi.

    3.3.7. y = (1+x)1x . y 1 fl(y) = ((1 + x)(1 +1) 1)(1 + 2)(1 + 3)/x pi

    fl(y) = (1 + 1)(1 + 2)(1 + 3) +1(1 + 2)(1 + 3)

    x

    pi, x > M ,

    fl(y) = 1 + (1 + 2 + 3) + 12 + 23 +

    +13 + 123 +1(1 + 2)(1 + 3)

    x= 1 +O(u)

    |fl(y)yy | O(u). 0 < x < M fl(y) = 0 fl(y) yy

    = 1.

    3.4 pipi pi-

    The simplest and best, though harder to attain, solution to the pro-blem of environmental parameters is to standardize floating-pointhardware, so that the values of the parameters become universalconstants... - Webb Miller [26]

  • 64 3. pi c2008, .

    pi pi pi ... pi- pi 1960 pipi, pipi pi . - 1980, pi ... pi . .. pi- pi pi pi . pipi pi , Berkeley, Velvel Kahan, 1985 pipi pi pi IEEE floating-point standard 754. pipi pi

    , pi, pi pipi () pi.. 0,

    pi, pi pi.

    pi pi pi pipi pi format ..., pi

    pi, , pi formats. pi pi pipi ,pi pi pi . pipi pi formats. formats F(2, 24,125, 128) pi pi , F(2, 53,1021, 1024) pi pi . pi pi Wilkinson pipi pipi pi pi 3.1. - pi = 2, pi bit pi. pipi , m ... t bits pi 1 m < 1 . m = d0+d11+ +dt1(t1). pi pi d0 6= 0 pi bit d0.

    3.4.1. pi pi - :

    pi. 16-

    1

    8 bits 10000001

    23 bits 001 0 c0900000 -4.5

    1

    11 bits 10000000001

    52 bits 0010 0 c012000000000000 -4.5

    pipi pi pipi - pi bit pi . pipi, pi,

    e = 2 = 1025pi1023

    m = 1.125 = 23 +

    bit1 .

  • 3.4. pipi pi c2008, . 65

    3.1: IEEE-754.pi pi 32 bits 64 bitspi 1 1 23+1 bits 52+1 bits 8 bits (pi 127) 11 bits (pi 1023) . u 224 5, 96 108 253 1, 11 1016 1038 10308

    pi pi pi pi, pi.. Intel:

    *86, Pentium. DEC: Alpha, IBM: RS/6000, Motorola: 680*0, Sun: SPARC,PowerPC, MIPS R10000, pi.

    3.4.1 pi pipi

    The rational number system is inadequate for many purposes, bo-th as a field and as an ordered set... This leads to the ... irrationalnumbers which are often written as decimal expansions and areconsidered to be approximated by the corresponding finite deci-mals... Walter Rudin [33]

    Formats: single, double, single extended, double extended. : ) pi pi , ) pi, ) pi 0 (pipi). : pi bits pi -

    . pi10. pi pi pi pi pi pi x/0, 0/0 y pi y < 0. pipi pi 0, ,NaN, pi Not a Number pi pi pipi pi.

    pi pi , pipi pipi pipi- (=subnormal) , pi pi - pi . pi- pi.

    : inexact, invalid op., overflow, underflow, divisionby 0. pi 3.2 pi IEEE.

    3.4.1. pi MATLAB pi isieee pi pi 1 pi pi IEEE. pi pi IEEE :

    10 pipi pi. pi pi .

  • 66 3. pi c2008, .

    3.2: IEEE [17]. pi pi pipi invalid op. 0/0, 0,1 NaNoverflow Infdivide by 0 finite number/0 Infunderflow subnormal numbersinexact fl(x y) 6= x y

    >> 1/(1/0) =Warning: Divide by zeroans = 0>> 1/1/0Warning: Divide by zeroans = Inf>> 0/0Warning: Divide by zeroans = NaN>>1/0Warning: Divide by zeroans = Inf>> max(ans,4)ans = Inf>> min(ans,3)ans = 3

    3.4.2. pi pi

    pi pi pi pi / pi pi. pi- Fortran machar.f (Cody) [6], pi paranoia.f (Kahan). pi pi pi, pi pipi pi pi pi pipi ... IEEE . pi pi 3.4pi. pipi pi pi pi pi ...

    3.4.2 pipi pi-

    IEEE pipi,pipi pi pi pipi -pi . pi pipi pi pi pi pi pi, pi.. emint. pi pi pi pi pi, pi.. 0 < a b < m.

    3.4.2. pi pi Matlab 5.1.0 pi- pi Windows Intel Pentium. pi

  • 3.4. pipi pi c2008, . 67

    MATLAB pi realmin.

    >> realminans = 2.225073858507202e-308>> format hex>> realminans = 0010000000000000

    pi pi pi pi :

    >> format hex>> realmin/252ans = 0000000000000001>> ans/2ans = 0000000000000000

    pi pi

    >> format hex>> realmin/252ans = 0000000000000001>> ans/2ans = 0000000000000000>> format long e>> realmin/252ans = 4.940656458412465e-324

    pi pi pi pi-

    pi. pi pi- , pi, pi pi pi pi m. , pipi , pi pi- pi . pi (=gradual underflow). pi pi pi, pi pi pi- .

    3.4.3 (Kahan). pi pi

    if (x > y),...... log(x-y) ...

    end

    x, y pi (pi) pipi |x y| pi -pi pi. pi pi pi, 0 pi pi-pi pi log(0). pi pi pi .

    3.4.4. [8] pipi A = [1 2; 1 5/2]pi pi pi pi pi- ... pi L = [1 0; 1 1], U =

  • 68 3. pi c2008, .

    [1 2; 0 1/2]. pi U(2, 2) , pi , pi pi - pi pi U ! pipi 1. pi pi pi . pi Ma-tlab 5.1.0 pi pi Windows Intel Pentium. pi realmin pi pi .

    > a = realmin*[1 2; 1 5/2];> [l,u] = lu(a);> u(2,2)ans = 1.1125e-308> u/realminans =

    1.0000 2.00000 0.5000

    pi . Demmel [8].

    3.4.3. pi -

    pi pi pi pi pi ..., - pi pi pi. pi (. pi [8]).

    3.4.3

    IEEE pi (extendedformat)). 79 bits (mantissa 63, exponent 15), u 5.42 1020 [104932, 104932].

    pi, pi Pentium, pi- ... 80 bits pi pi (= double rounding). , pi pi pi pi 80 bits pi pi 64 32 bits.

    3.4.4. pi pi pi- pi. pi (. [16]) pi pi pi pi = 10 pi -pi 2 3. 1.9 0.66 = 1.254. - roundp(x) x p . round2(1.254) = 1.3 pi pi round2 (round3(1.254)) = 1.2.

    pi pi -pi, ( pi ). , Kahan 128 bits [17].

    3.4.4 Fused Multiply and Add (FMA)

    pipi pi z + x y pipi pi pi x y x + y. pipi -

  • 3.4. pipi pi c2008, . 69

    pi pi pi pi Cray ( chaining), pi pipi pi pipi- ( pi x y) pi ( pi z+(x y))(. !) pi, pi FMA pi DOT(x(1 : n), y(1 : n)) n+O(1) 2n + O(1). , pi- (pi.. IBM RS/6000) pi z + x y pi . pi pipi pi .

    pipi, pi - . , pi pi pi

    fl(z + x y) = (z + x y)(1 + ), || u.

    . (pi )

    fl(z + fl(xy)) = (z + xy(1 + 1))(1 + 2)

    pi pi . pipi pi pipi. pi Kahan Kahan Higham:

    3.4.5. pi

    x = det([

    a bc d

    ]).

    x = ad bc pi , F , :

    t1 = ad t1 = ad(1 + 1)t2 = bc t2 = bc(1 + 2)x = t1 t2 x = (t1 t2)(1 + 3)

    pi

    |x x| = |(t1 t2)(1 + 3) (ad bc)|= |(ad(1 + 1) bc(1 + 2))(1 + 3) (ad bc)|= |ad(1 + 3) bc(2 + 3) + ad13 bc23| (|ad|+ |bc|)2u+ (|ad|+ |bc|)u2

    pi pi

    |x x||x|

    (|ad|+ |bc|)2u+ (|ad|+ |bc|)u2|x| .

    pi |ad|, |bc| |x|, pi.. |x| pi , pi . Kahan pi pi:

  • 70 3. pi c2008, .

    t1 = bc t1 = bc(1 + 1)t2 = t1 b c (FMA) t2 = (t1 bc)(1 + 2)t3 = a d t1 (FMA) t3 = (ad t1)(1 + 3)x = t3 + t2 (1 + 4)x = t3 + t2

    pi pi - pi .

    |x x| = |(t3 + t2) x4 (ad bc)|= |(ad t1)(1 + 3) + (t1 bc)(1 + 2)

    x4 (ad bc)|= |(ad bc(1 + 1))(1 + 3) + (bc(1 + 1) bc)(1 + 2)

    x4 (ad bc)|= |ad3 bc(1 + 3 + 13)

    +bc1(1 + 2) x4|= |x3 x4 bc1(2 3)| (|x|+ |x|)u+ |bc|2u2

    pi |x| pi , pi pi |x|, |x| , pi pi pi pi pi pi ( |bc|u > |x|). pi .

    3.4.1. FMA pi

    . pi pipi pi .

    3.4.2. pi FMA pi pi .

    3.4.5. ... standard IEEE. pi pi pipi Goldberg [12] What every computer scientist should know about floating-pointarithmetic. pi [16, Appendix]. pi pi IEEE 754 floating-point standard [20]. pi pi . [2] ... pi pi Intel Pentium.

    3.4.6. pi Pentium bug pi - Intel pi pi , pipipi . pi - Alan Edelman MIT [10] [7].

    3.4.5 pi Java

    pi pi pi- pi pi Network Computing. pi pi Java. Java pi pi pi. - pi pi pi (pi..

  • 3.5. pi pi c2008, . 71

    interfaces, pi , pi), pi . pi- pi ; pi Java pi pi pi :

    pi pi : pi, Java complex types.

    pi. : Java lin-

    guistically enforced exact reproducibility of all floating point results, - pi pi pi pi- Java pipi pi pi pi (W. Kahan pi cruel delusion11.)

    pi, Java pi pipi. pi.. pi Java Linpack12.

    3.5 pi pi

    As every physicist knows, no equation is exact; therefore, we be-lieve that finite precision computation can be closer to physicalreality than exact computation. Thus it appears possible to tran-sform the limitations of the computer arithmetic into an asset. [5] pi (...): pipi - pi pi, pi pi pi pi, pi pi pi. - pi pi pi pi pi, . pipi ; (...) , pi pi pi pi . [9]Its impossible to compute things which dont exist. Its difficultto compute things which almost dont exist. [Cleve Moler]

    , pi pi pi pi pi pi (. pi R ), pi f : U Rm Rn. pi pi :

    x U pi m pi f f(x) pi n x, pi-

    x pi pi pi pi -pi, . x F . pi pi x pi pi pi x, x = fl(x).

    11 pi12 http://www.netlib.org/benchmark/linpackjava

  • 72 3. pi c2008, .

    f(x) pi f(x), pi (. R .

    fprog pi pi f pi ... F .

    pipi, pi pi

    fprog(x) f(x) fprog(x) f(x)

    f(x) . (3.7)

    (pi.. ) f .

    f(x), (3.7) pi pi. pi , (3.7). accuracy precision. . pi . pi pi pi Mathematica. pi :

    pi pi , accuracy pi pi pi pi pi. pi pi (3.7) . precision pi pi. pipi pi pi ...

    3.5.1. Vel Kahan [21]: Precision concerns the tight-ness of specification. Accuracy concerns its correctness. An utterly inaccuratestatement ... can be uttered quite precisely... 3.177777777777 is a rather precise(13 dec. digits) but rather inaccurate (2 significant decimal digits) approximationto pi.... Although exp(10) = 0.00000454 has 3 decimal digits of precision, it isaccurate to almost 6. Precision is to accuracy what intent is to accomplishment.A natural disinclination to distinguish them invites first shoddy science and ul-timately the kinds of cynical abuses brought to mind by Peoples Democracy,Correctional Facility and Free Enterprise .

    pi pi, pi pi f(x) f(x) pi . f pi x pi x x. pi (, pi) x. , pi pi - . pi pi pi x, pi -. pi pi pi pi pi pi .

  • 3.5. pi pi c2008, . 73

    X

    X*

    f(x)

    f(x )*

    y

    y*

    f(y)

    f(y )*

    U f( )U

    3.2: pi pi ) ) .

    3.5.1. f : R R pi pi y := f(x). pi pi x = x+x, pi pipi pi f , pi y = f(x+x). |f(x+x) f(x)| = |y y|.

    y y = f(x+x) f(x)

    = f (1)(x)x+f (2)(x+ x)

    2!(x)2, (0, 1)

    pi f, f (1), f (2) pi pipi x, x+x. f (1)(x) , pi . pi ,

    y yy

    = f(x)xf(x)

    xx

    +O((x)2) (3.8)

    |x| 1, (3.8) |x|, pi | f (x)xf(x) | pi y pi x. pi pi, pi pi pi. pi pi pi f (x)x f(x). , pi pi pi .

    pi , pi pif pi pi pi pi pi. pi pi pi x1+x2+x3pi pi ( 0, 1, 2) pi pi R , pi pi ... pi, pi pifprog. pi fprog pi pi x pi f

  • 74 3. pi c2008, .

    f(x)

    f(x)*

    f (x)prog

    f(x)

    f(x)*

    f (x)prog

    ()

    ()

    x

    x

    x*

    x*

    3.3: ) pi pi - . ) .

    . pi pi pi f pi . pi pi pi fprog :

    3.5.1. x U pi pi x x fprog(x) f(x). pi pi .

    pi pi, pi-pi . pi 3.3.

    pi pi pi , pi pipi. ,

    pi .

    pi , pi fprog(x) f(x) pi x x. pipi, pi pi :

    3.5.2. pipi , pi x x fprog(x) = f(x). ()pi pi pi .

    pipi, - .

    pi pi

    (3.7) pi pi pi (pi ) (=forward error). ,

  • 3.5. pi pi c2008, . 75

    , pi pi - x x pi pi pi (pi ) pi ... pi pi pi pi pipi. pi , pi pipi pi pi f(x) pi pi pi - pi. pi pi pi pi pi pi pi pi, pi.. x = (1, . . . , N )

    a1 = f1(1, . . . , N ), a2 = f2(a1, 1, . . . , N ), , z = fn(an1, , a1, 1, . . . , N ),pi fn f1 f fj(aj1, , a1, x) pi pi

    {aj1, , a1, 1, . . . , N}. pi ..., pi pi pi pi pi pi R , pi pi pi z pi z pi pi pi pipi.pi pi pi pi pi fj . pi 3.3.6 3.4.5. pi pi pi - pi pi pi pi ( pi pi) (=forward error analysis).

    pi pi pi pi pi -pi pipi, pi:

    f pi pi - pi pi pi pi . pi 3.3.6 3.4.5 pi , pi pi.

    f : Rn Rm pipi pi . pi pipipi pi 3.7.

    pi pi pi pi. pi, pi :

    pi pi pi a2 b2 (a b)(a+ b)x+ x

    x++x

    cos 1 2 sin2 2bb2 4c |b|+b2 4c + Vietaf(x+ ) f(x) f (1)(x)+ f (2)(x) 22 +

    3.5.2. pi pipi pi pi pi pi- , pi. pi pi pipi 1962 pi Ramon Moore [28].

  • 76 3. pi c2008, .

    pi x pi ( interval)(xL, xU ) pi pi , -pi ( interval arithmetic). pi pi (pi.. pi pi- (,+).) pipi [17] pi [1].

    pi pi pi (pi.. pi 3.3.6) pi pi pi pn =

    ni=1(1 + i) pi -

    |i| u. pi (1 u)n pn (1 + u)n.

    pn = 1 + nu + O(u2). pi pi pi . pi :

    3.5.1. |i| u i = 1 i = 1 : n nu < 1 ni=1

    (1 + i)i = 1 + n,

    pi|n| nu1 nu := n.

    pi. pi. n = 1. n = 1,

    ni=1

    (1 + i)i = (1 + n1)(1 + n)

    1 + n = 1 + n1 + n + n1n|n| = |n1 + n + n1n|

    (n 1)u1 (n 1)u + u+

    (n 1)u21 (n 1)u

    (n 1)u+ (n 1)u2 + u (n 1)u2

    1 (n 1)u nu

    1 (n 1)u n.

    n = 1ni=1

    (1 + i)i =1 + n11 + n

    n1 = n + n + nn

    n =n1 n1 + n

    |n| |n1 + u1 u |

    |n| nu (n 1)u2

    1 (n 1)u+ (n 1)u2 n

  • 3.5. pi pi c2008, . 77

    100 102 104 106 108 101010-15

    10-10

    10-5

    n

    gam

    ma

    u = 2e-16

    3.4: n.

    ni=1(1 + i)

    i :=< n > pi

    < n > < k >=< n+ k >, < n > / < k >=< n+ k >

    (pi nu < 1):

    n =nu

    1 nu nu(1 + nu+ (nu)2 + )= nu+O(u2)

    pi,

    ni=1

    (1 + i) (1 + u)n < enu.

    3.4 n u = 2 1016.

    3.5.2. pi pi , pi pi 3.3.6 pi pi pi pi : ... x, y F pi x2 + y2 G pi pipi pi 0 < x F fl(x) = x(1 + ) pi || u. pi pi pi , pi pipi pi

  • 78 3. pi c2008, .

    z = xx2+y2

    Erel(t1) pi

    t1 =x

    t3(1 + 5)

    =x

    t3(1 + 4)(1 + 5)

    =x

    (t1 + t2)(1 + 3)(1 + 4)(1 + 5)

    =x

    (x2(1 + 1) + y2(1 + 2))(1 + 3)(1 + 4)(1 + 5)

    pi |j | u j = 1 : 5. pi . 3.5.1 pi pipi pi pi pi pi. pi pi pi

    (x2(1 + 1) + y2(1 + 2))(1 + 3) = (x2(1 + 2) + y

    2(1 + 2 ))

    = (x2 + y2)(1 + 2 ),

    2 |

    2 | 2,

    (x2 + y2)(1 + 2 ) =

    x2 + y2(1 +

    2 )

    2 |

    2 | 2.

    pi pi 3.5.1 pipi

    t1 =x

    (x2(1 + 1) + y2(1 + 2))(1 + 3)(1 + 4)(1 + 5)

    =x

    (x2 + y2)(1 + 2 )(1 + 2)

    =x

    x2 + y2(1 + 2 )(1 + 2)

    =x

    (x2 + y2)(1 + 4)

    pi

    | t1 zz

    | = |4| 4. (3.9)

    (3.9) pi pi z t1 pi .

    pi pi

    pi pi pi pi , pi pi pi pi pi 3.5.2. pi pi pi x x pipi pi pi ... z = fprog(x) z = f(x).

    z z = fprog(x) f(x) = f(x) f(x).

  • 3.5. pi pi c2008, . 79

    pi pi pi pi, pi f(x) f(x). x x , pi ( ) pi - f (= perturbations) .

    pi pipi , pi pi, pi pi pi .pi pi pi pi pi !

    pipi pi pi13 (=backward error analysis) 14 - James Hardy Wilkinson (1919-86), pi pi . pi - Rounding Errors in Algebraic Processes pi 1963,pi ( pi [36]). - pi (pi pi ) pi.

    3.5.3. pi f(x1, x2, x3) = (x1+ x2) + x3 pi F . fprog(x1, x2, x3) = ((x1 + x2)(1 + 1) +x3)(1 + 2)

    fprog(x1, x2, x3) = x1(1 + 1)(1 + 2) + x2(1 + 1)(1 + 2) + x3(1 + 2)

    pi |j | u j = 1, 2. pi pi pi fprog(x1, x2, x3) = f(x1, x2, x3) (3.10)

    pi x1 = x1(1+1)(1+2), x2 = x2(1+1)(1+2), x3 = x3(1+2). |xj xj | = |xj(1 + 2 + 12)| j = 1, 2 |x3 x3| = |x32|. pi |xj xj | 3u|xj |, j = 1, 2 |x3 x3| u|x3|. pi

    |fprog(x1, x2, x3) f(x1, x2, x3)| = |f(x1, x2, x3) f(x1, x2, x3)|pi

    |xj xj ||xj | ju, j = 3 (j = 1, 2), 3 = 1.

    pi pi pi pi . pi pi pi

    pi . pi (pi pi) ; pi . pi, f : R R . pi pi pi ,

    fprog(x) f(x) = f(xprog) f(x) pi x = x+x pi x . pi 3.5.1,

    f(x+x) f(x) = f (1)(x)x+ f(2)(x+ x)

    2!(x)2, (0, 1)

    13 pi .14 pi Wilkinson, pi pi

    (1954) Wallace Givens pi von Neumann Goldstine(1947) Turing (1948).

  • 80 3. pi c2008, .

    pi f, f (1), f (2) pi pipi x, x + x. pi (3.8) pi pipi pi pi-, pi.. | f (x)xf(x) | pi pi y pi x.

    3.5.4. pi f(x1, x2, x3) = (x1 +x2) + x3 . (pi) pi f(x1, x2) = x1 +x2. , pi pi pi pifprog(x1, x2) = f(x1(1 + 1), x2(1 + 1)). f(x + h) f(x) + [1, 1]hpi h = [x11, x21]>, pif(x+ h) f(x)f(x)

    |x11 + x21||x1 + x2| h|x1 + x2|

    pi pi (x1, x2) pi x1 + x2 pi h. , x1, x2 , pi.. , h = |x11 + x21| u|x1 + x2| pif(x+ h) f(x)f(x)

    u.

    3.5.5. pi - Horner pi 2.2.1 pi pi x. , Horner pi pi pi . - pi pi 2.2.1 pi .

    sn = nfor k = n 1 : 1 : 0

    sk = xsk+1 + kend

    pi ... pi 3.5.1 pi pi :

    sn1 = (xsn < 1 > +n1) < 1 >= xn < 2 > +n1 < 1 >

    sn2 = (xsn1 < 1 > +n2) < 1 >...

    s0 = 0 < 1 > +1x < 3 > + n1xn1 < 2n 1 > +nxn < 2n >= (1 + 1)0 + (1 + 2n)nxn

    s0 = fprog(0, ..., n, x)= f(0(1 + 1), ..., n(1 + 2n), x)

  • 3.5. pi pi c2008, . 81

    pi pi . 2n pipi , pi- |jj | 2n|j | , pi pipi pi pi pipi pi... pi pi . pi pi . pi pi pipi pi pi pi pi . pi

    |p(x) s0||p(x)| 2n

    nk=0 |k||x|k|p(x)| ,

    pi pi pipi pi pi pi.

    3.6 pi pi .

    pi

    pi pi pi . pi pi pi. pi pi pipi, pi pi (3.7) pi pi pi pipi pi:

    1. pi pi - . pi pi pi pipi pi.

    2. pi pipi pi (pi) pi pi. pi pi pipi pi -.

    , pi , pipi - pi pi (3.7).

    pi , f x. x 6= x pi pi pi pi x x x x/x.

    pi pi pi pi. , pi - pi pi pi. pi pi .

    3.5.3. pi pi pi - (= condition number ) Alan Turing 1948 Rounding-offerrors in matrix processes [34]. pi pipi - John Rice [31].

    3.5.4. pi pipi pi pi pi pipi pi pi pi, pi

  • 82 3. pi c2008, .

    pi pi !

    pi pi pi pi (. [36] [31]). , pi (.2) .

    pi pi pi pi pi, x = (1, . . . , m), y = (1, . . . , n) y = f(x). pi x y = f(x). x, mn pi ij = fij |x f pi pi x. , ij pi f x pi pi pi f . pi pi, mn pi pi pi pi pi pi pi . pi,pi pi Kj |j j | Kjj j |. n pi pi pi x. pi pi, pi pi K y y2 Kx x2 |j j |. K pi pi pi x.

    pi pi. pi pi . pi Kj

    |j j |j

    Kj x x2x2 .

    pi pi pi pi. pi, pi pi j . pi Kj

    |j j |y2 Kj

    x xx2 .

    pi pi K

    y y2y2 K

    x xx2 .

    pi pi , - :

    3.5.3 (Rice [31]). X,Y pi pi f : X Y , pi . x y := f(x). pi x, y X,Y . pi pif