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

« back to all changes in this revision

Viewing changes to Lib/sandbox/pysparse/superlu/dzsum1.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
 
double dzsum1_(int *n, doublecomplex *cx, int *incx)
4
 
{
5
 
/*  -- LAPACK auxiliary routine (version 2.0) --   
6
 
       Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,   
7
 
       Courant Institute, Argonne National Lab, and Rice University   
8
 
       October 31, 1992   
9
 
 
10
 
    Purpose   
11
 
    =======   
12
 
 
13
 
    DZSUM1 takes the sum of the absolute values of a complex   
14
 
    vector and returns a double precision result.   
15
 
 
16
 
    Based on DZASUM from the Level 1 BLAS.   
17
 
    The change is to use the 'genuine' absolute value.   
18
 
 
19
 
    Contributed by Nick Higham for use with ZLACON.   
20
 
 
21
 
    Arguments   
22
 
    =========   
23
 
 
24
 
    N       (input) INT   
25
 
            The number of elements in the vector CX.   
26
 
 
27
 
    CX      (input) COMPLEX*16 array, dimension (N)   
28
 
            The vector whose elements will be summed.   
29
 
 
30
 
    INCX    (input) INT   
31
 
            The spacing between successive values of CX.  INCX > 0.   
32
 
 
33
 
    ===================================================================== 
34
 
*/  
35
 
 
36
 
    /* Builtin functions */
37
 
    double z_abs(doublecomplex *);
38
 
    
39
 
    /* Local variables */
40
 
    int i, nincx;
41
 
    double stemp;
42
 
 
43
 
 
44
 
#define CX(I) cx[(I)-1]
45
 
 
46
 
    stemp = 0.;
47
 
    if (*n <= 0) {
48
 
        return stemp;
49
 
    }
50
 
    if (*incx == 1) {
51
 
        goto L20;
52
 
    }
53
 
 
54
 
    /*     CODE FOR INCREMENT NOT EQUAL TO 1 */
55
 
 
56
 
    nincx = *n * *incx;
57
 
    for (i = 1; *incx < 0 ? i >= nincx : i <= nincx; i += *incx) {
58
 
 
59
 
        /*        NEXT LINE MODIFIED. */
60
 
 
61
 
        stemp += z_abs(&CX(i));
62
 
/* L10: */
63
 
    }
64
 
    
65
 
    return stemp;
66
 
 
67
 
    /*     CODE FOR INCREMENT EQUAL TO 1 */
68
 
 
69
 
L20:
70
 
    for (i = 1; i <= *n; ++i) {
71
 
 
72
 
        /*        NEXT LINE MODIFIED. */
73
 
 
74
 
        stemp += z_abs(&CX(i));
75
 
/* L30: */
76
 
    }
77
 
    
78
 
    return stemp;
79
 
 
80
 
    /*     End of DZSUM1 */
81
 
 
82
 
} /* dzsum1_ */
83