From c0a4b7890e51454e078ab894b935a4e772484fab Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 26 Jan 2024 13:19:21 +0100 Subject: [PATCH] Fix bug in complex svd --- src/utils/linear_algebra.irp.f | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/linear_algebra.irp.f b/src/utils/linear_algebra.irp.f index 314ad4f6..7cef9ee4 100644 --- a/src/utils/linear_algebra.irp.f +++ b/src/utils/linear_algebra.irp.f @@ -645,7 +645,7 @@ subroutine get_pseudo_inverse_complex(A,LDA,m,n,C,LDC,cutoff) END_DOC integer, intent(in) :: m,n, LDA, LDC 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) double precision, allocatable :: D(:), rwork(:) @@ -673,8 +673,9 @@ subroutine get_pseudo_inverse_complex(A,LDA,m,n,C,LDC,cutoff) stop 1 endif + d1 = D(1) do i=1,n - if (D(i) > cutoff*D(1)) then + if (D(i) > cutoff*d1) then D(i) = 1.d0/D(i) else D(i) = 0.d0