我应该如何调用 Fortran 函数?
我正在尝试调用DLANSY,但它错误地返回 0。请参阅下面的代码和程序输出。
SUBROUTINE COND(TYP,N,A,LDA,IPIV,WORK,LWORK,IWORK,INFO,RCOND)
INTEGER TYP, N, LDA, IPIV(*), IWORK(*), INFO, LWORK
DOUBLE PRECISION A(LDA,*), ANORM, RCOND, WORK(*)
CHARACTER*1 UPLO
EXTERNAL DLANSY, DSYTRF, DSYCON
IF (TYP .EQ. 0) THEN
UPLO = 'L'
ELSE
UPLO = 'U'
ENDIF
DO I = 1, N
DO J = 1,N
WRITE(*,*) I,J,A(I,J)
END DO
END DO
WRITE(*,*) 'TYPE ',UPLO
WRITE(*,*) 'N ',N
WRITE(*,*) 'LDA ',LDA
ANORM = DLANSY('1', UPLO, N, A, LDA, WORK)
C ANORM = 10;
WRITE(*,*) 'ANORM ',ANORM
END
它打印的内容:
1 1 1.0000000000000000
1 2 2.0000000000000000
1 3 3.0000000000000000
1 4 4.0000000000000000
2 1 1.0000000000000000
2 2 2.0000000000000000
2 3 3.0000000000000000
2 4 4.0000000000000000
3 1 1.0000000000000000
3 2 2.0000000000000000
3 3 3.0000000000000000
3 4 4.0000000000000000
4 1 1.0000000000000000
4 2 2.0000000000000000
4 3 3.0000000000000000
4 4 4.0000000000000000
TYPE L
N 4
LDA 4
ANORM 0.0000000000000000
在输入数组中具有适当的大小。
到底是怎么回事?