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

« back to all changes in this revision

Viewing changes to Lib/linsolve/SuperLU/SRC/csp_defs.h

  • 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
 
 
2
 
/*
3
 
 * -- SuperLU routine (version 3.0) --
4
 
 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
5
 
 * and Lawrence Berkeley National Lab.
6
 
 * October 15, 2003
7
 
 *
8
 
 */
9
 
#ifndef __SUPERLU_cSP_DEFS /* allow multiple inclusions */
10
 
#define __SUPERLU_cSP_DEFS
11
 
 
12
 
/*
13
 
 * File name:           csp_defs.h
14
 
 * Purpose:             Sparse matrix types and function prototypes
15
 
 * History:
16
 
 */
17
 
 
18
 
#ifdef _CRAY
19
 
#include <fortran.h>
20
 
#include <string.h>
21
 
#endif
22
 
 
23
 
/* Define my integer type int_t */
24
 
typedef int int_t; /* default */
25
 
 
26
 
#include "Cnames.h"
27
 
#include "supermatrix.h"
28
 
#include "util.h"
29
 
#include "scomplex.h"
30
 
 
31
 
 
32
 
/*
33
 
 * Global data structures used in LU factorization -
34
 
 * 
35
 
 *   nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
36
 
 *   (xsup,supno): supno[i] is the supernode no to which i belongs;
37
 
 *      xsup(s) points to the beginning of the s-th supernode.
38
 
 *      e.g.   supno 0 1 2 2 3 3 3 4 4 4 4 4   (n=12)
39
 
 *              xsup 0 1 2 4 7 12
40
 
 *      Note: dfs will be performed on supernode rep. relative to the new 
41
 
 *            row pivoting ordering
42
 
 *
43
 
 *   (xlsub,lsub): lsub[*] contains the compressed subscript of
44
 
 *      rectangular supernodes; xlsub[j] points to the starting
45
 
 *      location of the j-th column in lsub[*]. Note that xlsub 
46
 
 *      is indexed by column.
47
 
 *      Storage: original row subscripts
48
 
 *
49
 
 *      During the course of sparse LU factorization, we also use
50
 
 *      (xlsub,lsub) for the purpose of symmetric pruning. For each
51
 
 *      supernode {s,s+1,...,t=s+r} with first column s and last
52
 
 *      column t, the subscript set
53
 
 *              lsub[j], j=xlsub[s], .., xlsub[s+1]-1
54
 
 *      is the structure of column s (i.e. structure of this supernode).
55
 
 *      It is used for the storage of numerical values.
56
 
 *      Furthermore,
57
 
 *              lsub[j], j=xlsub[t], .., xlsub[t+1]-1
58
 
 *      is the structure of the last column t of this supernode.
59
 
 *      It is for the purpose of symmetric pruning. Therefore, the
60
 
 *      structural subscripts can be rearranged without making physical
61
 
 *      interchanges among the numerical values.
62
 
 *
63
 
 *      However, if the supernode has only one column, then we
64
 
 *      only keep one set of subscripts. For any subscript interchange
65
 
 *      performed, similar interchange must be done on the numerical
66
 
 *      values.
67
 
 *
68
 
 *      The last column structures (for pruning) will be removed
69
 
 *      after the numercial LU factorization phase.
70
 
 *
71
 
 *   (xlusup,lusup): lusup[*] contains the numerical values of the
72
 
 *      rectangular supernodes; xlusup[j] points to the starting
73
 
 *      location of the j-th column in storage vector lusup[*]
74
 
 *      Note: xlusup is indexed by column.
75
 
 *      Each rectangular supernode is stored by column-major
76
 
 *      scheme, consistent with Fortran 2-dim array storage.
77
 
 *
78
 
 *   (xusub,ucol,usub): ucol[*] stores the numerical values of
79
 
 *      U-columns outside the rectangular supernodes. The row
80
 
 *      subscript of nonzero ucol[k] is stored in usub[k].
81
 
 *      xusub[i] points to the starting location of column i in ucol.
82
 
 *      Storage: new row subscripts; that is subscripts of PA.
83
 
 */
