|
Prev: branch prediction?
Next: I have a qustion about Lapack
From: foolcat on 10 Apr 2008 17:21 I want to use idmax and idmin which should be in blas library. But according to the mannual of blas, they belong to the extension of blas. When can I get this? Thanks!
From: AnotherSquid on 10 Apr 2008 21:27 On Apr 10, 3:21 pm, foolcat <xiaofengli...(a)gmail.com> wrote: > I want to use idmax and idmin which should be in blas library. But > according to the manual of blas, they belong to the extension of > blas. Where can I get this? I found this at http://www.netlib.org/toms/686 : INTEGER FUNCTION IDMAX(X,N) C C IDMAX DETERMINES THE INDEX OF AN ELEMENT OF VECTOR X(1:N) OF C LARGEST ABSOLUTE VALUE. IF THERE ARE SEVERAL SUCH ELEMENTS, THE C SMALLEST POSSIBLE INDEX IS RETURNED. C INTEGER I,N DOUBLE PRECISION X(N),TMP C C LOOP CONSIDERED RECURSIVE AND DOES NOT VECTORIZE. C IF(N.LE.0)RETURN IDMAX=1 IF(N.EQ.1)RETURN TMP=DABS(X(1)) DO 10 I=2,N IF(DABS(X(I)).LE.TMP)GOTO 10 IDMAX=I TMP=DABS(X(I)) 10 CONTINUE RETURN END Perhaps IDMIN simply changes ".LE." to ".GE." on the "GOTO 10" line? Good luck, Andy
From: Tim Prince on 10 Apr 2008 21:47 foolcat wrote: > I want to use idmax and idmin which should be in blas library. But > according to the mannual of blas, they belong to the extension of > blas. When can I get this? > Any reason to prefer this over maxloc(abs(..... ?
From: Gerry Ford on 10 Apr 2008 22:25 "Tim Prince" <tprince(a)nospamcomputer.org> wrote in message news:47FEC332.6020604(a)nospamcomputer.org... > foolcat wrote: >> I want to use idmax and idmin which should be in blas library. But >> according to the mannual of blas, they belong to the extension of >> blas. When can I get this? >> > Any reason to prefer this over maxloc(abs(..... ? > I was thinking the same, except using a mask. When my juxtaposition of precision and range put me into the standard last night, I ultimately focussed on minloc, which has the obvious similarity to maxloc. I'd been feeling guilty about impugning my current reference of lack of rigor, when it was I who had misapprehended. Maxloc is a little hard to find, as it doesn't have an entry in the index of 04-007.pdf : MAXLOC (ARRAY, DIM [, MASK, KIND]) or MAXLOC (ARRAY [, MASK, KIND]) In my reference, it's given as: FUNCTION MAXLOC(A) I'd always thought of masks in a c way before: ch|| 0100 or chopping off unwanted bits. Now that I know kind from a hole in the ground and read in my reference about masks (the standard is not the place to learn about it), I think maxloc is your standard solution. -- "That this social order with its pauperism, famines, prisons, gallows, armies, and wars is necessary to society; that still greater disaster would ensue if this organization were destroyed; all this is said only by those who profit by this organization, while those who suffer from it - and they are ten times as numerous - think and say quite the contrary." ~~ Leo Tolstoy
From: Ron Shepard on 11 Apr 2008 00:42
In article <62a9cd78-4260-4a8b-97bc-4079eda845dd(a)p25g2000hsf.googlegroups.com>, foolcat <xiaofengliu19(a)gmail.com> wrote: > I want to use idmax and idmin which should be in blas library. But > according to the mannual of blas, they belong to the extension of > blas. When can I get this? I think the "standard" BLAS routine for the index of maximum absolute value is idamax(). There is no corresponding min function. Standard f90 array operations can be used to replace these, but as with all of the BLAS routines, there are compromises and tradeoffs with efficiency and memory requirements that sometimes come into the picture. $.02 -Ron Shepard |