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"
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:
163 
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;
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
Eigen::Array< Scalar, Eigen::Dynamic, 1 > Array
SCALAR Scalar
Definition: bench_gemm.cpp:46
virtual void sort_ritzpair(int sort_rule)
Definition: SymEigsBase.h:194
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
#define NULL
Definition: ccolamd.c:609
static const double sigma
SymEigsShiftSolver(OpType *op, Index nev, Index ncv, Scalar sigma)
void sort_ritzpair(int sort_rule)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:36:35