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

« back to all changes in this revision

Viewing changes to Lib/sparse/SuperLU/SRC/dsp_defs.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-07 14:12:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070107141212-mm0ebkh5b37hcpzn
* Remove build dependency on python-numpy-dev.
* python-scipy: Depend on python-numpy instead of python-numpy-dev.
* Package builds on other archs than i386. Closes: #402783.

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_dSP_DEFS /* allow multiple inclusions */
10
 
#define __SUPERLU_dSP_DEFS
11
 
 
12
 
/*
13
 
 * File name:           dsp_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
 
 
30
 
 
31
 
/*
32
 
 * Global data structures used in LU factorization -
33
 
 * 
34
 
 *   nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
35
 
 *   (xsup,supno): supno[i] is the supernode no to which i belongs;
36
 
 *      xsup(s) points to the beginning of the s-th supernode.
37
 
 *      e.g.   supno 0 1 2 2 3 3 3 4 4 4 4 4   (n=12)
38
 
 *              xsup 0 1 2 4 7 12
39
 
 *      Note: dfs will be performed on supernode rep. relative to the new 
40
 
 *            row pivoting ordering
41
 
 *
42
 
 *   (xlsub,lsub): lsub[*] contains the compressed subscript of
43
 
 *      rectangular supernodes; xlsub[j] points to the starting
44
 
 *      location of the j-th column in lsub[*]. Note that xlsub 
45
 
 *      is indexed by column.
46
 
 *      Storage: original row subscripts
47
 
 *
48
 
 *      During the course of sparse LU factorization, we also use
49
 
 *      (xlsub,lsub) for the purpose of symmetric pruning. For each
50
 
 *      supernode {s,s+1,...,t=s+r} with first column s and last
51
 
 *      column t, the subscript set
52
 
 *              lsub[j], j=xlsub[s], .., xlsub[s+1]-1
53
 
 *      is the structure of column s (i.e. structure of this supernode).
54
 
 *      It is used for the storage of numerical values.
55
 
 *      Furthermore,
56
 
 *              lsub[j], j=xlsub[t], .., xlsub[t+1]-1
57
 
 *      is the structure of the last column t of this supernode.
58
 
 *      It is for the purpose of symmetric pruning. Therefore, the
59
 
 *      structural subscripts can be rearranged without making physical
60
 
 *      interchanges among the numerical values.
61
 
 *
62
 
 *      However, if the supernode has only one column, then we
63
 
 *      only keep one set of subscripts. For any subscript interchange
64
 
 *      performed, similar interchange must be done on the numerical
65
 
 *      values.
66
 
 *
67
 
 *      The last column structures (for pruning) will be removed
68
 
 *      after the numercial LU factorization phase.
69
 
 *
70
 
 *   (xlusup,lusup): lusup[*] contains the numerical values of the
71
 
 *      rectangular supernodes; xlusup[j] points to the starting
72
 
 *      location of the j-th column in storage vector lusup[*]
73
 
 *      Note: xlusup is indexed by column.
74
 
 *      Each rectangular supernode is stored by column-major
75
 
 *      scheme, consistent with Fortran 2-dim array storage.
76
 
 *
77
 
 *   (xusub,ucol,usub): ucol[*] stores the numerical values of
78
 
 *      U-columns outside the rectangular supernodes. The row
79
 
 *      subscript of nonzero ucol[k] is stored in usub[k].
80
 
 *      xusub[i] points to the starting location of column i in ucol.
81
 
 *      Storage: new row subscripts; that is subscripts of PA.
82
 
 */
83
 
typedef struct {
84
 
    int     *xsup;    /* supernode and column mapping */
85
 
    int     *supno;   
86
 
    int     *lsub;    /* compressed L subscripts */
87
 
    int     *xlsub;
88
 
    double  *lusup;   /* L supernodes */
89
 
    int     *xlusup;
90
 
    double  *ucol;    /* U columns */
91
 
    int     *usub;
92
 
    int     *xusub;
93
 
    int     nzlmax;   /* current max size of lsub */
94
 
    int     nzumax;   /*    "    "    "      ucol */
95
 
    int     nzlumax;  /*    "    "    "     lusup */
96
 
    int     n;        /* number of columns in the matrix */
97
 
    LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
98
 
} GlobalLU_t;
99
 
 
100
 
typedef struct {
101
 
    float for_lu;
102
 
    float total_needed;
103
 
    int   expansions;
104
 
} mem_usage_t;
105
 
 
106
 
#ifdef __cplusplus
107
 
extern "C" {
108
 
#endif
109
 
 
110
 
/* Driver routines */
111
 
extern void
112
 
dgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
113
 
      SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
114
 
extern void
115
 
dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
116
 
       char *, double *, double *, SuperMatrix *, SuperMatrix *,
117
 
       void *, int, SuperMatrix *, SuperMatrix *,
118
 
       double *, double *, double *, double *,
119
 
       mem_usage_t *, SuperLUStat_t *, int *);
120
 
 
121
 
/* Supernodal LU factor related */
122
 
extern void
123
 
dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
124
 
                       int *, int *, Stype_t, Dtype_t, Mtype_t);
125
 
extern void
126
 
dCreate_CompRow_Matrix(SuperMatrix *, int, int, int, double *,
127
 
                       int *, int *, Stype_t, Dtype_t, Mtype_t);
128
 
extern void
129
 
dCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
130
 
extern void
131
 
dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
132
 
                     Stype_t, Dtype_t, Mtype_t);
133
 
extern void
134
 
dCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, double *, 
135
 
                         int *, int *, int *, int *, int *,
136
 
                         Stype_t, Dtype_t, Mtype_t);
137
 
