SymGEigsRegInvOp.h
Go to the documentation of this file.
1 // Copyright (C) 2017-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_GEIGS_REG_INV_OP_H
8 #define SYM_GEIGS_REG_INV_OP_H
9 
10 #include <Eigen/Core>
11 #include "../SparseSymMatProd.h"
12 #include "../SparseRegularInverse.h"
13 
14 namespace Spectra {
15 
22 template <typename Scalar = double,
23  typename OpType = SparseSymMatProd<double>,
24  typename BOpType = SparseRegularInverse<double> >
26 {
27 private:
31 
32  OpType& m_op;
33  BOpType& m_Bop;
34  Vector m_cache; // temporary working space
35 
36 public:
43  SymGEigsRegInvOp(OpType& op, BOpType& Bop) :
44  m_op(op), m_Bop(Bop), m_cache(op.rows())
45  {}
46 
50  Index rows() const { return m_Bop.rows(); }
54  Index cols() const { return m_Bop.rows(); }
55 
62  // y_out = inv(B) * A * x_in
63  void perform_op(const Scalar* x_in, Scalar* y_out)
64  {
65  m_op.perform_op(x_in, m_cache.data());
66  m_Bop.solve(m_cache.data(), y_out);
67  }
68 };
69 
70 } // namespace Spectra
71 
72 #endif // SYM_GEIGS_REG_INV_OP_H
Spectra::SymGEigsRegInvOp::Matrix
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
Definition: SymGEigsRegInvOp.h:29
Spectra::SymGEigsRegInvOp::m_cache
Vector m_cache
Definition: SymGEigsRegInvOp.h:34
Spectra::SymGEigsRegInvOp::Vector
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: SymGEigsRegInvOp.h:30
Spectra::SymGEigsRegInvOp::SymGEigsRegInvOp
SymGEigsRegInvOp(OpType &op, BOpType &Bop)
Definition: SymGEigsRegInvOp.h:43
Spectra::SymGEigsRegInvOp::Index
Eigen::Index Index
Definition: SymGEigsRegInvOp.h:28
Spectra::SymGEigsRegInvOp::rows
Index rows() const
Definition: SymGEigsRegInvOp.h:50
Spectra::SymGEigsRegInvOp
Definition: SymGEigsRegInvOp.h:25
Spectra
Definition: LOBPCGSolver.h:19
Eigen::PlainObjectBase::data
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Scalar * data() const
Definition: PlainObjectBase.h:247
Spectra::SymGEigsRegInvOp::cols
Index cols() const
Definition: SymGEigsRegInvOp.h:54
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic >
Spectra::SymGEigsRegInvOp::perform_op
void perform_op(const Scalar *x_in, Scalar *y_out)
Definition: SymGEigsRegInvOp.h:63
Spectra::SymGEigsRegInvOp::m_op
OpType & m_op
Definition: SymGEigsRegInvOp.h:32
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
Spectra::SymGEigsRegInvOp::m_Bop
BOpType & m_Bop
Definition: SymGEigsRegInvOp.h:33


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:14:22