Eigen  3.4.90 (git rev 5a9f66fb35d03a4da9ef8976e67a61b30aa16dcf)
 
Loading...
Searching...
No Matches
SparseLU_Utils.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 <[email protected]>
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
10#ifndef EIGEN_SPARSELU_UTILS_H
11#define EIGEN_SPARSELU_UTILS_H
12
13// IWYU pragma: private
14#include "./InternalHeaderCheck.h"
15
16namespace Eigen {
17namespace internal {
18
22template <typename Scalar, typename StorageIndex>
23void SparseLUImpl<Scalar, StorageIndex>::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) {
24 nnzL = 0;
25 nnzU = (glu.xusub)(n);
26 Index nsuper = (glu.supno)(n);
27 Index jlen;
28 Index i, j, fsupc;
29 if (n <= 0) return;
30 // For each supernode
31 for (i = 0; i <= nsuper; i++) {
32 fsupc = glu.xsup(i);
33 jlen = glu.xlsub(fsupc + 1) - glu.xlsub(fsupc);
34
35 for (j = fsupc; j < glu.xsup(i + 1); j++) {
36 nnzL += jlen;
37 nnzU += j - fsupc + 1;
38 jlen--;
39 }
40 }
41}
42
50template <typename Scalar, typename StorageIndex>
51void SparseLUImpl<Scalar, StorageIndex>::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) {
52 Index fsupc, i, j, k, jstart;
53
54 StorageIndex nextl = 0;
55 Index nsuper = (glu.supno)(n);
56
57 // For each supernode
58 for (i = 0; i <= nsuper; i++) {
59 fsupc = glu.xsup(i);
60 jstart = glu.xlsub(fsupc);
61 glu.xlsub(fsupc) = nextl;
62 for (j = jstart; j < glu.xlsub(fsupc + 1); j++) {
63 glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A
64 nextl++;
65 }
66 for (k = fsupc + 1; k < glu.xsup(i + 1); k++) glu.xlsub(k) = nextl; // other columns in supernode i
67 }
68
69 glu.xlsub(n) = nextl;
70}
71
72} // end namespace internal
73
74} // end namespace Eigen
75#endif // EIGEN_SPARSELU_UTILS_H
Namespace containing all symbols from the Eigen library.
Definition Core:137