~ubuntu-branches/ubuntu/edgy/k3d/edgy-proposed

« back to all changes in this revision

Viewing changes to modules/mesh/superlu/src/supermatrix.h

  • Committer: Bazaar Package Importer
  • Author(s): David Martínez Moreno
  • Date: 2005-04-28 18:38:10 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050428183810-kvc6nz46z6gheo0k
Tags: 0.4.5.0-5
* AAAAAAAARGH, *patching* configure.ac broke again the build process! Fixed
  (I hope).
* Removed more cruft of shaderpreprocessor/ from configure.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __SUPERLU_SUPERMATRIX /* allow multiple inclusions */
 
2
#define __SUPERLU_SUPERMATRIX
 
3
 
 
4
/********************************************
 
5
 * The matrix types are defined as follows. *
 
6
 ********************************************/
 
7
typedef enum {
 
8
    SLU_NC,    /* column-wise, no supernode */
 
9
    SLU_NR,    /* row-wize, no supernode */
 
10
    SLU_SC,    /* column-wise, supernode */
 
11
    SLU_SR,    /* row-wise, supernode */
 
12
    SLU_NCP,   /* column-wise, column-permuted, no supernode 
 
13
                  (The consecutive columns of nonzeros, after permutation,
 
14
                   may not be stored  contiguously.) */
 
15
    SLU_DN     /* Fortran style column-wise storage for dense matrix */
 
16
} Stype_t;
 
17
 
 
18
typedef enum {
 
19
    SLU_S,     /* single */
 
20
    SLU_D,     /* double */
 
21
    SLU_C,     /* single complex */
 
22
    SLU_Z      /* double complex */
 
23
} Dtype_t;
 
24
 
 
25
typedef enum {
 
26
    SLU_GE,    /* general */
 
27
    SLU_TRLU,  /* lower triangular, unit diagonal */
 
28
    SLU_TRUU,  /* upper triangular, unit diagonal */
 
29
    SLU_TRL,   /* lower triangular */
 
30
    SLU_TRU,   /* upper triangular */
 
31
    SLU_SYL,   /* symmetric, store lower half */
 
32
    SLU_SYU,   /* symmetric, store upper half */
 
33
    SLU_HEL,   /* Hermitian, store lower half */
 
34
    SLU_HEU    /* Hermitian, store upper half */
 
35
} Mtype_t;
 
36
 
 
37
typedef struct {
 
38
        Stype_t Stype; /* Storage type: interprets the storage structure 
 
39
                          pointed to by *Store. */
 
40
        Dtype_t Dtype; /* Data type. */
 
41
        Mtype_t Mtype; /* Matrix type: describes the mathematical property of 
 
42
                          the matrix. */
 
43
        int_t  nrow;   /* number of rows */
 
44
        int_t  ncol;   /* number of columns */
 
45
        void *Store;   /* pointer to the actual storage of the matrix */
 
46
} SuperMatrix;
 
47
 
 
48
/***********************************************
 
49
 * The storage schemes are defined as follows. *
 
50
 ***********************************************/
 
51
 
 
52
/* Stype == NC (Also known as Harwell-Boeing sparse matrix format) */
 
53
typedef struct {
 
54
    int_t  nnz;     /* number of nonzeros in the matrix */
 
55
    void   *nzval;  /* pointer to array of nonzero values, packed by column */
 
56
    int_t  *rowind; /* pointer to array of row indices of the nonzeros */
 
57
    int_t  *colptr; /* pointer to array of beginning of columns in nzval[] 
 
58
                       and rowind[]  */
 
59
                    /* Note:
 
60
                       Zero-based indexing is used;
 
61
                       colptr[] has ncol+1 entries, the last one pointing
 
62
                       beyond the last column, so that colptr[ncol] = nnz. */
 
63
} NCformat;
 
64
 
 
65
/* Stype == NR (Also known as row compressed storage (RCS). */
 
