~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T. Chen (new)
  • Date: 2005-03-16 02:15:29 UTC
  • Revision ID: james.westby@ubuntu.com-20050316021529-xrjlowsejs0cijig
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

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_zSP_DEFS /* allow multiple inclusions */
 
10
#define __SUPERLU_zSP_DEFS
 
11
 
 
12
/*
 
13
 * File name:           zsp_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 "dcomplex.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
    doublecomplex  *lusup;   /* L supernodes */
 
90
    int     *xlusup;
 
91
    doublecomplex  *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
zgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
 
114
      SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
 
115
extern void
 
116
zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
 
117
       char *, double *, double *, SuperMatrix *, SuperMatrix *,
 
118
       void *, int, SuperMatrix *, SuperMatrix *,
 
119
       double *, double *, double *, double *,
 
120
       mem_usage_t *, SuperLUStat_t *, int *);
 
121
 
 
122
/* Supernodal LU factor related */
 
123
extern void
 
124
zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
 
125
                       int *, int *, Stype_t, Dtype_t, Mtype_t);
 
126
extern void
 
127
zCreate_CompRow_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
 
128
                       int *, int *, Stype_t, Dtype_t, Mtype_t);
 
129
extern void
 
130
zCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
 
131
extern void
 
132
zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int,
 
133
                     Stype_t, Dtype_t, Mtype_t);
 
134
extern void
 
135
zCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, doublecomplex *, 
 
136
                         int *, int *, int *, int *, int *,
 
137
                         Stype_t, Dtype_t, Mtype_t);
 
138
extern void
 
139
zCopy_Dense_Matrix(int, int, doublecomplex *, int, doublecomplex *, 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    zallocateA (int, int, doublecomplex **, int **, int **);
 
145
extern void    zgstrf (superlu_options_t*, SuperMatrix*, double, 
 
146
                       int, int, int*, void *, int, int *, int *, 
 
147
                       SuperMatrix *, SuperMatrix *, SuperLUStat_t*, int *);
 
148
extern int     zsnode_dfs (const int, const int, const int *, const int *,
 
149
                             const int *, int *, int *, GlobalLU_t *);
 
150
extern int     zsnode_bmod (const int, const int, const int, doublecomplex *,
 
151
                              doublecomplex *, GlobalLU_t *, SuperLUStat_t*);
 
152
extern void    zpanel_dfs (const int, const int, const int, SuperMatrix *,
 
153
                           int *, int *, doublecomplex *, int *, int *, int *,
 
154
                           int *, int *, int *, int *, GlobalLU_t *);
 
155
extern void    zpanel_bmod (const int, const int, const int, const int,
 
156
                           doublecomplex *, doublecomplex *, int *, int *,
 
157
                           GlobalLU_t *, SuperLUStat_t*);
 
158
extern int     zcolumn_dfs (const int, const int, int *, int *, int *, int *,
 
159
                           int *, int *, int *, int *, int *, GlobalLU_t *);
 
160
extern int     zcolumn_bmod (const int, const int, doublecomplex *,
 
161
                           doublecomplex *, int *, int *, int,
 
162
                           GlobalLU_t *, SuperLUStat_t*);
 
163
extern int     zcopy_to_ucol (int, int, int *, int *, int *,
 
164
                              doublecomplex *, GlobalLU_t *);         
 
165
extern int     zpivotL (const int, const double, int *, int *, 
 
166
                         int *, int *, int *, GlobalLU_t *, SuperLUStat_t*);
 
167
extern void    zpruneL (const int, const int *, const int, const int,
 
168
                          const int *, const int *, int *, GlobalLU_t *);
 
169
extern void    zreadmt (int *, int *, int *, doublecomplex **, int **, int **);
 
170
extern void    zGenXtrue (int, int, doublecomplex *, int);
 
171
extern void    zFillRHS (trans_t, int, doublecomplex *, int, SuperMatrix *,
 
172
                          SuperMatrix *);
 
173
extern void    zgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
 
174
                        SuperMatrix *, SuperLUStat_t*, int *);
 
175
 
 
176
 
 
177
/* Driver related */
 
178
 
 
179
extern void    zgsequ (SuperMatrix *, double *, double *, double *,
 
180
                        double *, double *, int *);
 
181
extern void    zlaqgs (SuperMatrix *, double *, double *, double,
 
182
                        double, double, char *);
 
183
extern void    zgscon (char *, SuperMatrix *, SuperMatrix *, 
 
184
                         double, double *, SuperLUStat_t*, int *);
 
185
extern double   zPivotGrowth(int, SuperMatrix *, int *, 
 
186
                            SuperMatrix *, SuperMatrix *);
 
187
extern void    zgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
 
188
                       SuperMatrix *, int *, int *, char *, double *, 
 
189
                       double *, SuperMatrix *, SuperMatrix *,
 
190
                       double *, double *, SuperLUStat_t*, int *);
 
191
 
 
192
extern int     sp_ztrsv (char *, char *, char *, SuperMatrix *,
 
193
                        SuperMatrix *, doublecomplex *, SuperLUStat_t*, int *);
 
194
extern int     sp_zgemv (char *, doublecomplex, SuperMatrix *, doublecomplex *,
 
195
                        int, doublecomplex, doublecomplex *, int);
 
196
 
 
197
extern int     sp_zgemm (char *, char *, int, int, int, doublecomplex,
 
198
                        SuperMatrix *, doublecomplex *, int, doublecomplex, 
 
199
                        doublecomplex *, int);
 
200
 
 
201
/* Memory-related */
 
202
extern int     zLUMemInit (fact_t, void *, int, int, int, int, int,
 
203
                             SuperMatrix *, SuperMatrix *,
 
204
                             GlobalLU_t *, int **, doublecomplex **);
 
205
extern void    zSetRWork (int, int, doublecomplex *, doublecomplex **, doublecomplex **);
 
206
extern void    zLUWorkFree (int *, doublecomplex *, GlobalLU_t *);
 
207
extern int     zLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
 
208
 
 
209
extern doublecomplex  *doublecomplexMalloc(int);
 
210
extern doublecomplex  *doublecomplexCalloc(int);
 
211
extern double  *doubleMalloc(int);
 
212
extern double  *doubleCalloc(int);
 
213
extern int     zmemory_usage(const int, const int, const int, const int);
 
214
extern int     zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
 
215
 
 
216
/* Auxiliary routines */
 
217
extern void    zreadhb(int *, int *, int *, doublecomplex **, int **, int **);
 
218
extern void    zCompRow_to_CompCol(int, int, int, doublecomplex*, int*, int*,
 
219
                                   doublecomplex **, int **, int **);
 
220
extern void    zfill (doublecomplex *, int, doublecomplex);
 
221
extern void    zinf_norm_error (int, SuperMatrix *, doublecomplex *);
 
222
extern void    PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
 
223
                         doublecomplex, doublecomplex, doublecomplex *, doublecomplex *, char *);
 
224
 
 
225
/* Routines for debugging */
 
226
extern void    zPrint_CompCol_Matrix(char *, SuperMatrix *);
 
227
extern void    zPrint_SuperNode_Matrix(char *, SuperMatrix *);
 
228
extern void    zPrint_Dense_Matrix(char *, SuperMatrix *);
 
229
extern void    print_lu_col(char *, int, int, int *, GlobalLU_t *);
 
230
extern void    check_tempv(int, doublecomplex *);
 
231
 
 
232
#ifdef __cplusplus
 
233
  }
 
234
#endif
 
235
 
 
236
#endif /* __SUPERLU_zSP_DEFS */
 
237