84
 
typedef struct {
85
 
    int     *xsup;    /* supernode and column mapping */
86
 
    int     *supno;   
87
 
    int     *lsub;    /* compressed L subscripts */
88
 
    int     *xlsub;
89
 
    complex  *lusup;   /* L supernodes */
90
 
    int     *xlusup;
91
 
    complex  *ucol;    /* U columns */
92
 
    int     *usub;
93
 
    int     *xusub;
94
 
    int     nzlmax;   /* current max size of lsub */
95
 
    int     nzumax;   /*    "    "    "      ucol */
96
 
    int     nzlumax;  /*    "    "    "     lusup */
97
 
    int     n;        /* number of columns in the matrix */
98
 
    LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
99
 
} GlobalLU_t;
100
 
 
101
 
typedef struct {
102
 
    float for_lu;
103
 
    float total_needed;
104
 
    int   expansions;
105
 
} mem_usage_t;
106
 
 
107
 
#ifdef __cplusplus
108
 
extern "C" {
109
 
#endif
110
 
 
111
 
/* Driver routines */
112
 
extern void
113
 
cgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
114
 
      SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
115
 
extern void
116
 
cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
117
 
       char *, float *, float *, SuperMatrix *, SuperMatrix *,
118
 
       void *, int, SuperMatrix *, SuperMatrix *,
119
 
       float *, float *, float *, float *,
120
 
       mem_usage_t *, SuperLUStat_t *, int *);
121
 
 
122
 
/* Supernodal LU factor related */
123
 
extern void
124
 
cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, complex *,
125
 
                       int *, int *, Stype_t, Dtype_t, Mtype_t);
126
 
extern void
127
 
cCreate_CompRow_Matrix(SuperMatrix *, int, int, int, complex *,
128
 
                       int *, int *, Stype_t, Dtype_t, Mtype_t);
129
 
extern void
130
 
cCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
131
 
extern void
132
 
cCreate_Dense_Matrix(SuperMatrix *, int, int, complex *, int,
133
 
                     Stype_t, Dtype_t, Mtype_t);
134
 
extern void
135
 
cCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, complex *, 
136
 
                         int *, int *, int *, int *, int *,
137
 
                         Stype_t, Dtype_t, Mtype_t);
138
 
extern void
139
 
cCopy_Dense_Matrix(int, int, complex *, int, complex *, int);
140
 
 
141
 
extern void    countnz (const int, int *, int *, int *, GlobalLU_t *);
142
 
extern void    fixupL (const int, const int *, GlobalLU_t *);
143
 
 
144
 
extern void    callocateA (int, int, complex **, int **, int **);
145
 
extern void    cgstrf (superlu_options_t*, SuperMatrix*, float, 
146
 
                       int, int, int*, void *, int, int *, int *, 
147
 
                       SuperMatrix *, SuperMatrix *, SuperLUStat_t*, int *);
148
 
extern int     csnode_dfs (const int, const int, const int *, const int *,
149
 
                             const int *, int *, int *, GlobalLU_t *);
150
 
extern int     csnode_bmod (const int, const int, const int, complex *,
151
 
                              complex *, GlobalLU_t *, SuperLUStat_t*);
152
 
extern void    cpanel_dfs (const int, const int, const int, SuperMatrix *,
153
 
                           int *, int *, complex *, int *, int *, int *,
154
 
                           int *, int *, int *, int *, GlobalLU_t *);
155
 
extern void    cpanel_bmod (const int, const int, const int, const int,
156
 
                           complex *, complex *, int *, int *,
157
 
                           GlobalLU_t *, SuperLUStat_t*);
158
 
extern int     ccolumn_dfs (const int, const int, int *, int *, int *, int *,
159
 
                           int *, int *, int *, int *, int *, GlobalLU_t *);
160
 
extern int     ccolumn_bmod (const int, const int, complex *,
161
 
                           complex *, int *, int *, int,
162
 
                           GlobalLU_t *, SuperLUStat_t*);
163
 
