I have a question about the minloc() and maxloc() functions.
I'm using the minloc() function to locate the position of the minimum
value in a rank 1 array, subsectioned from a 3D array like this:
real :: field(10,10,10)
integer :: locm(1)
locm = minloc( field(:,1,1) )
field(locm(1)) = 0.0
My question is why do I have to declare locm as a rank 1 array? In
this example only one value is going to be returned and yet the
standard and the compiler insist locm must be rank 1. I see no
difference in declaring locm as a scalar integer since both
declarations occupy one storage location.
My code works fine and this is nothing more than a curiousity.
Glenn
--
Dr. Glenn Carver, Centre for Atmospheric Science, Univ. of Cambridge,
Chemistry Dept., Lensfield Road, Cambridge, CB2 1EW, UK.
mailto:[log in to unmask] http://www.atm.ch.cam.ac.uk/~glenn/
Phone: +44 (1223) 763827
Fax: +44 (1223) 763823
|