gtsam
3rdparty
Eigen
Eigen
src
SparseLU
SparseLU_copy_to_ucol.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
* NOTE: This file is the modified version of [s,d,c,z]copy_to_ucol.c file in SuperLU
12
13
* -- SuperLU routine (version 2.0) --
14
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
15
* and Lawrence Berkeley National Lab.
16
* November 15, 1997
17
*
18
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
19
*
20
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
21
* EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
22
*
23
* Permission is hereby granted to use or copy this program for any
24
* purpose, provided the above notices are retained on all copies.
25
* Permission to modify the code and to distribute modified code is
26
* granted, provided the above notices are retained, and a notice that
27
* the code was modified is included with the above copyright notice.
28
*/
29
#ifndef SPARSELU_COPY_TO_UCOL_H
30
#define SPARSELU_COPY_TO_UCOL_H
31
32
namespace
Eigen
{
33
namespace
internal
{
34
49
template
<
typename
Scalar,
typename
StorageIndex>
50
Index
SparseLUImpl<Scalar,StorageIndex>::copy_to_ucol
(
const
Index
jcol,
const
Index
nseg,
IndexVector
& segrep,
51
BlockIndexVector
repfnz ,
IndexVector
& perm_r,
BlockScalarVector
dense,
GlobalLU_t
& glu)
52
{
53
Index
ksub, krep, ksupno;
54
55
Index
jsupno = glu.
supno
(jcol);
56
57
// For each nonzero supernode segment of U[*,j] in topological order
58
Index
k = nseg - 1,
i
;
59
StorageIndex nextu = glu.
xusub
(jcol);
60
Index
kfnz, isub, segsize;
61
Index
new_next,irow;
62
Index
fsupc, mem;
63
for
(ksub = 0; ksub < nseg; ksub++)
64
{
65
krep = segrep(k); k--;
66
ksupno = glu.
supno
(krep);
67
if
(jsupno != ksupno )
// should go into ucol();
68
{
69
kfnz = repfnz(krep);
70
if
(kfnz !=
emptyIdxLU
)
71
{
// Nonzero U-segment
72
fsupc = glu.
xsup
(ksupno);
73
isub = glu.
xlsub
(fsupc) + kfnz - fsupc;
74
segsize = krep - kfnz + 1;
75
new_next = nextu + segsize;
76
while
(new_next > glu.
nzumax
)
77
{
78
mem = memXpand<ScalarVector>(glu.
ucol
, glu.
nzumax
, nextu,
UCOL
, glu.
num_expansions
);
79
if
(mem)
return
mem;
80
mem = memXpand<IndexVector>(glu.
usub
, glu.
nzumax
, nextu,
USUB
, glu.
num_expansions
);
81
if
(mem)
return
mem;
82
83
}
84
85
for
(
i
= 0;
i
< segsize;
i
++)
86
{
87
irow = glu.
lsub
(isub);
88
glu.
usub
(nextu) = perm_r(irow);
// Unlike the L part, the U part is stored in its final order
89
glu.
ucol
(nextu) = dense(irow);
90
dense(irow) =
Scalar
(0.0);
91
nextu++;
92
isub++;
93
}
94
95
}
// end nonzero U-segment
96
97
}
// end if jsupno
98
99
}
// end for each segment
100
glu.
xusub
(jcol + 1) = nextu;
// close U(*,jcol)
101
return
0;
102
}
103
104
}
// namespace internal
105
}
// end namespace Eigen
106
107
#endif // SPARSELU_COPY_TO_UCOL_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::USUB
@ USUB
Definition:
SparseLU_Structs.h:74
Eigen::internal::UCOL
@ UCOL
Definition:
SparseLU_Structs.h:74
Eigen::internal::LU_GlobalLU_t::ucol
ScalarVector ucol
Definition:
SparseLU_Structs.h:87
Eigen::internal::SparseLUImpl::copy_to_ucol
Index copy_to_ucol(const Index jcol, const Index nseg, IndexVector &segrep, BlockIndexVector repfnz, IndexVector &perm_r, BlockScalarVector dense, GlobalLU_t &glu)
Performs numeric block updates (sup-col) in topological order.
Definition:
SparseLU_copy_to_ucol.h:50
Eigen::internal::LU_GlobalLU_t::xsup
IndexVector xsup
Definition:
SparseLU_Structs.h:79
Eigen::internal::LU_GlobalLU_t::num_expansions
Index num_expansions
Definition:
SparseLU_Structs.h:92
Eigen::Ref
A matrix or vector expression mapping an existing expression.
Definition:
Ref.h:281
Eigen::internal::LU_GlobalLU_t::supno
IndexVector supno
Definition:
SparseLU_Structs.h:80
Eigen::internal::emptyIdxLU
@ emptyIdxLU
Definition:
SparseLU_Memory.h:38
Eigen::internal::LU_GlobalLU_t::nzumax
Index nzumax
Definition:
SparseLU_Structs.h:90
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::usub
IndexVector usub
Definition:
SparseLU_Structs.h:88
Eigen::internal::LU_GlobalLU_t
Definition:
SparseLU_Structs.h:77
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
Eigen::internal::LU_GlobalLU_t::xusub
IndexVector xusub
Definition:
SparseLU_Structs.h:89
Scalar
SCALAR Scalar
Definition:
bench_gemm.cpp:46
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 Sat Nov 16 2024 04:04:32