Eigen  5.0.1
 
Loading...
Searching...
No Matches
SparseLU_Structs.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9// SPDX-License-Identifier: MPL-2.0
10
11/*
12 * NOTE: This file comes from a partly modified version of files slu_[s,d,c,z]defs.h
13 * -- SuperLU routine (version 4.1) --
14 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
15 * and Lawrence Berkeley National Lab.
16 * November, 2010
17 *
18 * Global data structures used in LU factorization -
19 *
20 * nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
21 * (xsup,supno): supno[i] is the supernode no to which i belongs;
22 * xsup(s) points to the beginning of the s-th supernode.
23 * e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12)
24 * xsup 0 1 2 4 7 12
25 * Note: dfs will be performed on supernode rep. relative to the new
26 * row pivoting ordering
27 *
28 * (xlsub,lsub): lsub[*] contains the compressed subscript of
29 * rectangular supernodes; xlsub[j] points to the starting
30 * location of the j-th column in lsub[*]. Note that xlsub
31 * is indexed by column.
32 * Storage: original row subscripts
33 *
34 * During the course of sparse LU factorization, we also use
35 * (xlsub,lsub) for the purpose of symmetric pruning. For each
36 * supernode {s,s+1,...,t=s+r} with first column s and last
37 * column t, the subscript set
38 * lsub[j], j=xlsub[s], .., xlsub[s+1]-1
39 * is the structure of column s (i.e. structure of this supernode).
40 * It is used for the storage of numerical values.
41 * Furthermore,
42 * lsub[j], j=xlsub[t], .., xlsub[t+1]-1
43 * is the structure of the last column t of this supernode.
44 * It is for the purpose of symmetric pruning. Therefore, the
45 * structural subscripts can be rearranged without making physical
46 * interchanges among the numerical values.
47 *
48 * However, if the supernode has only one column, then we
49 * only keep one set of subscripts. For any subscript interchange
50 * performed, similar interchange must be done on the numerical
51 * values.
52 *
53 * The last column structures (for pruning) will be removed
54 * after the numerical LU factorization phase.
55 *
56 * (xlusup,lusup): lusup[*] contains the numerical values of the
57 * rectangular supernodes; xlusup[j] points to the starting
58 * location of the j-th column in storage vector lusup[*]
59 * Note: xlusup is indexed by column.
60 * Each rectangular supernode is stored by column-major
61 * scheme, consistent with Fortran 2-dim array storage.
62 *
63 * (xusub,ucol,usub): ucol[*] stores the numerical values of
64 * U-columns outside the rectangular supernodes. The row
65 * subscript of nonzero ucol[k] is stored in usub[k].
66 * xusub[i] points to the starting location of column i in ucol.
67 * Storage: new row subscripts; that is subscripts of PA.
68 */
69
70#ifndef EIGEN_LU_STRUCTS
71#define EIGEN_LU_STRUCTS
72// IWYU pragma: private
73#include "./InternalHeaderCheck.h"
74
75namespace Eigen {
76namespace internal {
77
78enum MemType { LUSUP, UCOL, LSUB, USUB };
79
80template <typename IndexVector, typename ScalarVector>
81struct LU_GlobalLU_t {
82 using StorageIndex = typename IndexVector::Scalar;
83 IndexVector xsup; // First supernode column ... xsup(s) points to the beginning of the s-th supernode
84 IndexVector supno; // Supernode number corresponding to this column (column to supernode mapping)
85 ScalarVector lusup; // nonzero values of L ordered by columns
86 IndexVector lsub; // Compressed row indices of L rectangular supernodes.
87 IndexVector xlusup; // pointers to the beginning of each column in lusup
88 IndexVector xlsub; // pointers to the beginning of each column in lsub
89 Index nzlmax; // Current max size of lsub
90 Index nzlumax; // Current max size of lusup
91 ScalarVector ucol; // nonzero values of U ordered by columns
92 IndexVector usub; // row indices of U columns in ucol
93 IndexVector xusub; // Pointers to the beginning of each column of U in ucol
94 Index nzumax; // Current max size of ucol
95 Index n; // Number of columns in the matrix
96 Index num_expansions;
97};
98
99// Values to set for performance
100struct perfvalues {
101 Index panel_size; // a panel consists of at most <panel_size> consecutive columns
102 Index relax; // To control degree of relaxing supernodes. If the number of nodes (columns)
103 // in a subtree of the elimination tree is less than relax, this subtree is considered
104 // as one supernode regardless of the row structures of those columns
105 Index maxsuper; // The maximum size for a supernode in complete LU
106 Index rowblk; // The minimum row dimension for 2-D blocking to be used;
107 Index colblk; // The minimum column dimension for 2-D blocking to be used;
108 Index fillfactor; // The estimated fills factors for L and U, compared with A
109};
110
111} // end namespace internal
112
113} // end namespace Eigen
114#endif // EIGEN_LU_STRUCTS