octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49940] The svd function takes very long time


From: Rik
Subject: [Octave-bug-tracker] [bug #49940] The svd function takes very long time for big matrices
Date: Wed, 28 Dec 2016 17:09:24 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #3, bug #49940 (project octave):

I don't think the large slowdown is attributable to Octave.  Octave is an
interpreter which relies on other solid linear algebra libraries like BLAS and
LAPACK to do the real work.  The svd function is rather special in that there
are at least two different library functions in LAPACK that could be used. 
Octave allows you to switch which function is called with the svd_driver()
function.  Try 'help svd_driver' to get the documentation.

I coded up a test to see if svd driver makes a difference and it definitely
does for the test case used here.  The code is shown below and attached as
tst_svd_driver.m


x = rand (2e3);

svd_driver ("gesvd");
printf ("SVD_DRIVER: gesvd, Matrix Size: %s\n", mat2str (size (x))); 

tic; sv = svd (x); bm1 = toc
tic; [u,s,v] = svd (x); bm2 = toc

svd_driver ("gesdd");
printf ("SVD_DRIVER: gesdd, Matrix Size: %s\n", mat2str (size (x))); 

tic; sv2 = svd (x); bm21 = toc
tic; [u2,s2,v2] = svd (x); bm22 = toc


The results are


tst_svd_driver
SVD_DRIVER: gesvd, Matrix Size: [2000 2000]
bm1 =  3.0383
bm2 =  28.750
SVD_DRIVER: gesdd, Matrix Size: [2000 2000]
bm21 =  3.1114
bm22 =  6.0188


Using gesdd the slowdown is only 2X which is probably acceptable.  This also
seems to be roughly the slowdown that Matlab experiences for the 1e3 and 2e3
cases.




(file #39325)
    _______________________________________________________

Additional Item Attachment:

File name: tst_svd_driver.m               Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49940>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]