|
Prev: polyfir with constraints
Next: How to implement 1 -Nearest Neighbor method plz tell me urgenttt
From: Bryan on 6 May 2008 09:22 Matlab's SVD() function yields a result very close to, but different than the result when using LAPACK's sgesvd() method in C++. Any idea why? By default, svd uses double- precision, but I'm using the single precision version of svd, which, according to Matlab's documentation, utilizes sgesvd in its computation. Since they both use sgesvd, shouldn't the results be equal? I'm using ACML v4.0.1 and Matlab 7.4.0 Thanks, Bryan
From: Greg Heath on 6 May 2008 09:30 On May 6, 9:22 am, "Bryan " <bdg146.removeT...(a)gmail.com> wrote: > Matlab's SVD() function yields a result very close to, but > different than the result when using LAPACK's sgesvd() > method in C++. Any idea why? By default, svd uses double- > precision, but I'm using the single precision version of > svd, which, according to Matlab's documentation, utilizes > sgesvd in its computation. Since they both use sgesvd, > shouldn't the results be equal? > > I'm using ACML v4.0.1 and Matlab 7.4.0 How are the results different? Greg
From: Bryan on 6 May 2008 09:46 Greg Heath <heath(a)alumni.brown.edu> wrote in message > How are the results different? > > Greg Given a <168 x 2> input of single-precision values between 0 and 1: The max difference between the V output matrices is 1.7881e-7 and the max difference between the U output matrices is 3.7625e-7. The sigma values are the same. Computing X(input) - U*S*V' shows that the C++ sgesvd() output is better than the Matlab SVD() output. However, that may be pure coincidence and a different input may yield different results.
From: carlos lopez on 6 May 2008 11:49 "Bryan " <bdg146.removeThis(a)gmail.com> wrote in message <fvpm1r$bps$1(a)fred.mathworks.com>... > Matlab's SVD() function yields a result very close to, but > different than the result when using LAPACK's sgesvd() > method in C++. Any idea why? By default, svd uses double- > precision, but I'm using the single precision version of > svd, which, according to Matlab's documentation, utilizes > sgesvd in its computation. Since they both use sgesvd, > shouldn't the results be equal? > > I'm using ACML v4.0.1 and Matlab 7.4.0 > > Thanks, > Bryan The uniqueness of SVD decomposition is a recurrent topic. Google for "svd decomposition not unique". Anyway, I agree that same routines should (on principle) agree in their results... unless they resort to other routines (like rand()) which might differ from machine to machine and explain the issue. To be convinced you should check whether or not your present results agree with the definition (i.e. check that the product equals the original matrix). Hope this helps. Regards
From: Bryan on 6 May 2008 12:02 "carlos lopez" <clv2clv_00000000_(a)adinet.com.uy> wrote in message <fvpulg$rdh$1(a)fred.mathworks.com>... > The uniqueness of SVD decomposition is a recurrent topic. > Google for "svd decomposition not unique". > Anyway, I agree that same routines should (on principle) > agree in their results... unless they resort to other > routines (like rand()) which might differ from machine to > machine and explain the issue. > To be convinced you should check whether or not your present > results agree with the definition (i.e. check that the > product equals the original matrix). > Hope this helps. > Regards Thanks for the input. I understood that the SVD is not unique, but I assumed that, since the underlying computations are both being conducted with LAPACK, their solution should be unique. I understand your point though regarding relying on other, non-uniform routines though. I have checked the solution via X-U*S*V' and comparing that result to 0. However, there seems to be no definite conclusion as to which gives the better result. For some data, the C++ output is closer to 0, while for others, Matlab is closer. So I suppose getting the C++ svd output to equal the Matlab svd output isn't really possible?
|
Pages: 1 Prev: polyfir with constraints Next: How to implement 1 -Nearest Neighbor method plz tell me urgenttt |