~ubuntu-branches/ubuntu/oneiric/python-scipy/oneiric-proposed

« back to all changes in this revision

Viewing changes to scipy/sparse/linalg/dsolve/SuperLU/SRC/spivotL.c

  • Committer: Bazaar Package Importer
  • Author(s): Sameer Morar
  • Date: 2011-02-03 04:28:09 UTC
  • mfrom: (9.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110203042809-qs95kuod7723re62
Tags: 0.8.0+dfsg1-1ubuntu1
* Merge from debian experimental (LP: #696403). Remaining changes:
  - debian/patches/stdc_format_macros.patch: Fix FTBFS issue with python 2.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
 
/*
 
2
/*! @file spivotL.c
 
3
 * \brief Performs numerical pivoting
 
4
 *
 
5
 * <pre>
3
6
 * -- SuperLU routine (version 3.0) --
4
7
 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
5
8
 * and Lawrence Berkeley National Lab.
6
9
 * October 15, 2003
7
10
 *
 
11
 * Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
 
12
 *
 
13
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
 
14
 * EXPRESSED OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
 
15
 * 
 
16
 * Permission is hereby granted to use or copy this program for any
 
17
 * purpose, provided the above notices are retained on all copies.
 
18
 * Permission to modify the code and to distribute modified code is
 
19
 * granted, provided the above notices are retained, and a notice that
 
20
 * the code was modified is included with the above copyright notice.
 
21
 * </pre>
8
22
 */
9
 
/*
10
 
  Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
11
 
 
12
 
  THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
13
 
  EXPRESSED OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
14
 
 
15
 
  Permission is hereby granted to use or copy this program for any
16
 
  purpose, provided the above notices are retained on all copies.
17
 
  Permission to modify the code and to distribute modified code is
18
 
  granted, provided the above notices are retained, and a notice that
19
 
  the code was modified is included with the above copyright notice.
20
 
*/
 
23
 
21
24
 
22
25
#include <math.h>
23
26
#include <stdlib.h>
24
 
#include "ssp_defs.h"
 
27
#include "slu_sdefs.h"
25
28
 
26
29
#undef DEBUG
27
30
 
28
 
int
29
 
spivotL(
30
 
        const int  jcol,     /* in */
31
 
        const float u,      /* in - diagonal pivoting threshold */
32
 
        int        *usepr,   /* re-use the pivot sequence given by perm_r/iperm_r */
33
 
        int        *perm_r,  /* may be modified */
34
 
        int        *iperm_r, /* in - inverse of perm_r */
35
 
        int        *iperm_c, /* in - used to find diagonal of Pc*A*Pc' */
36
 
        int        *pivrow,  /* out */
37
 
        GlobalLU_t *Glu,     /* modified - global LU data structures */
38
 
        SuperLUStat_t *stat  /* output */
39
 
       )
40
 
{
41
 
/*
 
31
/*! \brief
 
32
 *
 
33
 * <pre>
42
34
 * Purpose
43
35
 * =======
44
36
 *   Performs the numerical pivoting on the current column of L,
57
49
 *
58
50
 *   Return value: 0      success;
59
51
 *                 i > 0  U(i,i) is exactly zero.
60
 
 *
 
52
 * </pre>
61
53
 */
 
54
 
 
55
int
 
56
spivotL(
 
57
        const int  jcol,     /* in */
 
58
        const double u,      /* in - diagonal pivoting threshold */
 
59
        int        *usepr,   /* re-use the pivot sequence given by perm_r/iperm_r */
 
60
        int        *perm_r,  /* may be modified */
 
61
        int        *iperm_r, /* in - inverse of perm_r */
 
62
        int        *iperm_c, /* in - used to find diagonal of Pc*A*Pc' */
 
63
        int        *pivrow,  /* out */
 
64
        GlobalLU_t *Glu,     /* modified - global LU data structures */
 
65
        SuperLUStat_t *stat  /* output */
 
66
       )
 
67
{
 
68
 
62
69
    int          fsupc;     /* first column in the supernode */
63
70
    int          nsupc;     /* no of columns in the supernode */
64
71
    int          nsupr;     /* no of rows in the supernode */
100
107
       Also search for user-specified pivot, and diagonal element. */
101
108
    if ( *usepr ) *pivrow = iperm_r[jcol];
102
109
    diagind = iperm_c[jcol];
 
110
#ifdef SCIPY_SPECIFIC_FIX
 
111
    pivmax = -1.0;
 
112
#else
103
113
    pivmax = 0.0;
 
114
#endif
104
115
    pivptr = nsupc;
105
116
    diag = EMPTY;
106
117
    old_pivptr = nsupc;
115
126
    }
116
127
 
117
128
    /* Test for singularity */
 
129
#ifdef SCIPY_SPECIFIC_FIX
 
130
    if (pivmax < 0.0) {
 
131
        perm_r[diagind] = jcol;
 
132
        *usepr = 0;
 
133
        return (jcol+1);
 
134
    }
 
135
#endif
118
136
    if ( pivmax == 0.0 ) {
 
137
#if 1
119
138
        *pivrow = lsub_ptr[pivptr];
120
139
        perm_r[*pivrow] = jcol;
 
140
#else
 
141
        perm_r[diagind] = jcol;
 
142
#endif
121
143
        *usepr = 0;
122
144
        return (jcol+1);
123
145
    }