66
typedef struct {
 
67
    int_t nnz;     /* number of nonzeros in the matrix */
 
68
    void  *nzval;  /* pointer to array of nonzero values, packed by row */
 
69
    int_t *colind; /* pointer to array of column indices of the nonzeros */
 
70
    int_t *rowptr; /* pointer to array of beginning of rows in nzval[] 
 
71
                      and colind[]  */
 
72
                   /* Note:
 
73
                      Zero-based indexing is used;
 
74
                      nzval[] and colind[] are of the same length, nnz;
 
75
                      rowptr[] has nrow+1 entries, the last one pointing
 
76
                      beyond the last column, so that rowptr[nrow] = nnz. */
 
77
} NRformat;
 
78
 
 
79
/* Stype == SC */
 
80
typedef struct {
 
81
  int_t  nnz;        /* number of nonzeros in the matrix */
 
82
  int_t  nsuper;     /* number of supernodes, minus 1 */
 
83
  void *nzval;       /* pointer to array of nonzero values, packed by column */
 
84
  int_t *nzval_colptr;/* pointer to array of beginning of columns in nzval[] */
 
85
  int_t *rowind;     /* pointer to array of compressed row indices of 
 
86
                        rectangular supernodes */
 
87
  int_t *rowind_colptr;/* pointer to array of beginning of columns in rowind[] */
 
88
  int_t *col_to_sup; /* col_to_sup[j] is the supernode number to which column 
 
89
                        j belongs; mapping from column to supernode number. */
 
90
  int_t *sup_to_col; /* sup_to_col[s] points to the start of the s-th 
 
91
                        supernode; mapping from supernode number to column.
 
92
                        e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12)
 
93
                              sup_to_col: 0 1 2 4 7 12           (nsuper=4) */
 
94
                     /* Note:
 
95
                        Zero-based indexing is used;
 
96
                        nzval_colptr[], rowind_colptr[], col_to_sup and
 
97
                        sup_to_col[] have ncol+1 entries, the last one
 
98
                        pointing beyond the last column.
 
99
                        For col_to_sup[], only the first ncol entries are
 
100
                        defined. For sup_to_col[], only the first nsuper+2
 
101
                        entries are defined. */
 
102
} SCformat;
 
103
 
 
104
/* Stype == NCP */
 
105
typedef struct {
 
106
    int_t nnz;    /* number of nonzeros in the matrix */
 
107
    void *nzval;  /* pointer to array of nonzero values, packed by column */
 
108
    int_t *rowind;/* pointer to array of row indices of the nonzeros */
 
109
                  /* Note: nzval[]/rowind[] always have the same length */
 
110
    int_t *colbeg;/* colbeg[j] points to the beginning of column j in nzval[] 
 
111
                     and rowind[]  */
 
112
    int_t *colend;/* colend[j] points to one past the last element of column
 
113
                     j in nzval[] and rowind[]  */
 
114
                  /* Note:
 
115
                     Zero-based indexing is used;
 
116
                     The consecutive columns of the nonzeros may not be 
 
117
                     contiguous in storage, because the matrix has been 
 
118
                     postmultiplied by a column permutation matrix. */
 
119
} NCPformat;
 
120
 
 
121
/* Stype == DN */
 
122
typedef struct {
 
123
    int_t lda;    /* leading dimension */
 
124
    void *nzval;  /* array of size lda*ncol to represent a dense matrix */
 
125
} DNformat;
 
126
 
 
127
 
 
128
 
 
129
/*********************************************************
 
130
 * Macros used for easy access of sparse matrix entries. *
 
131
 *********************************************************/
 
132
#define L_SUB_START(col)     ( Lstore->rowind_colptr[col] )
 
133
#define L_SUB(ptr)           ( Lstore->rowind[ptr] )
 
134
#define L_NZ_START(col)      ( Lstore->nzval_colptr[col] )
 
135
#define L_FST_SUPC(superno)  ( Lstore->sup_to_col[superno] )
 
136
#define U_NZ_START(col)      ( Ustore->colptr[col] )
 
137
#define U_SUB(ptr)           ( Ustore->rowind[ptr] )
 
138
 
 
139
 
 
140
#endif  /* __SUPERLU_SUPERMATRIX */