SymGEigsCholeskyOp.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_GEIGS_CHOLESKY_OP_H
8 #define SYM_GEIGS_CHOLESKY_OP_H
9 
10 #include <Eigen/Core>
11 #include "../DenseSymMatProd.h"
12 #include "../DenseCholesky.h"
13 
14 namespace Spectra {
15 
24 template <typename Scalar = double,
25  typename OpType = DenseSymMatProd<double>,
26  typename BOpType = DenseCholesky<double> >
28 {
29 private:
33 
34  OpType& m_op;
35  BOpType& m_Bop;
36  Vector m_cache; // temporary working space
37 
38 public:
45  SymGEigsCholeskyOp(OpType& op, BOpType& Bop) :
46  m_op(op), m_Bop(Bop), m_cache(op.rows())
47  {}
48 
52  Index rows() const { return m_Bop.rows(); }
56  Index cols() const { return m_Bop.rows(); }
57 
64  // y_out = inv(L) * A * inv(L') * x_in
65  void perform_op(const Scalar* x_in, Scalar* y_out)
66  {
67  m_Bop.upper_triangular_solve(x_in, y_out);
68  m_op.perform_op(y_out, m_cache.data());
69  m_Bop.lower_triangular_solve(m_cache.data(), y_out);
70  }
71 };
72 
73 } // namespace Spectra
74 
75 #endif // SYM_GEIGS_CHOLESKY_OP_H
Spectra::SymGEigsCholeskyOp::rows
Index rows() const
Definition: SymGEigsCholeskyOp.h:52
Spectra::SymGEigsCholeskyOp::m_Bop
BOpType & m_Bop
Definition: SymGEigsCholeskyOp.h:35
Spectra::SymGEigsCholeskyOp::Vector
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: SymGEigsCholeskyOp.h:32
Spectra::SymGEigsCholeskyOp::cols
Index cols() const
Definition: SymGEigsCholeskyOp.h:56
Spectra::SymGEigsCholeskyOp::SymGEigsCholeskyOp
SymGEigsCholeskyOp(OpType &op, BOpType &Bop)
Definition: SymGEigsCholeskyOp.h:45
Spectra::SymGEigsCholeskyOp::m_op
OpType & m_op
Definition: SymGEigsCholeskyOp.h:34
Spectra::SymGEigsCholeskyOp::perform_op
void perform_op(const Scalar *x_in, Scalar *y_out)
Definition: SymGEigsCholeskyOp.h:65
Spectra::SymGEigsCholeskyOp
Definition: SymGEigsCholeskyOp.h:27
Spectra::SymGEigsCholeskyOp::Index
Eigen::Index Index
Definition: SymGEigsCholeskyOp.h:30
Spectra::SymGEigsCholeskyOp::Matrix
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
Definition: SymGEigsCholeskyOp.h:31
Spectra
Definition: LOBPCGSolver.h:19
Eigen::PlainObjectBase::data
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Scalar * data() const
Definition: PlainObjectBase.h:247
Spectra::SymGEigsCholeskyOp::m_cache
Vector m_cache
Definition: SymGEigsCholeskyOp.h:36
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic >
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 Sun Dec 22 2024 04:14:22