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 

Bug with maxloc, minloc
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
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Fri Sep 09, 2011 9:51 pm    Post subject: Reply with quote

One further point of interest, the values returned always assume a starting index of 1 so the following code should print 2 (not 4).

Code:

a = (/ 1.0, 2.0, 1.0, 5.0, 4.0, 2.0 /)
print *, maxloc(a(3:),1) !< should print 2

_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 08, 2012 12:11 pm    Post subject: Reply with quote

The original bug in this thread has now been fixed for the next release.

The code immediately above now gives the expected result.
I don't know if this was intended as a bug report but if it was a problem then it has got fixed along the way.
Back to top
View user's profile Send private message AIM Address
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Thu Mar 08, 2012 7:13 pm    Post subject: Reply with quote

Thank you for very much for fixing this. Smile

The code immediately above wasn't a bug report, just an observation that the maxloc function assumes that arrays start at 1 and doesn't account for the actual lower bound when taking an array section. In my original application (the "quick select" algorithm using indices to an array) I need to take this fact into account when calculating the index into the array using maxloc.

Best Regards,
David.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
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 -> 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