 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
| View previous topic :: View next topic |
| Author |
Message |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Fri Sep 09, 2011 9:51 pm Post subject: |
|
|
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 |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8283 Location: Salford, UK
|
Posted: Thu Mar 08, 2012 12:11 pm Post subject: |
|
|
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 |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Thu Mar 08, 2012 7:13 pm Post subject: |
|
|
Thank you for very much for fixing this.
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 |
|
 |
|
|
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
|