~ubuntu-branches/ubuntu/saucy/python-scipy/saucy

« back to all changes in this revision

Viewing changes to scipy/linsolve/SuperLU/SRC/izmax1.c

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "dcomplex.h"
 
2
 
 
3
int
 
4
izmax1_(int *n, doublecomplex *cx, int *incx)
 
5
{
 
6
/*  -- LAPACK auxiliary routine (version 2.0) --   
 
7
       Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,   
 
8
       Courant Institute, Argonne National Lab, and Rice University   
 
9
       September 30, 1994   
 
10
 
 
11
 
 
12
    Purpose   
 
13
    =======   
 
14
 
 
15
    IZMAX1 finds the index of the element whose real part has maximum   
 
16
    absolute value.   
 
17
 
 
18
    Based on IZAMAX from Level 1 BLAS.   
 
19
    The change is to use the 'genuine' absolute value.   
 
20
 
 
21
    Contributed by Nick Higham for use with ZLACON.   
 
22
 
 
23
    Arguments   
 
24
    =========   
 
25
 
 
26
    N       (input) INT   
 
27
            The number of elements in the vector CX.   
 
28
 
 
29
    CX      (input) COMPLEX*16 array, dimension (N)   
 
30
            The vector whose elements will be summed.   
 
31
 
 
32
    INCX    (input) INT   
 
33
            The spacing between successive values of CX.  INCX >= 1.   
 
34
 
 
35
   ===================================================================== 
 
36
*/  
 
37
 
 
38
    /* System generated locals */
 
39
    int ret_val, i__1, i__2;
 
40
    double d__1;
 
41
    
 
42
    /* Local variables */
 
43
    double smax;
 
44
    int i, ix;
 
45
 
 
46
#define CX(I) cx[(I)-1]
 
47
 
 
48
    ret_val = 0;
 
49
    if (*n < 1) {
 
50
        return ret_val;
 
51
    }
 
52
    ret_val = 1;
 
53
    if (*n == 1) {
 
54
        return ret_val;
 
55
    }
 
56
    if (*incx == 1) {
 
57
        goto L30;
 
58
    }
 
59
 
 
60
/*     CODE FOR INCREMENT NOT EQUAL TO 1 */
 
61
 
 
62
    ix = 1;
 
63
    smax = (d__1 = CX(1).r, abs(d__1));
 
64
    ix += *incx;
 
65
    i__1 = *n;
 
66
    for (i = 2; i <= *n; ++i) {
 
67
        i__2 = ix;
 
68
        if ((d__1 = CX(ix).r, abs(d__1)) <= smax) {
 
69
            goto L10;
 
70
        }
 
71
        ret_val = i;
 
72
        i__2 = ix;
 
73
        smax = (d__1 = CX(ix).r, abs(d__1));
 
74
L10:
 
75
        ix += *incx;
 
76
/* L20: */
 
77
    }
 
78
    return ret_val;
 
79
 
 
80
/*     CODE FOR INCREMENT EQUAL TO 1 */
 
81
 
 
82
L30:
 
83
    smax = (d__1 = CX(1).r, abs(d__1));
 
84
    i__1 = *n;
 
85
    for (i = 2; i <= *n; ++i) {
 
86
        i__2 = i;
 
87
        if ((d__1 = CX(i).r, abs(d__1)) <= smax) {
 
88
            goto L40;
 
89
        }
 
90
        ret_val = i;
 
91
        i__2 = i;
 
92
        smax = (d__1 = CX(i).r, abs(d__1));
 
93
L40:
 
94
        ;
 
95
    }
 
96
    return ret_val;
 
97
 
 
98
/*     End of IZMAX1 */
 
99
 
 
100
} /* izmax1_ */
 
101