Minimum of magnitudes |
| SAMIN/DAMIN/IAMIN/SCAMIN/DZAMIN |
Input | n | Number of elements of vector x to be used. If n ≤ 0, the |
|
| subprograms do not reference x. |
| x | Array of length lenx = (n−1)⋅incx+1 containing the |
|
| |
| incx | Increment for array x. x is stored forward in array x |
|
| with increment incx; that is, xi is stored in |
|
| x((i−1)⋅incx+1). |
|
| Use incx = 1 if the vector x is stored contiguously in |
|
| array x; that is, if xi is stored in x(i). Refer to “BLAS |
|
| Indexing Conventions” in the introduction to this |
|
| chapter. |
Output | s | If n ≤ 0, then s = ∞, the largest representable machine |
|
| number. Otherwise, s is the minimum of the |
|
| magnitudes of the elements of x. |
Fortran Equivalent
REAL*4 FUNCTION SAMIN (N,X,INCX) REAL*4 X(*)
SAMIN = ∞
INCXA = ABS ( INCX ) IX = 1
DO 10 I = 1, N
SAMIN = MIN ( SAMIN , ABS ( X(IX) ) )
IX = IX + INCXA
10CONTINUE RETURN END
Example Compute the minimum of the magnitudes of the elements of a REAL*8 vector x, where x is a vector 10 elements long stored in a
INTEGER*4 | N,INCX | |
REAL*8 | S,DAMIN,X(20) | |
N = | 10 |
|
INCX = 1 |
| |
S = | DAMIN (N,X,INCX) |
Chapter 2 Basic Vector Operations 61