replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Fortran 2003 and 2008 features
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 

Fortran 2003 and 2008 features
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


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

PostPosted: Thu Jun 02, 2022 6:48 am    Post subject: Reply with quote

Simon

I will add Example 1 to the wish list and Example 2 demonstrates an omission that needs fixing.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Thu Jun 02, 2022 11:53 am    Post subject: Reply with quote

Dan

Thanks for the feedback. We will explore the possibility of adding to the wiki.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Sat Jun 11, 2022 3:32 pm    Post subject: Reply with quote

Sorry to add more to the wish-list - it would be nice to get the 2008 intrinsic functions FindLoc, MaxLoc and MinLoc added.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jun 13, 2022 7:20 am    Post subject: Reply with quote

Simon

MAXLOC and MINLOC are in the Fortran 90/95 standard (unless you need the extra KIND or BACK arguments) so they are already provided.

I could add FINDLOC to the wish list but it will be of limited use for real arrays where a test for equality usually needs a tollerance value.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Tue Jun 14, 2022 4:20 pm    Post subject: Reply with quote

Thanks Paul - I was only interested in FindLoc for integer arrays. I'd forgotten that MaxLoc and MinLoc were already available - sorry, but that's at least something less for you to do!
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Jun 15, 2022 7:15 am    Post subject: Reply with quote

Simon

For a quick work-around you could use MINLOC. For example, for a 1D array

Code:
integer a(10),b(1),val
...
b = MINLOC(a, abs(a-val) == 0)


At first sight it looks like FINDLOC could be defined in terms of MINLOC but with the extra mask abs(a-val) == 0.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Thu Jun 16, 2022 9:11 pm    Post subject: Reply with quote

Hi Paul,
That's a nice work around for now. But I'm curious as to why the following code does not allow line 8 (the second instance of MinLoc), but does allow line 7 (the first instance).
Code:
Program p
   Integer, Parameter :: n1 = 5
   Integer, Dimension(n1) :: ia1 = [2,4,3,5,1]
   Integer, Dimension(n1) :: ia2
   Integer :: i = 5
   Integer :: j
   j      = MinLoc(ia1(:), (Abs(ia1(:)-i) == 0))
   ia2(1) = MinLoc(ia1(:), (Abs(ia1(:)-i) == 0))
End Program p
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jun 17, 2022 7:03 am    Post subject: Reply with quote

Simon

The Standard defines the result as being a vector (in this context) so the compiler should complain when you assign a vector to a scalar.

Note also that, in general, (:) is not helpful because FTN95 does not always distinguish this from an array section which generates in a temporary copy.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Tue Jun 21, 2022 4:27 pm    Post subject: Reply with quote

Hi Paul,
Since j is a scalar, should not the compiler complain at line 7?
Simon
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Jun 21, 2022 5:51 pm    Post subject: Reply with quote

Simon

Yes. I may need to take a closer look at this.

Is it important? Can you get it to work?
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Tue Jun 21, 2022 5:58 pm    Post subject: Reply with quote

Hi Paul,
Not important. I have worked around this. In this case I'm simply working from the attitude that all bug reports may be potentially useful.
Thanks,
Simon
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jul 08, 2022 8:39 am    Post subject: Reply with quote

FINDLOC has now been added to FTN95 and the associated DLLs but without the KIND and BACK arguments at the momnent.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Fri Jul 08, 2022 1:47 pm    Post subject: Reply with quote

Excellent! Thank you.
On another 2008 topic, are there any plans for submodules? Again not urgent from my side. I would simply use them to break up some large files, so their absence is not a big issue.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jul 08, 2022 3:29 pm    Post subject: Reply with quote

Simon

The subject of SUBMODULEs has been raised recently elsewhere on this forum and I did briefly look at its definition.

A SUBMODULE is not a simple extension of the concept of a MODULE. Also a MODULE is already extremely complex from point of view of the compiler. You can have modules within modules and at each level components can be private to the module. Then there is the complexity of USE ONLY.

So my initial impression is that to add SUBMODULEs would involve a very large investment of time.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Fri Jul 08, 2022 9:47 pm    Post subject: Reply with quote

Understood. I can certainly manage without submodules high on the priority list fo rnow.
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 -> Suggestions All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 4 of 10

 
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