Use an array constructor to build an array of indices corresponding to your
data array and then use PACK to extract the indices where the array has the
properties you are interested in. E.g., to find the indices of the
non-zero elements of a 1-dimensional array, use something like
PACK( (/ (I,I=1,SIZE(A) /), A /= 0.0 )
-Kurt
At 02:24 PM 1/24/2002 +0000, Choru 'n Moru wrote:
>Hello,
>I am wondering if there is a way in F90 to get the indices of non-zero
>elements. For those familiar with MATLAB, there is function called find.
>For example, I = FIND(A>100), returns the indices of A where A is greater
>than 100. The caveat to this is that I'd like to do it without loops or
>IF-THEN_ELSE statements. I'd like to exploit F90's vector operations. Is
>this even possible in F90?
>
>In F90, the COUNT function can be used to give me the number of elements
>where the A>100 (e.g icount = COUNT(A>100)). The PACK function can be also
>be used to extract out elements according to the MASK.
>
>Can someone please give me some information on how this can be achieved?
>Does anyone know where such a function is in the offering for future
>versions of F90? Thanks very much for your help and hope to hear from you
>soon.
>
>Regards
>Ashish
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
--
Kurt W Hirchert [log in to unmask]
UIUC Department of Atmospheric Sciences +1-217-265-0327
|