DenseHermMatProd.h
Go to the documentation of this file.
1 // Copyright (C) 2024-2025 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 SPECTRA_DENSE_HERM_MAT_PROD_H
8 #define SPECTRA_DENSE_HERM_MAT_PROD_H
9 
10 #include <Eigen/Core>
11 
12 namespace Spectra {
13 
29 template <typename Scalar_, int Uplo = Eigen::Lower, int Flags = Eigen::ColMajor>
31 {
32 public:
36  using Scalar = Scalar_;
37 
38 private:
45 
47 
48 public:
57  template <typename Derived>
59  m_mat(mat)
60  {
61  static_assert(
62  static_cast<int>(Derived::PlainObject::IsRowMajor) == static_cast<int>(Matrix::IsRowMajor),
63  "DenseHermMatProd: the \"Flags\" template parameter does not match the input matrix (Eigen::ColMajor/Eigen::RowMajor)");
64  }
65 
69  Index rows() const { return m_mat.rows(); }
73  Index cols() const { return m_mat.cols(); }
74 
81  // y_out = A * x_in
82  void perform_op(const Scalar* x_in, Scalar* y_out) const
83  {
84  MapConstVec x(x_in, m_mat.cols());
85  MapVec y(y_out, m_mat.rows());
86  y.noalias() = m_mat.template selfadjointView<Uplo>() * x;
87  }
88 };
89 
90 } // namespace Spectra
91 
92 #endif // SPECTRA_DENSE_HERM_MAT_PROD_H
Spectra::DenseHermMatProd::cols
Index cols() const
Definition: DenseHermMatProd.h:73
Spectra::DenseHermMatProd< double >::Index
Eigen::Index Index
Definition: DenseHermMatProd.h:39
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
Spectra::DenseHermMatProd::m_mat
ConstGenericMatrix m_mat
Definition: DenseHermMatProd.h:46
Spectra::DenseHermMatProd::rows
Index rows() const
Definition: DenseHermMatProd.h:69
mat
MatrixXf mat
Definition: Tutorial_AdvancedInitialization_CommaTemporary.cpp:1
Spectra::DenseHermMatProd< double >::Scalar
double Scalar
Definition: DenseHermMatProd.h:36
Spectra::DenseHermMatProd::perform_op
void perform_op(const Scalar *x_in, Scalar *y_out) const
Definition: DenseHermMatProd.h:82
Spectra::DenseHermMatProd
Definition: DenseHermMatProd.h:30
Eigen::Map
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:94
y
Scalar * y
Definition: level1_cplx_impl.h:124
Eigen::Ref< const Matrix >
Spectra
Definition: LOBPCGSolver.h:19
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
Spectra::DenseHermMatProd::DenseHermMatProd
DenseHermMatProd(const Eigen::MatrixBase< Derived > &mat)
Definition: DenseHermMatProd.h:58
Eigen::MatrixBase
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
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 Thu Apr 10 2025 03:01:21