Silverfrost Forums

Welcome to our forums

Problem calling a function

29 May 2006 4:23 #699

I'm having difficulty calling the following function:

FUNCTION determinant(jac)RESULT(det)

IMPLICIT NONE
INTEGER,PARAMETER::iwp=SELECTED_REAL_KIND(15) REAL(iwp),INTENT(IN)::jac(:,:) REAL(iwp)det INTEGERit it=UBOUND(jac,1)
SELECT CASE(it) CASE(1) det=1.0_iwp CASE(2) det=jac(1,1)*jac(2,2)-jac(1,2)jac(2,1) CASE(3) det=jac(1,1)(jac(2,2)*jac(3,3)-jac(3,2)jac(2,3)) det=det-jac(1,2)(jac(2,1)*jac(3,3)-jac(3,1)jac(2,3)) det=det+jac(1,3)(jac(2,1)jac(3,2)-jac(3,1)jac(2,2)) CASE DEFAULT WRITE(,)' wrong dimension for Jacobian matrix' END SELECT RETURN END FUNCTION determinant

I've provided the following interface:

interface EMELIANENKO

FUNCTION determinant(jac)RESULT(det)
REAL(iwp),INTENT(IN)::jac(:,:)
end FUNCTION

end interface

...also, I've made the following declarations which pertain to the DETERMINANT function:

INTEGER,PARAMETER::iwp=SELECTED_REAL_KIND(15) REAL(iwp) :: det,determinant (Is it correct to declare the function DETERMINANT in this way?)

I'm getting the following error message:

'error 283 - DETERMINANT must appear in a type declaration because IMPLICIT NONE has been used'

Is there something wrong with the interface or the declarations of DET and DETERMINANT?

Thanks,

Mikhail Kalashnikov

29 May 2006 7:34 #700

Actually, I think I've now solved the problem.

I changed the header in both the function and its interface to REAL FUNCTION and it seems to be working.

Mikhail Kalashnikov

Please login to reply.