[petsc-users] SLEPc: non-real singular vectors from SVD of real matrix

Peder Jørgensgaard Olesen pjool at mek.dtu.dk
Thu Apr 29 05:42:45 CDT 2021


Hello


I've noticed that doing a singular value decomposition of a real matrix appears to result in non-real singular vectors. This should not be the case - singular vectors of a real matrix must be real-valued.


In the example attached I read a matrix from a binary file (also attached), perform the SVD, and write singular vectors to an HDF5 file which I subsequently inspect using h5dump, revealing  non-zero imaginary parts of vector elements as highlighted below:

[pjool at svol mwes]$ h5dump -d U0_sample_svd -c "5,2" sample_svecs.h5
HDF5 "sample_svecs.h5" {
DATASET "U0_sample_svd" {
   DATATYPE  H5T_IEEE_F64LE
   DATASPACE  SIMPLE { ( 882, 2 ) / ( 882, 2 ) }
   SUBSET {
      START ( 0, 0 );
      STRIDE ( 1, 1 );
      COUNT ( 5, 2 );
      BLOCK ( 1, 1 );
      DATA {
      (0,0): 0.0226108, 0.0299595,
      (1,0): 0.035414, 0.0469237,
      (2,0): 0.0276317, 0.0366122,
      (3,0): 0.0145344, 0.0192581,
      (4,0): 0.0110376, 0.0146249
      }
   }
   ATTRIBUTE "complex" {
      DATATYPE  H5T_STD_I32LE
      DATASPACE  SCALAR
      DATA {
      (0): 1
      }
   }
}
}

I also extract the imaginary part of the input matrix and print its norm to ensure that the matrix is indeed real.


I'm running v3.14, but I don't believe that alone should cause the issue, since it what I'm trying to do appears like a rather common and basic task.


What might be the reason behind this behavior, and what can be done to resolve it?



Med venlig hilsen / Best Regards


Peder Jørgensgaard Olesen

PhD Student, Turbulence Research Lab

Dept. of Mechanical Engineering

Technical University of Denmark

Niels Koppels Allé

Bygning 403, Rum 105

DK-2800 Kgs. Lyngby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210429/b620c6ba/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_bin.c
Type: text/x-csrc
Size: 1752 bytes
Desc: read_bin.c
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210429/b620c6ba/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample_data
Type: application/octet-stream
Size: 218768 bytes
Desc: sample_data
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210429/b620c6ba/attachment-0001.obj>


More information about the petsc-users mailing list