Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
c
d
e
f
g
i
k
l
m
n
p
q
r
s
t
u
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Classes
Class List
Class Hierarchy
Class Members
All
!
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
!
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
f
k
l
m
n
o
p
r
s
t
v
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
:
a
b
c
d
e
g
h
i
l
m
n
o
p
r
s
t
u
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
z
Enumerations
Enumerator
b
c
e
f
g
i
l
m
n
o
p
r
s
t
u
v
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
gtsam
3rdparty
Eigen
Eigen
src
SparseLU
SparseLU_heap_relax_snode.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
/* This file is a modified version of heap_relax_snode.c file in SuperLU
11
* -- SuperLU routine (version 3.0) --
12
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
13
* and Lawrence Berkeley National Lab.
14
* October 15, 2003
15
*
16
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
17
*
18
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
19
* EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
20
*
21
* Permission is hereby granted to use or copy this program for any
22
* purpose, provided the above notices are retained on all copies.
23
* Permission to modify the code and to distribute modified code is
24
* granted, provided the above notices are retained, and a notice that
25
* the code was modified is included with the above copyright notice.
26
*/
27
28
#ifndef SPARSELU_HEAP_RELAX_SNODE_H
29
#define SPARSELU_HEAP_RELAX_SNODE_H
30
31
namespace
Eigen
{
32
namespace
internal
{
33
45
template
<
typename
Scalar,
typename
StorageIndex>
46
void
SparseLUImpl<Scalar,StorageIndex>::heap_relax_snode
(
const
Index
n
,
IndexVector
& et,
const
Index
relax_columns,
IndexVector
& descendants,
IndexVector
& relax_end)
47
{
48
49
// The etree may not be postordered, but its heap ordered
50
IndexVector
post;
51
internal::treePostorder
(StorageIndex(
n
), et, post);
// Post order etree
52
IndexVector
inv_post(
n
+1);
53
for
(StorageIndex
i
= 0;
i
<
n
+1; ++
i
) inv_post(post(
i
)) =
i
;
// inv_post = post.inverse()???
54
55
// Renumber etree in postorder
56
IndexVector
iwork(
n
);
57
IndexVector
et_save(
n
+1);
58
for
(
Index
i
= 0;
i
<
n
; ++
i
)
59
{
60
iwork(post(
i
)) = post(et(
i
));
61
}
62
et_save = et;
// Save the original etree
63
et = iwork;
64
65
// compute the number of descendants of each node in the etree
66
relax_end.
setConstant
(
emptyIdxLU
);
67
Index
j
, parent;
68
descendants.
setZero
();
69
for
(
j
= 0;
j
<
n
;
j
++)
70
{
71
parent = et(
j
);
72
if
(parent !=
n
)
// not the dummy root
73
descendants(parent) += descendants(
j
) + 1;
74
}
75
// Identify the relaxed supernodes by postorder traversal of the etree
76
Index
snode_start;
// beginning of a snode
77
StorageIndex k;
78
StorageIndex
l
;
79
for
(
j
= 0;
j
<
n
; )
80
{
81
parent = et(
j
);
82
snode_start =
j
;
83
while
( parent !=
n
&& descendants(parent) < relax_columns )
84
{
85
j
= parent;
86
parent = et(
j
);
87
}
88
// Found a supernode in postordered etree, j is the last column
89
k = StorageIndex(
n
);
90
for
(
Index
i
= snode_start;
i
<=
j
; ++
i
)
91
k = (
std::min
)(k, inv_post(
i
));
92
l
= inv_post(
j
);
93
if
( (
l
- k) == (
j
- snode_start) )
// Same number of columns in the snode
94
{
95
// This is also a supernode in the original etree
96
relax_end(k) =
l
;
// Record last column
97
}
98
else
99
{
100
for
(
Index
i
= snode_start;
i
<=
j
; ++
i
)
101
{
102
l
= inv_post(
i
);
103
if
(descendants(
i
) == 0)
104
{
105
relax_end(
l
) =
l
;
106
}
107
}
108
}
109
j
++;
110
// Search for a new leaf
111
while
(descendants(
j
) != 0 &&
j
<
n
)
j
++;
112
}
// End postorder traversal of the etree
113
114
// Recover the original etree
115
et = et_save;
116
}
117
118
}
// end namespace internal
119
120
}
// end namespace Eigen
121
#endif // SPARSELU_HEAP_RELAX_SNODE_H
Eigen::internal::treePostorder
void treePostorder(typename IndexVector::Scalar n, IndexVector &parent, IndexVector &post)
Post order a tree.
Definition:
SparseColEtree.h:178
Eigen
Namespace containing all symbols from the Eigen library.
Definition:
jet.h:637
Eigen::internal::SparseLUImpl::heap_relax_snode
void heap_relax_snode(const Index n, IndexVector &et, const Index relax_columns, IndexVector &descendants, IndexVector &relax_end)
Identify the initial relaxed supernodes.
Definition:
SparseLU_heap_relax_snode.h:46
n
int n
Definition:
BiCGSTAB_simple.cpp:1
Eigen::PlainObjectBase::setConstant
EIGEN_DEVICE_FUNC Derived & setConstant(Index size, const Scalar &val)
Definition:
CwiseNullaryOp.h:361
j
std::ptrdiff_t j
Definition:
tut_arithmetic_redux_minmax.cpp:2
l
static const Line3 l(Rot3(), 1, 1)
Eigen::internal::emptyIdxLU
@ emptyIdxLU
Definition:
SparseLU_Memory.h:38
min
#define min(a, b)
Definition:
datatypes.h:19
Eigen::Matrix< StorageIndex, Dynamic, 1 >
internal
Definition:
BandTriangularSolver.h:13
Eigen::PlainObjectBase::setZero
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition:
CwiseNullaryOp.h:562
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
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 Mon Apr 7 2025 03:03:32