Blender V2.61 - r43446

ssp_defs.h

Go to the documentation of this file.
00001 
00005 /*
00006  * -- SuperLU routine (version 3.0) --
00007  * Univ. of California Berkeley, Xerox Palo Alto Research Center,
00008  * and Lawrence Berkeley National Lab.
00009  * October 15, 2003
00010  *
00011  */
00012 #ifndef __SUPERLU_sSP_DEFS /* allow multiple inclusions */
00013 #define __SUPERLU_sSP_DEFS
00014 
00015 /*
00016  * File name:       ssp_defs.h
00017  * Purpose:             Sparse matrix types and function prototypes
00018  * History:
00019  */
00020 
00021 #ifdef _CRAY
00022 #include <fortran.h>
00023 #include <string.h>
00024 #endif
00025 
00026 /* Define my integer type int_t */
00027 typedef int int_t; /* default */
00028 
00029 #include "Cnames.h"
00030 #include "supermatrix.h"
00031 #include "util.h"
00032 
00033 
00034 /*
00035  * Global data structures used in LU factorization -
00036  * 
00037  *   nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
00038  *   (xsup,supno): supno[i] is the supernode no to which i belongs;
00039  *  xsup(s) points to the beginning of the s-th supernode.
00040  *  e.g.   supno 0 1 2 2 3 3 3 4 4 4 4 4   (n=12)
00041  *          xsup 0 1 2 4 7 12
00042  *  Note: dfs will be performed on supernode rep. relative to the new 
00043  *        row pivoting ordering
00044  *
00045  *   (xlsub,lsub): lsub[*] contains the compressed subscript of
00046  *  rectangular supernodes; xlsub[j] points to the starting
00047  *  location of the j-th column in lsub[*]. Note that xlsub 
00048  *  is indexed by column.
00049  *  Storage: original row subscripts
00050  *
00051  *      During the course of sparse LU factorization, we also use
00052  *  (xlsub,lsub) for the purpose of symmetric pruning. For each
00053  *  supernode {s,s+1,...,t=s+r} with first column s and last
00054  *  column t, the subscript set
00055  *      lsub[j], j=xlsub[s], .., xlsub[s+1]-1
00056  *  is the structure of column s (i.e. structure of this supernode).
00057  *  It is used for the storage of numerical values.
00058  *  Furthermore,
00059  *      lsub[j], j=xlsub[t], .., xlsub[t+1]-1
00060  *  is the structure of the last column t of this supernode.
00061  *  It is for the purpose of symmetric pruning. Therefore, the
00062  *  structural subscripts can be rearranged without making physical
00063  *  interchanges among the numerical values.
00064  *
00065  *  However, if the supernode has only one column, then we
00066  *  only keep one set of subscripts. For any subscript interchange
00067  *  performed, similar interchange must be done on the numerical
00068  *  values.
00069  *
00070  *  The last column structures (for pruning) will be removed
00071  *  after the numercial LU factorization phase.
00072  *
00073  *   (xlusup,lusup): lusup[*] contains the numerical values of the
00074  *  rectangular supernodes; xlusup[j] points to the starting
00075  *  location of the j-th column in storage vector lusup[*]
00076  *  Note: xlusup is indexed by column.
00077  *  Each rectangular supernode is stored by column-major
00078  *  scheme, consistent with Fortran 2-dim array storage.
00079  *
00080  *   (xusub,ucol,usub): ucol[*] stores the numerical values of
00081  *  U-columns outside the rectangular supernodes. The row
00082  *  subscript of nonzero ucol[k] is stored in usub[k].
00083  *  xusub[i] points to the starting location of column i in ucol.
00084  *  Storage: new row subscripts; that is subscripts of PA.
00085  */
00086 typedef struct {
00087     int     *xsup;    /* supernode and column mapping */
00088     int     *supno;   
00089     int     *lsub;    /* compressed L subscripts */
00090     int     *xlsub;
00091     float  *lusup;   /* L supernodes */
00092     int     *xlusup;
00093     float  *ucol;    /* U columns */
00094     int     *usub;
00095     int     *xusub;
00096     int     nzlmax;   /* current max size of lsub */
00097     int     nzumax;   /*    "    "    "      ucol */
00098     int     nzlumax;  /*    "    "    "     lusup */
00099     int     n;        /* number of columns in the matrix */
00100     LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
00101 } GlobalLU_t;
00102 
00103 typedef struct {
00104     float for_lu;
00105     float total_needed;
00106     int   expansions;
00107 } mem_usage_t;
00108 
00109 #ifdef __cplusplus
00110 extern "C" {
00111 #endif
00112 
00113 /* Driver routines */
00114 extern void
00115 sgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
00116       SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
00117 extern void
00118 sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
00119        char *, float *, float *, SuperMatrix *, SuperMatrix *,
00120        void *, int, SuperMatrix *, SuperMatrix *,
00121        float *, float *, float *, float *,
00122        mem_usage_t *, SuperLUStat_t *, int *);
00123 
00124 /* Supernodal LU factor related */
00125 extern void
00126 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *,
00127                int *, int *, Stype_t, Dtype_t, Mtype_t);
00128 extern void
00129 sCreate_CompRow_Matrix(SuperMatrix *, int, int, int, float *,
00130                int *, int *, Stype_t, Dtype_t, Mtype_t);
00131 extern void
00132 sCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
00133 extern void
00134 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int,
00135              Stype_t, Dtype_t, Mtype_t);
00136 extern void
00137 sCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, float *, 
00138                  int *, int *, int *, int *, int *,
00139              Stype_t, Dtype_t, Mtype_t);
00140 extern void
00141 sCopy_Dense_Matrix(int, int, float *, int, float *, int);
00142 
00143 extern void    countnz (const int, int *, int *, int *, GlobalLU_t *);
00144 extern void    fixupL (const int, const int *, GlobalLU_t *);
00145 
00146 extern void    sallocateA (int, int, float **, int **, int **);
00147 extern void    sgstrf (superlu_options_t*, SuperMatrix*, 
00148                        int, int, int*, void *, int, int *, int *, 
00149                        SuperMatrix *, SuperMatrix *, SuperLUStat_t*, int *);
00150 extern int     ssnode_dfs (const int, const int, const int *, const int *,
00151                  const int *, int *, int *, GlobalLU_t *);
00152 extern int     ssnode_bmod (const int, const int, float *,
00153                               float *, GlobalLU_t *, SuperLUStat_t*);
00154 extern void    spanel_dfs (const int, const int, const int, SuperMatrix *,
00155                int *, int *, float *, int *, int *, int *,
00156                int *, int *, int *, int *, GlobalLU_t *);
00157 extern void    spanel_bmod (const int, const int, const int, const int,
00158                            float *, float *, int *, int *,
00159                GlobalLU_t *, SuperLUStat_t*);
00160 extern int     scolumn_dfs (const int, const int, int *, int *, int *, int *,
00161                int *, int *, int *, int *, int *, GlobalLU_t *);
00162 extern int     scolumn_bmod (const int, const int, float *,
00163                float *, int *, int *, int,
00164                            GlobalLU_t *, SuperLUStat_t*);
00165 extern int     scopy_to_ucol (int, int, int *, int *, int *,
00166                               float *, GlobalLU_t *);         
00167 extern int     spivotL (const int, const float, int *, int *, 
00168                          int *, int *, int *, GlobalLU_t *, SuperLUStat_t*);
00169 extern void    spruneL (const int, const int *, const int, const int,
00170               const int *, const int *, int *, GlobalLU_t *);
00171 extern void    sreadmt (int *, int *, int *, float **, int **, int **);
00172 extern void    sGenXtrue (int, int, float *, int);
00173 extern void    sFillRHS (trans_t, int, float *, int, SuperMatrix *,
00174               SuperMatrix *);
00175 extern void    sgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
00176                         SuperMatrix *, SuperLUStat_t*, int *);
00177 
00178 
00179 /* Driver related */
00180 
00181 extern void    sgsequ (SuperMatrix *, float *, float *, float *,
00182             float *, float *, int *);
00183 extern void    slaqgs (SuperMatrix *, float *, float *, float,
00184                         float, float, char *);
00185 extern void    sgscon (char *, SuperMatrix *, SuperMatrix *, 
00186                  float, float *, SuperLUStat_t*, int *);
00187 extern float   sPivotGrowth(int, SuperMatrix *, int *, 
00188                             SuperMatrix *, SuperMatrix *);
00189 extern void    sgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
00190                        SuperMatrix *, int *, int *, char *, float *, 
00191                        float *, SuperMatrix *, SuperMatrix *,
00192                        float *, float *, SuperLUStat_t*, int *);
00193 
00194 extern int     sp_strsv (char *, char *, char *, SuperMatrix *,
00195             SuperMatrix *, float *, SuperLUStat_t*, int *);
00196 extern int     sp_sgemv (char *, float, SuperMatrix *, float *,
00197             int, float, float *, int);
00198 
00199 extern int     sp_sgemm (char *, int, float,
00200             SuperMatrix *, float *, int, float, 
00201             float *, int);
00202 
00203 /* Memory-related */
00204 extern int     sLUMemInit (fact_t, void *, int, int, int, int, int,
00205                  SuperMatrix *, SuperMatrix *,
00206                  GlobalLU_t *, int **, float **);
00207 extern void    sSetRWork (int, int, float *, float **, float **);
00208 extern void    sLUWorkFree (int *, float *, GlobalLU_t *);
00209 extern int     sLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
00210 
00211 extern float  *floatMalloc(int);
00212 extern float  *floatCalloc(int);
00213 extern int     smemory_usage(const int, const int, const int, const int);
00214 extern int     sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
00215 
00216 /* Auxiliary routines */
00217 extern void    sreadhb(int *, int *, int *, float **, int **, int **);
00218 extern void    sCompRow_to_CompCol(int, int, int, float*, int*, int*,
00219                            float **, int **, int **);
00220 extern void    sfill (float *, int, float);
00221 extern void    sinf_norm_error (int, SuperMatrix *, float *);
00222 extern void    PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
00223              float, float, float *, float *, char *);
00224 
00225 /* Routines for debugging */
00226 extern void    sPrint_CompCol_Matrix(char *, SuperMatrix *);
00227 extern void    sPrint_SuperNode_Matrix(char *, SuperMatrix *);
00228 extern void    sPrint_Dense_Matrix(char *, SuperMatrix *);
00229 extern void    print_lu_col(char *, int, int, int *, GlobalLU_t *);
00230 extern void    check_tempv(int, float *);
00231 extern int      print_int_vec(char *what, int n, int *vec);
00232 
00233 extern int      sp_symetree(int *acolst, int *acolend, int *arow, int n, int *parent);
00234 extern void    sprint_lu_col(char *msg, int jcol, int pivrow, int *xprune, GlobalLU_t *Glu); // added to build with debug for blender - campbell
00235 #ifdef __cplusplus
00236   }
00237 #endif
00238 
00239 #endif /* __SUPERLU_sSP_DEFS */
00240