I think a simpler and more general solution is MINLOC(MERGE(1,0,array)).
Date: Thu, 14 May 1998 07:41:54 -0400
Subject: Re: Extension of {MIN,MAX}{LOC,VAL} to LOGICAL arrays?
From: [log in to unmask] (William F Mitchell)
To: [log in to unmask], [log in to unmask]
X-List: [log in to unmask]
X-Unsub: To leave, send text 'leave comp-fortran-90' to
[log in to unmask]
X-List-Unsubscribe:
<mailto:[log in to unmask]>
> I wonder if this suggestion has come up before. I just had
> the need to find the index of the first .FALSE. in a logical array.
> It would have been great to have been able to use MINLOC(array)
> for this.
>
> What do people think?
>
> * Peter S. Shenkin; Chemistry, Columbia U.; 3000 Broadway, Mail Code
3153 *
Would the following be equivalent (for a rank 1 array, similar
expressions
for larger rank)?
MINLOC( (/ (1,i=1,SIZE(array)) /), .NOT. array )
-- Bill
William F. Mitchell |
[log in to unmask]
Mathematical and Computational Sciences Division |
[log in to unmask]
National Institute of Standards and Technology | Voice: (301) 975-3808
Gaithersburg, MD 20899 | Fax: (301) 990-4127
http://math.nist.gov/~mitchell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|