From help-octave-request at bevo dot che dot wisc dot edu Mon Nov 23 20:08:20 1998 Subject: Speed of matrix multiplication From: "John W. Eaton" To: Yip Fai Cc: "help-octave at bevo dot che dot wisc dot edu" Date: Mon, 23 Nov 1998 20:08:24 -0600 (CST) On 24-Nov-1998, Yip Fai wrote: | How can I increase the speed of matrix multiplication? Comparison of | inverse operation and the multiplication shows that inverse operation | used 46s and the multiplication operation used 79s. Both of the test is | work on a 1000x1000 matrix. Following is the script I tried. | | function testtt(a) | | tic | b =inv(a); | toc | tic | c = a*b; | toc | endfunction | | Where a is produced by a=rand(1000,1000). Matlab can finished the | operations within 6~8 sec. The multiplication operation time is too long | for my project. Is there any method to impove it? You haven't provided very many details, so it's hard to give good advice about how you might be able to improve performance. On what kind of system did you perform the test? What Fortran compiler did you use to compile the Fortran bits of Octave? What optimization options did you use? BTW, for measuring performance, cputime is better than using tic and toc. The cputime function only counts CPU time. The tic and toc functions measure elapsed wall clock time. If your system is running other processes, tic and toc will report the time spent for all processes. jwe