forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem calling a function

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Plato
View previous topic :: View next topic  
Author Message
Kalashnikov



Joined: 25 May 2006
Posts: 7

PostPosted: Mon May 29, 2006 5:23 am    Post subject: Problem calling a function Reply with quote

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(:,Smile
REAL(iwp)::det
INTEGER::it
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(:,Smile
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
_________________
Mikhail Kalashnikov
Back to top
View user's profile Send private message
Kalashnikov



Joined: 25 May 2006
Posts: 7

PostPosted: Mon May 29, 2006 8:34 am    Post subject: Problem calling a function Reply with quote

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
_________________
Mikhail Kalashnikov
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Plato All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group