gtsam
3rdparty
Spectra
SymEigsShiftSolver.h
Go to the documentation of this file.
1
// Copyright (C) 2016-2019 Yixuan Qiu <yixuan.qiu@cos.name>
2
//
3
// This Source Code Form is subject to the terms of the Mozilla
4
// Public License v. 2.0. If a copy of the MPL was not distributed
5
// with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
7
#ifndef SYM_EIGS_SHIFT_SOLVER_H
8
#define SYM_EIGS_SHIFT_SOLVER_H
9
10
#include <Eigen/Core>
11
12
#include "
SymEigsBase.h
"
13
#include "
Util/SelectionRule.h
"
14
#include "
MatOp/DenseSymShiftSolve.h
"
15
16
namespace
Spectra
{
17
155
template
<
typename
Scalar
= double,
156
int
SelectionRule =
LARGEST_MAGN
,
157
typename
OpType = DenseSymShiftSolve<double> >
158
class
SymEigsShiftSolver
:
public
SymEigsBase
<Scalar, SelectionRule, OpType, IdentityBOp>
159
{
160
private
:
161
typedef
Eigen::Index
Index
;
162
typedef
Eigen::Array<Scalar, Eigen::Dynamic, 1>
Array
;
163
164
const
Scalar
m_sigma
;
165
166
// First transform back the Ritz values, and then sort
167
void
sort_ritzpair
(
int
sort_rule)
168
{
169
Array
m_ritz_val_org =
Scalar
(1.0) / this->
m_ritz_val
.head(this->
m_nev
).array() +
m_sigma
;
170
this->
m_ritz_val
.head(this->
m_nev
) = m_ritz_val_org;
171
SymEigsBase<Scalar, SelectionRule, OpType, IdentityBOp>::sort_ritzpair
(sort_rule);
172
}
173
174
public
:
193
SymEigsShiftSolver
(OpType* op,
Index
nev,
Index
ncv,
Scalar
sigma
) :
194
SymEigsBase
<
Scalar
, SelectionRule, OpType,
IdentityBOp
>(op,
NULL
, nev, ncv),
195
m_sigma
(
sigma
)
196
{
197
this->
m_op
->
set_shift
(m_sigma);
198
}
199
};
200
201
}
// namespace Spectra
202
203
#endif // SYM_EIGS_SHIFT_SOLVER_H
Spectra::SymEigsShiftSolver::Array
Eigen::Array< Scalar, Eigen::Dynamic, 1 > Array
Definition:
SymEigsShiftSolver.h:162
SymEigsBase.h
Spectra::SymEigsBase
Definition:
SymEigsBase.h:44
Eigen::Array
General-purpose arrays with easy API for coefficient-wise operations.
Definition:
Array.h:45
DenseSymShiftSolve.h
Spectra::SymEigsShiftSolver::Index
Eigen::Index Index
Definition:
SymEigsShiftSolver.h:161
sampling::sigma
static const double sigma
Definition:
testGaussianBayesNet.cpp:170
Spectra::IdentityBOp
Definition:
ArnoldiOp.h:90
Spectra::DenseSymShiftSolve::set_shift
void set_shift(Scalar sigma)
Definition:
DenseSymShiftSolve.h:68
Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymShiftSolve< double >, IdentityBOp >::m_ritz_val
Vector m_ritz_val
Definition:
SymEigsBase.h:70
Spectra::LARGEST_MAGN
@ LARGEST_MAGN
Definition:
SelectionRule.h:32
SelectionRule.h
Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymShiftSolve< double >, IdentityBOp >::m_op
DenseSymShiftSolve< double > * m_op
Definition:
SymEigsBase.h:61
Spectra::SymEigsShiftSolver
Definition:
SymEigsShiftSolver.h:158
Spectra::SymEigsBase::sort_ritzpair
virtual void sort_ritzpair(int sort_rule)
Definition:
SymEigsBase.h:194
Spectra
Definition:
LOBPCGSolver.h:19
Spectra::SymEigsShiftSolver::SymEigsShiftSolver
SymEigsShiftSolver(OpType *op, Index nev, Index ncv, Scalar sigma)
Definition:
SymEigsShiftSolver.h:193
Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymShiftSolve< double >, IdentityBOp >::m_nev
const Index m_nev
Definition:
SymEigsBase.h:64
NULL
#define NULL
Definition:
ccolamd.c:609
Spectra::SymEigsShiftSolver::m_sigma
const Scalar m_sigma
Definition:
SymEigsShiftSolver.h:164
Spectra::SymEigsShiftSolver::sort_ritzpair
void sort_ritzpair(int sort_rule)
Definition:
SymEigsShiftSolver.h:167
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:05:22