Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!mephisto!mcnc!thorin!sargent!cullip From: cullip@sargent.cs.unc.edu (Timothy Cullip) Newsgroups: comp.unix.cray Subject: Finding a maximum in an array Message-ID: <16327@thorin.cs.unc.edu> Date: 27 Sep 90 12:22:20 GMT Sender: news@thorin.cs.unc.edu Distribution: usa Lines: 19 Thanks for all who responded to my posting about searching for the maximum element in an array. It looks like ISMAX() from LIBSCI is a good choice for general use. The only problem I had was that it took me a minute to remember that FORTRAN uses arrays starting with index 1 and C uses index 0, but after accounting for that it worked. It turns out though for the type of data arrays I am searching (very long - up to a million elements, and having the maximum near the middle with lots of generally increasing and generally decreasing sections) my routine consistently beat ISMAX() by about 50%. Thanks again for all the responses (about 20), it's encouraging to know there are a lot of willing and knowledgable people out there. Like I said, I'm a Cray novice (I didn't even know about LIBSCI) - so I learned something. Tim Cullip