10 #include <Eigen/Dense> 11 #include <unsupported/Eigen/MatrixFunctions> 13 #include "../types.hpp" 14 #include "../wavepackets/hawp_commons.hpp" 18 namespace innerproducts {
19 using wavepackets::AbstractScalarHaWp;
29 template<dim_t D,
class MultiIndex,
class QR>
40 using CDiagonalXX = Eigen::DiagonalMatrix<complex_t, Eigen::Dynamic>;
43 using op_t = std::function<CMatrix1X(CMatrixDX,RMatrixD1)>;
60 const dim_t n_nodes = QR::number_nodes();
61 const CMatrixD1& q = packet.parameters().q().template cast<complex_t>();
62 const CMatrixDD& Q = packet.parameters().Q();
65 std::tie(nodes, weights) = QR::nodes_and_weights();
68 const CMatrixDD Qs = (Q * Q.adjoint()).sqrt();
71 const CMatrixDX transformed_nodes = q.replicate(1, n_nodes) + packet.eps() * (Qs * nodes);
74 const CMatrix1X values = op(transformed_nodes, packet.parameters().q());
79 std::pow(packet.eps(), D) * weights.array() * values.array();
82 const CMatrixXX basis = packet.evaluate_basis(transformed_nodes);
86 const CMatrixXX result = basis.matrix().conjugate() * Dfactor * basis.matrix().transpose();
102 return packet.coefficients().adjoint() * M * packet.coefficients();
109 return CMatrix1X::Ones(1, nodes.cols());
static complex_t quadrature(const AbstractScalarHaWp< D, MultiIndex > &packet, const op_t &op=default_op)
Perform quadrature.
Definition: homogeneous_inner_product.hpp:98
Definition: coefficients_file_parser.cpp:10
Eigen::Matrix< real_t, R, C > RMatrix
Definition: types.hpp:22
std::complex< real_t > complex_t
Definition: types.hpp:15
typename QR::WeightVector WeightVector
Definition: homogeneous_inner_product.hpp:42
Class providing homogeneous inner product calculation of scalar wavepackets.
Definition: homogeneous_inner_product.hpp:30
CMatrix< Eigen::Dynamic, Eigen::Dynamic > CMatrixXX
Definition: homogeneous_inner_product.hpp:33
CMatrix< D, D > CMatrixDD
Definition: homogeneous_inner_product.hpp:37
CMatrix< Eigen::Dynamic, 1 > CMatrixX1
Definition: homogeneous_inner_product.hpp:35
static CMatrixXX build_matrix(const AbstractScalarHaWp< D, MultiIndex > &packet, const op_t &op=default_op)
Calculate the matrix of the inner product.
Definition: homogeneous_inner_product.hpp:58
CMatrix< D, Eigen::Dynamic > CMatrixDX
Definition: homogeneous_inner_product.hpp:38
RMatrix< D, 1 > RMatrixD1
Definition: homogeneous_inner_product.hpp:39
CMatrix< D, 1 > CMatrixD1
Definition: homogeneous_inner_product.hpp:36
Eigen::Matrix< complex_t, R, C > CMatrix
Definition: types.hpp:19
std::function< CMatrix1X(CMatrixDX, RMatrixD1)> op_t
Definition: homogeneous_inner_product.hpp:43
typename QR::NodeMatrix NodeMatrix
Definition: homogeneous_inner_product.hpp:41
int dim_t
Definition: types.hpp:16
static CMatrix1X default_op(const CMatrixDX &nodes, const RMatrixD1 &pos)
Definition: homogeneous_inner_product.hpp:106
Eigen::DiagonalMatrix< complex_t, Eigen::Dynamic > CDiagonalXX
Definition: homogeneous_inner_product.hpp:40
CMatrix< 1, Eigen::Dynamic > CMatrix1X
Definition: homogeneous_inner_product.hpp:34