extern void
138
 
dCopy_Dense_Matrix(int, int, double *, int, double *, int);
139
 
 
140
 
extern void    countnz (const int, int *, int *, int *, GlobalLU_t *);
141
 
extern void    fixupL (const int, const int *, GlobalLU_t *);
142
 
 
143
 
extern void    dallocateA (int, int, double **, int **, int **);
144
 
extern void    dgstrf (superlu_options_t*, SuperMatrix*, double, 
145
 
                       int, int, int*, void *, int, int *, int *, 
146
 
                       SuperMatrix *, SuperMatrix *, SuperLUStat_t*, int *);
147
 
extern int     dsnode_dfs (const int, const int, const int *, const int *,
148
 
                             const int *, int *, int *, GlobalLU_t *);
149
 
extern int     dsnode_bmod (const int, const int, const int, double *,
150
 
                              double *, GlobalLU_t *, SuperLUStat_t*);
151
 
extern void    dpanel_dfs (const int, const int, const int, SuperMatrix *,
152
 
                           int *, int *, double *, int *, int *, int *,
153
 
                           int *, int *, int *, int *, GlobalLU_t *);
154
 
extern void    dpanel_bmod (const int, const int, const int, const int,
155
 
                           double *, double *, int *, int *,
156
 
                           GlobalLU_t *, SuperLUStat_t*);
157
 
extern int     dcolumn_dfs (const int, const int, int *, int *, int *, int *,
158
 
                           int *, int *, int *, int *, int *, GlobalLU_t *);
159
 
extern int     dcolumn_bmod (const int, const int, double *,
160
 
                           double *, int *, int *, int,
161
 
                           GlobalLU_t *, SuperLUStat_t*);
162
 
extern int     dcopy_to_ucol (int, int, int *, int *, int *,
163
 
                              double *, GlobalLU_t *);         
164
 
extern int     dpivotL (const int, const double, int *, int *, 
165
 
                         int *, int *, int *, GlobalLU_t *, SuperLUStat_t*);
166
 
extern void    dpruneL (const int, const int *, const int, const int,
167
 
                          const int *, const int *, int *, GlobalLU_t *);
168
 
extern void    dreadmt (int *, int *, int *, double **, int **, int **);
169
 
extern void    dGenXtrue (int, int, double *, int);
170
 
extern void    dFillRHS (trans_t, int, double *, int, SuperMatrix *,
171
 
                          SuperMatrix *);
172
 
extern void    dgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
173
 
                        SuperMatrix *, SuperLUStat_t*, int *);
174
 
 
175
 
 
176
 
/* Driver related */
177
 
 
178
 
extern void    dgsequ (SuperMatrix *, double *, double *, double *,
179
 
                        double *, double *, int *);
180
 
extern void    dlaqgs (SuperMatrix *, double *, double *, double,
181
 
                        double, double, char *);
182
 
extern void    dgscon (char *, SuperMatrix *, SuperMatrix *, 
183
 
                         double, double *, SuperLUStat_t*, int *);
184
 
extern double   dPivotGrowth(int, SuperMatrix *, int *, 
185
 
                            SuperMatrix *, SuperMatrix *);
186
 
extern void    dgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
187
 
                       SuperMatrix *, int *, int *, char *, double *, 
188
 
                       double *, SuperMatrix *, SuperMatrix *,
189
 
                       double *, double *, SuperLUStat_t*, int *);
190
 
 
191
 
extern int     sp_dtrsv (char *, char *, char *, SuperMatrix *,
192
 
                        SuperMatrix *, double *, SuperLUStat_t*, int *);
193
 
extern int     sp_dgemv (char *, double, SuperMatrix *, double *,
194
 
                        int, double, double *, int);
195
 
 
196
 
extern int     sp_dgemm (char *, char *, int, int, int, double,
197
 
                        SuperMatrix *, double *, int, double, 
198
 
                        double *, int);
199
 
 
200
 
/* Memory-related */
201
 
extern int     dLUMemInit (fact_t, void *, int, int, int, int, int,
202
 
                             SuperMatrix *, SuperMatrix *,
203
 
                             GlobalLU_t *, int **, double **);
204
 
extern void    dSetRWork (int, int, double *, double **, double **);
205
 
extern void    dLUWorkFree (int *, double *, GlobalLU_t *);
206
 
extern int     dLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
207
 
 
208
 
extern double  *doubleMalloc(int);
209
 
extern double  *doubleCalloc(int);
210
 
extern int     dmemory_usage(const int, const int, const int, const int);
211
 
extern int     dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
212
 
 
213
 
/* Auxiliary routines */
214
 
extern void    dreadhb(int *, int *, int *, double **, int **, int **);
215
 
extern void    dCompRow_to_CompCol(int, int, int, double*, int*, int*,
216
 
                                   double **, int **, int **);
217
 
extern void    dfill (double *, int, double);
218
 
extern void    dinf_norm_error (int, SuperMatrix *, double *);
219
 
extern void    PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
220
 
                         double, double, double *, double *, char *);
221
 
 
222
 
/* Routines for debugging */
223
 
extern void    dPrint_CompCol_Matrix(char *, SuperMatrix *);
224
 
extern void    dPrint_SuperNode_Matrix(char *, SuperMatrix *);
225
 
extern void    dPrint_Dense_Matrix(char *, SuperMatrix *);
226
 
extern void    print_lu_col(char *, int, int, int *, GlobalLU_t *);
227
 
extern void    check_tempv(int, double *);
228
 
 
229
 
#ifdef __cplusplus
230
 
  }
231
 
#endif
232
 
 
233
 
#endif /* __SUPERLU_dSP_DEFS */
234