gbsv.f90 Source File

ADAPTED FROM LAPACK_95 by Guy Grubbs and Michael Hirsch


Files dependent on this one

sourcefile~~gbsv.f90~~AfferentGraph sourcefile~gbsv.f90 gbsv.f90 sourcefile~pdeparabolic.f90 PDEparabolic.f90 sourcefile~pdeparabolic.f90->sourcefile~gbsv.f90 sourcefile~test_diffusion1d.f90 test_diffusion1D.f90 sourcefile~test_diffusion1d.f90->sourcefile~pdeparabolic.f90 sourcefile~diffusion.f90 diffusion.f90 sourcefile~diffusion.f90->sourcefile~pdeparabolic.f90 sourcefile~multifluid.f90 multifluid.f90 sourcefile~multifluid.f90->sourcefile~diffusion.f90 sourcefile~gemini.f90 gemini.f90 sourcefile~gemini.f90->sourcefile~multifluid.f90

Contents

Source Code


Source Code

!! ADAPTED FROM LAPACK_95 by Guy Grubbs and Michael Hirsch
module vendor_lapack95
use, intrinsic :: iso_fortran_env, only: real32, real64
implicit none

contains

subroutine gbsv(A,B,KL,IPIV,INFO)
class(*), dimension(:,:), intent(inout) :: A
class(*), dimension(:), intent(inout) :: B
integer, intent(in), optional :: KL
integer, dimension(:), intent(out), optional, target :: IPIV
integer, intent(out), optional :: INFO
integer :: LINFO, ISTAT, ISTAT1, SIPIV, LDA, N, NRHS, LKL, KU
integer, dimension(:), pointer :: LPIV
intrinsic :: size, present

LINFO = 0; ISTAT = 0;
LDA = size(A,1); N = size(A,2); NRHS = 1;

if ( present(KL) ) then
  LKL = KL
else
  LKL = (LDA-1)/3
end if

if ( present(IPIV) ) then
  SIPIV = size(IPIV)
  LPIV => IPIV
else
  SIPIV = N
  allocate(LPIV(N))
end if

if ( ISTAT == 0 ) then
  KU = LDA - 2*LKL - 1

  select type (A)
    type is (real(real32))
      call sgbsv(N,LKL,KU,NRHS,A,LDA,LPIV,B,N,LINFO)
    type is (real(real64))
      call dgbsv(N,LKL,KU,NRHS,A,LDA,LPIV,B,N,LINFO)
    class default
      error stop "unhandled kind"
  end select
endif

end subroutine gbsv

end module vendor_lapack95