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 

WHERE gives runtime error
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Wed Dec 13, 2006 8:43 am    Post subject: Reply with quote

We have researched this issue in detail with the following conclusions.

MATMUL is a nonelemental function.

The relevant paragraph in the Fortran Standard is in section 7.5.3.2 and begins "If a nonelemental function reference occurs in the expr or variable..." then "the function is fully evaluated".

I can confirm that FTN95 does not optimise the calculation by moving the function evaluation before the WHERE construct so the programmer should do this.

I can also confirm that, as things stand at the moment, FTN95 usually gives incorrect results in this situation so the programmer must move the function evaluation before the WHERE construct in order to get correct results.

For a fully optimised solution the programmer must provide the relevant inline expansion of the embedded function. In this example the call to MATMUL should be replaced by code that produces just one element of the resulting MATMUL array.

Regards

Paul
Back to top
View user's profile Send private message AIM Address
KL
Guest





PostPosted: Mon Dec 18, 2006 10:25 am    Post subject: Problem “Where gives runtime error”: Reply with quote

Dear Paul,
Thank you very much for your long answer dated December 13th. Frankly, this matter is far beyond my “competences” since I have only recently learned Fortran 90/95. My “knowledge” is based on the books:
1. fortran 95 (fortran 95/2003) explained, by M. Metcalf et al. and
2. Numerical Recipes in Fortran 90, Second Edition, Volume 2, by H. Press et al.
You are right: MATMUL is a non-elemental function and I can follow your argumentation. After this long discussion, I know what I should avoid in such situations. Thank you very much!

On the other hand, the book Numerical Recipes is for thousands of numerical analysts a kind of a reference book. It is not only extremely well written, but -up to now- in my opinion all problems are also well programmed. Nevertheless, several programs do not run with FTN95 (for instance the svd-algorithm or the broyden method). I would like to add that I have only recently bought the latest version and the programs that I have used should be up to date. Have you ever looked into the programs of Numerical Recipes? The authors claim that all programs have been extensively tested by several Fortran 95 compilers.

Best regards, Klaus

PS Merry Christmas and a Happy New Year to you, your family and your whole team!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
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