PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

maxloc, minloc, and ... "loc"?

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
cablesb



Joined: 21 Jan 2010
Posts: 33

PostPosted: Wed Mar 21, 2012 9:08 am    Post subject: maxloc, minloc, and ... "loc"? Reply with quote

This is a general FORTRAN90 question, not particular to PGI. Hope that's OK.

The routine maxloc(array,mask) will return the index of the maximum of the elements in "array" that fulfill the condition "mask". minloc() returns the location of the minimum. It therefore occurs to me that there could be some kind of routine "loc" that returns *all* the locations in "array" that satisfy "mask". Such a routine would certainly be useful for me. But I can't find a discussion of such a thing anywhere. (I know about the "where" construct. It's not going to do what I need. I actually need a list of indices where "mask" is fulfilled.) Does anyone know of such a thing? If there isn't one, does anyone know why not? It seems to me that once we have maxloc and minloc, a "loc" routine would be a simple extension. Thanks.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6125
Location: The Portland Group Inc.

PostPosted: Thu Mar 22, 2012 10:56 am    Post subject: Reply with quote

Hi cablesb,

I can't think of any intrinsic to do this, but it seems simple enough that you could write your own loop to perform the task.

Note that there is a non-standard "%LOC()" intrinsic, but this returns the address of a variable.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
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 © phpBB Group