!
Subroutine SVD_Solver
use Advertisement
use IMSLF90
integer*4 i
real*8 singl(2*l_max)
complex*16 r_p(2*n_max,1), sol(2*l_max,1)
if (m.eq.0) then
 r_p(1:2*n_max, 1)=(0.d00,0.d00)
 sol(1:2*l_max, 1)=(0.d00,0.d00)
 do i=1, n_max
  r_p(i,1)=n_M(2,i)
 end do
 call lin_sol_svd(MATRIX(1:n_max, 1:l_max), r_p, sol, s=singl)
 print *, singl(l_max)/singl(1)
 do i=1, l_max
  l_M(2,i)=sol(i,1)
 end do
 r_p(1:2*n_max, 1)=(0.d00,0.d00)
 sol(1:2*l_max, 1)=(0.d00,0.d00)
 do i=1, n_max
  r_p(i,1)=n_N(2,i)
 end do
 call lin_sol_svd(MATRIX(n_max+1:2*n_max, l_max+1:2*l_max), r_p, sol, s=singl)
 print *, singl(l_max)/singl(1)
 do i=1, l_max
  l_N(2,i)=sol(i,1)
 end do
else
 r_p(1:2*n_max, 1)=(0.d00,0.d00)
 sol(1:2*l_max, 1)=(0.d00,0.d00)
 do i=1, n_max
  r_p(i,1)=n_M(2,i)
  r_p(n_max+i,1)=n_N(3,i)
 end do
 call lin_sol_svd(MATRIX(1:2*n_max, 1:2*l_max), r_p, sol, s=singl)
 print *, singl(2*l_max)/singl(1)
 do i=1, l_max
  l_M(2,i)=sol(i,1)
  l_N(3,i)=sol(i+l_max,1)
 end do
 r_p(1:2*n_max, 1)=(0.d00,0.d00)
 sol(1:2*l_max, 1)=(0.d00,0.d00)
 do i=1, n_max
  r_p(i,1)=n_M(3,i)
  r_p(n_max+i,1)=n_N(2,i)
 end do
 do n=1, n_max
  do l=1, l_max
   MATRIX(n, l_max+l)=-MATRIX(n, l_max+l)
   MATRIX(n_max+n, l)=-MATRIX(n_max+n, l)
  end do
 end do
 call lin_sol_svd(MATRIX(1:2*n_max, 1:2*l_max), r_p, sol, s=singl)
 do i=1, l_max
  l_M(3,i)=sol(i,1)
  l_N(2,i)=sol(i+l_max,1)
 end do
end if
End Subroutine SVD_Solver
!
Subroutine InversionCheck
use Advertisement
implicit none
call Preparations
m=m_max
Matrix=(0.d00, 0.d00)
n_M=(1.d00, 0.d00); n_N=(1.d00, 0.d00)
do n=1, n_max
 matrix(n,n)=(2.d00,0.d00)
end do
do n=1+n_max, 2*n_max
 matrix(n,n)=(1.d00,0.d00)
end do
call SVD_Solver
do l=1, l_max
 print *, l_M(2, l)
end do
write (*,*) '******************'
do l=1, l_max
 print *, l_N(2, l)
end do
End subroutine InversionCheck