12.07.2015 Views

Linear Algebra

Linear Algebra

Linear Algebra

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Topic: Speed of Calculating Determinants 335the N×N array A. The program’s outer loop runs through each ROW between 1and N-1 and does the entry-by-entry combination −PIVINV · ρ ROW + ρ I with thelower rows.DO 10 ROW=1, N-1PIVINV=1.0/A(ROW,ROW)DO 20 I=ROW+1, NDO 30 J=I, NA(I,J)=A(I,J)-PIVINV*A(ROW,J)30 CONTINUE20 CONTINUE10 CONTINUE(This code is naive; for example it does not handle the case that the A(ROW,ROW)is zero. Analysis of a finished version that includes all of the tests and subcasesis messier but gives the same conclusion.) For each ROW, the nested I and Jloops perform the combination with the lower rows by doing arithmetic on theentries in A that are below and to the right of A(ROW,ROW). There are (N − ROW) 2such entries. On average, ROW will be N/2. Therefore, this program will performthe arithmetic about (N/2) 2 times, that is, this program will run in a timeproportional to the square of the number of equations. Taking into account theouter loop, we estimate that the running time of the algorithm is proportionalto the cube of the number of equations.Finding the fastest algorithm to compute the determinant is a topic of currentresearch. So far, people have found algorithms that run in time between thesquare and cube of N.The contrast between these two methods for computing determinants makesthe point that although in principle they give the same answer, in practice wewant the one that is fast.ExercisesMost of these presume access to a computer.1 Computer systems generate random numbers (of course, these are only pseudorandom,in that they come from an algorithm, but they pass a number of reasonablestatistical tests for randomness).(a) Fill a 5×5 array with random numbers (say, in the range [0..1)). See if it issingular. Repeat that experiment a few times. Are singular matrices frequent orrare (in this sense)?(b) Time your computer algebra system at finding the determinant of ten 5×5arrays of random numbers. Find the average time per array. Repeat the prioritem for 15×15 arrays, 25×25 arrays, 35×35 arrays, etc. You may find that youneed to get above a certain size to get a timing that you can use. (Notice that,when an array is singular, we can sometimes decide that quickly, for instance ifthe first row equals the second. In the light of your answer to the first part, doyou expect that singular systems play a large role in your average?)(c) Graph the input size versus the average time.2 Compute the determinant of each of these by hand using the two methods discussedabove.2 1 0 0(a)∣ 2 13 1 15 −3∣(b)−1 0 5(c)1 3 2 0∣−1 2 −2∣0 −1 −2 1∣0 0 −2 1∣

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!