gtsam
3rdparty
Eigen
Eigen
src
SparseLU
SparseLU_Utils.h
Go to the documentation of this file.
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
10
11
#ifndef EIGEN_SPARSELU_UTILS_H
12
#define EIGEN_SPARSELU_UTILS_H
13
14
namespace
Eigen
{
15
namespace
internal
{
16
20
template
<
typename
Scalar,
typename
StorageIndex>
21
void
SparseLUImpl<Scalar,StorageIndex>::countnz
(
const
Index
n
,
Index
& nnzL,
Index
& nnzU,
GlobalLU_t
& glu)
22
{
23
nnzL = 0;
24
nnzU = (glu.
xusub
)(
n
);
25
Index
nsuper = (glu.
supno
)(
n
);
26
Index
jlen;
27
Index
i
,
j
, fsupc;
28
if
(
n
<= 0 )
return
;
29
// For each supernode
30
for
(
i
= 0;
i
<= nsuper;
i
++)
31
{
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
{
37
nnzL += jlen;
38
nnzU +=
j
- fsupc + 1;
39
jlen--;
40
}
41
}
42
}
43
51
template
<
typename
Scalar,
typename
StorageIndex>
52
void
SparseLUImpl<Scalar,StorageIndex>::fixupL
(
const
Index
n
,
const
IndexVector
& perm_r,
GlobalLU_t
& glu)
53
{
54
Index
fsupc,
i
,
j
, k, jstart;
55
56
StorageIndex nextl = 0;
57
Index
nsuper = (glu.
supno
)(
n
);
58
59
// For each supernode
60
for
(
i
= 0;
i
<= nsuper;
i
++)
61
{
62
fsupc = glu.
xsup
(
i
);
63
jstart = glu.
xlsub
(fsupc);
64
glu.
xlsub
(fsupc) = nextl;
65
for
(
j
= jstart;
j
< glu.
xlsub
(fsupc + 1);
j
++)
66
{
67
glu.
lsub
(nextl) = perm_r(glu.
lsub
(
j
));
// Now indexed into P*A
68
nextl++;
69
}
70
for
(k = fsupc+1; k < glu.
xsup
(
i
+1); k++)
71
glu.
xlsub
(k) = nextl;
// other columns in supernode i
72
}
73
74
glu.
xlsub
(
n
) = nextl;
75
}
76
77
}
// end namespace internal
78
79
}
// end namespace Eigen
80
#endif // EIGEN_SPARSELU_UTILS_H
Eigen::internal::LU_GlobalLU_t::lsub
IndexVector lsub
Definition:
SparseLU_Structs.h:82
Eigen
Namespace containing all symbols from the Eigen library.
Definition:
jet.h:637
Eigen::internal::SparseLUImpl::fixupL
void fixupL(const Index n, const IndexVector &perm_r, GlobalLU_t &glu)
Fix up the data storage lsub for L-subscripts.
Definition:
SparseLU_Utils.h:52
Eigen::internal::LU_GlobalLU_t::xsup
IndexVector xsup
Definition:
SparseLU_Structs.h:79
n
int n
Definition:
BiCGSTAB_simple.cpp:1
j
std::ptrdiff_t j
Definition:
tut_arithmetic_redux_minmax.cpp:2
Eigen::internal::LU_GlobalLU_t::supno
IndexVector supno
Definition:
SparseLU_Structs.h:80
Eigen::internal::LU_GlobalLU_t::xlsub
IndexVector xlsub
Definition:
SparseLU_Structs.h:84
Eigen::Matrix< StorageIndex, Dynamic, 1 >
internal
Definition:
BandTriangularSolver.h:13
Eigen::internal::LU_GlobalLU_t
Definition:
SparseLU_Structs.h:77
Eigen::internal::SparseLUImpl::countnz
void countnz(const Index n, Index &nnzL, Index &nnzU, GlobalLU_t &glu)
Count Nonzero elements in the factors.
Definition:
SparseLU_Utils.h:21
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
Eigen::internal::LU_GlobalLU_t::xusub
IndexVector xusub
Definition:
SparseLU_Structs.h:89
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition:
Meta.h:74
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:13:38