Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Help with rbdsqr (svd routine)

madstrolle
Beginner
234 Views
Hello there

I am trying make singular value decomposition on a general matrix A. I follow the guidelines in the mkl manual, i.e. first reduce A to the bidiagonal matrix B, and then use the routine rbdsqr to make the svd. I do the following using the intel Fortran compiler in Ubuntu 8.10:

real, dimension(3,3) :: Te,u,vt
real, dimension(3), allocatable :: d,e

Test matrix:
Te(:,1) = ((/1.,2.,3./))
Te(:,2) = ((/3.,1.,5./))
Te(:,2) = ((/3.,3.,5./))

d = 0; e = 0;
call gebrd(Te,d,e)

gives: d = [-3.741657 1.362770 0] and e =[ -6.414269 0 0], as is expected


call rbdsqr(d,e,vt,u)

now d and vt becomes matrices which are not the same for each run of the program. In addition, when i dump them on the screen, I get ******** for some of the matrix entries... I do get the correct singular values
d = [7.519318 0.6781226 0]
I expect this to be some sort of trouble with the variable declarations, but i dont understand what the problem is... On exit the relation

A = u*D*vt

D being a diagonal matrix of the components of d, should be true. Additionally i tried using the "info" option for both routines, which returned 0 in both cases.

I tried to search google for examples where these routines were used, but i couldn't find any; so if anyone knows of an example it would be extremely helpfull if you could direct me to it.

Any help would be greatly appreciated!

/ Mads
0 Kudos
1 Reply
mecej4
Honored Contributor III
234 Views
It is hard to debug source code without seeing it! There can be millions of reasons why the results turned out to be incorrect, but having the source code visible will reduce that number to something manageable.

Please post a short "reproducer", i.e, complete example source code that can be compiled and run to reproduce the problems that you described.
0 Kudos
Reply