aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/SparseLU/SparseLU_Structs.h
blob: cf5ec449bec3474860b49c3348a90c15cb15fed2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

/* 
 * NOTE: This file comes from a partly modified version of files slu_[s,d,c,z]defs.h
 * -- SuperLU routine (version 4.1) --
 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
 * and Lawrence Berkeley National Lab.
 * November, 2010
 * 
 * Global data structures used in LU factorization -
 * 
 *   nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
 *   (xsup,supno): supno[i] is the supernode no to which i belongs;
 *  xsup(s) points to the beginning of the s-th supernode.
 *  e.g.   supno 0 1 2 2 3 3 3 4 4 4 4 4   (n=12)
 *          xsup 0 1 2 4 7 12
 *  Note: dfs will be performed on supernode rep. relative to the new 
 *        row pivoting ordering
 *
 *   (xlsub,lsub): lsub[*] contains the compressed subscript of
 *  rectangular supernodes; xlsub[j] points to the starting
 *  location of the j-th column in lsub[*]. Note that xlsub 
 *  is indexed by column.
 *  Storage: original row subscripts
 *
 *      During the course of sparse LU factorization, we also use
 *  (xlsub,lsub) for the purpose of symmetric pruning. For each
 *  supernode {s,s+1,...,t=s+r} with first column s and last
 *  column t, the subscript set
 *    lsub[j], j=xlsub[s], .., xlsub[s+1]-1
 *  is the structure of column s (i.e. structure of this supernode).
 *  It is used for the storage of numerical values.
 *  Furthermore,
 *    lsub[j], j=xlsub[t], .., xlsub[t+1]-1
 *  is the structure of the last column t of this supernode.
 *  It is for the purpose of symmetric pruning. Therefore, the
 *  structural subscripts can be rearranged without making physical
 *  interchanges among the numerical values.
 *
 *  However, if the supernode has only one column, then we
 *  only keep one set of subscripts. For any subscript interchange
 *  performed, similar interchange must be done on the numerical
 *  values.
 *
 *  The last column structures (for pruning) will be removed
 *  after the numercial LU factorization phase.
 *
 *   (xlusup,lusup): lusup[*] contains the numerical values of the
 *  rectangular supernodes; xlusup[j] points to the starting
 *  location of the j-th column in storage vector lusup[*]
 *  Note: xlusup is indexed by column.
 *  Each rectangular supernode is stored by column-major
 *  scheme, consistent with Fortran 2-dim array storage.
 *
 *   (xusub,ucol,usub): ucol[*] stores the numerical values of
 *  U-columns outside the rectangular supernodes. The row
 *  subscript of nonzero ucol[k] is stored in usub[k].
 *  xusub[i] points to the starting location of column i in ucol.
 *  Storage: new row subscripts; that is subscripts of PA.
 */

#ifndef EIGEN_LU_STRUCTS
#define EIGEN_LU_STRUCTS
namespace Eigen {
namespace internal {
  
typedef enum {LUSUP, UCOL, LSUB, USUB, LLVL, ULVL} MemType; 

template <typename IndexVector, typename ScalarVector>
struct LU_GlobalLU_t {
  typedef typename IndexVector::Scalar StorageIndex; 
  IndexVector xsup; //First supernode column ... xsup(s) points to the beginning of the s-th supernode
  IndexVector supno; // Supernode number corresponding to this column (column to supernode mapping)
  ScalarVector  lusup; // nonzero values of L ordered by columns 
  IndexVector lsub; // Compressed row indices of L rectangular supernodes. 
  IndexVector xlusup; // pointers to the beginning of each column in lusup
  IndexVector xlsub; // pointers to the beginning of each column in lsub
  Index   nzlmax; // Current max size of lsub
  Index   nzlumax; // Current max size of lusup
  ScalarVector  ucol; // nonzero values of U ordered by columns 
  IndexVector usub; // row indices of U columns in ucol
  IndexVector xusub; // Pointers to the beginning of each column of U in ucol 
  Index   nzumax; // Current max size of ucol
  Index   n; // Number of columns in the matrix  
  Index   num_expansions; 
};

// Values to set for performance
struct perfvalues {
  Index panel_size; // a panel consists of at most <panel_size> consecutive columns
  Index relax; // To control degree of relaxing supernodes. If the number of nodes (columns) 
                // in a subtree of the elimination tree is less than relax, this subtree is considered 
                // as one supernode regardless of the row structures of those columns
  Index maxsuper; // The maximum size for a supernode in complete LU
  Index rowblk; // The minimum row dimension for 2-D blocking to be used;
  Index colblk; // The minimum column dimension for 2-D blocking to be used;
  Index fillfactor; // The estimated fills factors for L and U, compared with A
}; 

} // end namespace internal

} // end namespace Eigen
#endif // EIGEN_LU_STRUCTS