extern int     ccopy_to_ucol (int, int, int *, int *, int *,
164
 
                              complex *, GlobalLU_t *);         
165
 
extern int     cpivotL (const int, const float, int *, int *, 
166
 
                         int *, int *, int *, GlobalLU_t *, SuperLUStat_t*);
167
 
extern void    cpruneL (const int, const int *, const int, const int,
168
 
                          const int *, const int *, int *, GlobalLU_t *);
169
 
extern void    creadmt (int *, int *, int *, complex **, int **, int **);
170
 
extern void    cGenXtrue (int, int, complex *, int);
171
 
extern void    cFillRHS (trans_t, int, complex *, int, SuperMatrix *,
172
 
                          SuperMatrix *);
173
 
extern void    cgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
174
 
                        SuperMatrix *, SuperLUStat_t*, int *);
175
 
 
176
 
 
177
 
/* Driver related */
178
 
 
179
 
extern void    cgsequ (SuperMatrix *, float *, float *, float *,
180
 
                        float *, float *, int *);
181
 
extern void    claqgs (SuperMatrix *, float *, float *, float,
182
 
                        float, float, char *);
183
 
extern void    cgscon (char *, SuperMatrix *, SuperMatrix *, 
184
 
                         float, float *, SuperLUStat_t*, int *);
185
 
extern float   cPivotGrowth(int, SuperMatrix *, int *, 
186
 
                            SuperMatrix *, SuperMatrix *);
187
 
extern void    cgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
188
 
                       SuperMatrix *, int *, int *, char *, float *, 
189
 
                       float *, SuperMatrix *, SuperMatrix *,
190
 
                       float *, float *, SuperLUStat_t*, int *);
191
 
 
192
 
extern int     sp_ctrsv (char *, char *, char *, SuperMatrix *,
193
 
                        SuperMatrix *, complex *, SuperLUStat_t*, int *);
194
 
extern int     sp_cgemv (char *, complex, SuperMatrix *, complex *,
195
 
                        int, complex, complex *, int);
196
 
 
197
 
extern int     sp_cgemm (char *, char *, int, int, int, complex,
198
 
                        SuperMatrix *, complex *, int, complex, 
199
 
                        complex *, int);
200
 
 
201
 
/* Memory-related */
202
 
extern int     cLUMemInit (fact_t, void *, int, int, int, int, int,
203
 
                             SuperMatrix *, SuperMatrix *,
204
 
                             GlobalLU_t *, int **, complex **);
205
 
extern void    cSetRWork (int, int, complex *, complex **, complex **);
206
 
extern void    cLUWorkFree (int *, complex *, GlobalLU_t *);
207
 
extern int     cLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
208
 
 
209
 
extern complex  *complexMalloc(int);
210
 
extern complex  *complexCalloc(int);
211
 
extern float  *floatMalloc(int);
212
 
extern float  *floatCalloc(int);
213
 
extern int     cmemory_usage(const int, const int, const int, const int);
214
 
extern int     cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
215
 
 
216
 
/* Auxiliary routines */
217
 
extern void    creadhb(int *, int *, int *, complex **, int **, int **);
218
 
extern void    cCompRow_to_CompCol(int, int, int, complex*, int*, int*,
219
 
                                   complex **, int **, int **);
220
 
extern void    cfill (complex *, int, complex);
221
 
extern void    cinf_norm_error (int, SuperMatrix *, complex *);
222
 
extern void    PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
223
 
                         complex, complex, complex *, complex *, char *);
224
 
 
225
 
/* Routines for debugging */
226
 
extern void    cPrint_CompCol_Matrix(char *, SuperMatrix *);
227
 
extern void    cPrint_SuperNode_Matrix(char *, SuperMatrix *);
228
 
extern void    cPrint_Dense_Matrix(char *, SuperMatrix *);
229
 
extern void    print_lu_col(char *, int, int, int *, GlobalLU_t *);
230
 
extern void    check_tempv(int, complex *);
231
 
 
232
 
#ifdef __cplusplus
233
 
  }
234
 
#endif
235
 
 
236
 
#endif /* __SUPERLU_cSP_DEFS */
237