10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-23 04:43:45 +01:00

Fix bug in complex svd

This commit is contained in:
Anthony Scemama 2024-01-26 13:19:21 +01:00
parent b91eb884d6
commit c0a4b7890e

View File

@ -645,7 +645,7 @@ subroutine get_pseudo_inverse_complex(A,LDA,m,n,C,LDC,cutoff)
END_DOC END_DOC
integer, intent(in) :: m,n, LDA, LDC integer, intent(in) :: m,n, LDA, LDC
complex*16, intent(in) :: A(LDA,n) complex*16, intent(in) :: A(LDA,n)
double precision, intent(in) :: cutoff double precision, intent(in) :: cutoff, d1
complex*16, intent(out) :: C(LDC,m) complex*16, intent(out) :: C(LDC,m)
double precision, allocatable :: D(:), rwork(:) double precision, allocatable :: D(:), rwork(:)
@ -673,8 +673,9 @@ subroutine get_pseudo_inverse_complex(A,LDA,m,n,C,LDC,cutoff)
stop 1 stop 1
endif endif
d1 = D(1)
do i=1,n do i=1,n
if (D(i) > cutoff*D(1)) then if (D(i) > cutoff*d1) then
D(i) = 1.d0/D(i) D(i) = 1.d0/D(i)
else else
D(i) = 0.d0 D(i) = 0.d0