KronLinInv  0.3
Kronecker-product-based linear inversion

◆ symsolvels()

subroutine, private kronlininv::symsolvels ( real(dp), dimension(:,:), intent(in)  A,
real(dp), dimension(:,:), intent(in)  B,
real(dp), dimension(:,:), intent(out)  sol 
)
private

Solves a linear system AX = B for symmetric A, real numbers

Parameters
[in]Acoefficients matrix (linear operator)
[in]Bmatrix
[out]solsolution to the linear system (matrix)
Date
5/8/2016 - Initial Version

Definition at line 895 of file kronlininv.f08.

895  real(dp),intent(in) :: a(:,:),b(:,:)
896  real(dp),intent(out) :: sol(:,:)
897  integer,parameter :: wmax=3000 ! max size allowed for work
898  integer,allocatable :: ipiv(:)
899  integer :: n,nrhs,lda,ldb,lwork
900  character :: uplo
901  real(dp),allocatable :: work(:),a2(:,:)
902  integer :: info
903  ! External procedures defined in LAPACK
904  external dsysv
905  uplo = 'L'
906  n = size(a,1)
907  nrhs = size(b,2)
908  allocate(a2(n,n))
909  a2 = a
910  lda = size(a,1)
911  allocate(ipiv(n))
912  ldb = size(b,1)
913  ! copy B to sol to avoid it to be overwritten
914  sol = b
915  ! apparently work must be allocated for the query to dsysv to work...
916  allocate(work(1))
917  lwork = -1
918  call dsysv(uplo,n,nrhs,a2,lda,ipiv,sol,ldb,work,lwork,info)
919  lwork = min(wmax,int(work(1)))
920  !! now lwork is assigned, so actually calculate eigvec/val
921  deallocate(work)
922  allocate(work(lwork))
923  call dsysv(uplo,n,nrhs,a2,lda,ipiv,sol,ldb,work,lwork,info)
924  if (info/=0) then
925  write(*,*) "linear system solver failed...'"
926  print*,'info: ',info
927  stop
928  end if
Here is the caller graph for this function: