[Fortran] 纯文本查看 复制代码
program main
USE LAPACK95
USE F95_PRECISION
REAL,ALLOCATABLE :: A1(:,:),B1(:,:)
INTEGER N,NRHS,LDA LDB
! INTERFACE
! SUBROUTINE sposv( uplo, n, nrhs, a, lda, b, ldb, info )
! REAL A(:,:)
! REAL B(:,:)
! CHARACTER(LEN=1), OPTIONAL :: UPLO
! INTEGER, OPTIONAL :: INFO
! INTEGER N,NRHS,LDA LDB
! END SUBROUTINE SPOSV
! END INTERFACE
ALLOCATE(A1(5,5),B1(5,3))
N=5
NRHS=3
LDA=5
LDB=5
OPEN(11,FILE='A.TXT')
OPEN(12,FILE='B.TXT')
DO I=1,5
READ(11,*)(A1(I,J),J=1,5)
END DO
DO I=1,5
READ(12,*)(B1(I,J),J=1,3)
END DO
CALL SPOSV(n, nrhs, A1, lda, B1, ldb)
DO I=1,5
WRITE(*,*)(B1(I,J),J=1,3)
END DO
DEALLOCATE(A1,B1)
end program main