# Execution time for SVD

2 messages
Open this post in threaded view
|

## Execution time for SVD

 I am at a loss explaining the difference in time for Octave 5.1.90 to execute the following statements: tic; svd(rand(3000)); toc                                                                           (I a)Elapsed time is 11.3338 seconds tic; [a,b,c] = svd(rand(3000)); toc                                                           (II a)Elapsed time is 148.349 seconds. tic; a = rand(3000);b=rand(3000);c=rand(3000); toc                         (III a)Elapsed time is 0.263816 seconds. Why is there this very large difference in execution time in statement (II) ?  For comparison, here is what MATLAB does: tic; svd(rand(3000)); toc                                                                           (I b)Elapsed time is 10.845707 seconds. tic; [a,b,c] = svd(rand(3000)); toc                                                           (II b)Elapsed time is 13.388534 seconds. tic; a = rand(3000);b = rand(3000); c = rand(3000);  toc                   (III b)Elapsed time is 0.252371 seconds. I have repeated these statements several times and found the reported times to be consistent. Henk Borsje
Open this post in threaded view
|

## Re: Execution time for SVD

 On 1/30/20 4:24 AM, Henk Borsje wrote: > I am at a loss explaining the difference in time for Octave 5.1.90 to > execute the following statements: > >   > > tic; svd(rand(3000)); > toc                                                                           > (I a) > > Elapsed time is 11.3338 seconds > >   > > tic; [a,b,c] = svd(rand(3000)); toc                             >                               (II a) > > Elapsed time is 148.349 seconds. > >   > > tic; a = rand(3000);b=rand(3000);c=rand(3000); > toc                         (III a) > > Elapsed time is 0.263816 seconds. > >   > > Why is there this very large difference in execution time in statement > (II) ? > >   > > For comparison, here is what MATLAB does: > >   > > tic; svd(rand(3000)); > toc                                                                           > (I b) > > Elapsed time is 10.845707 seconds. > >   > > tic; [a,b,c] = svd(rand(3000)); > toc                                                           (II b) > > Elapsed time is 13.388534 seconds. > >   > > tic; a = rand(3000);b = rand(3000); c = rand(3000); >  toc                   (III b) > > Elapsed time is 0.252371 seconds. > >   > > I have repeated these statements several times and found the reported > times to be consistent. > >   > > Henk Borsje > You can try to change the svd driver function to "gesdd" [1], if it proves to be stable enough for your purpose.  Read the bug cited in [1]. >> svd_driver ("gesdd"); >> tic; svd(rand(3000)); toc Elapsed time is 13.2037 seconds. >> tic; [a,b,c] = svd(rand(3000)); toc Elapsed time is 16.3084 seconds. HTH, Kai [1] https://octave.org/doc/v5.1.0/XREFsvd_005fdriver.html