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>
41 using CDiagonalXX = Eigen::DiagonalMatrix<complex_t, Eigen::Dynamic>;
44 using op_t = std::function<CMatrix1X(CMatrixDX,RMatrixD1)>;
61 const AbstractScalarHaWp<D, MultiIndex>& packet,
63 const dim_t n_nodes = QR::number_nodes();
64 const complex_t S_bra = pacbra.parameters().S();
65 const complex_t S_ket = packet.parameters().S();
68 std::tie(nodes, weights) = QR::nodes_and_weights();
71 std::pair<RMatrixD1, RMatrixDD> PImix = pacbra.parameters().mix(packet.parameters());
76 const CMatrixDX transformed_nodes = q0.template cast<complex_t>().replicate(1, n_nodes) + packet.eps() * (Qs.template cast<complex_t>() * nodes);
79 const CMatrix1X values = op(transformed_nodes, q0);
83 std::conj(pacbra.prefactor()) * packet.prefactor() * Qs.determinant() *
84 std::pow(packet.eps(), D) * weights.array() * values.array();
87 const CMatrixXX basisr = pacbra.evaluate_basis(transformed_nodes);
88 const CMatrixXX basisc = packet.evaluate_basis(transformed_nodes);
92 const CMatrixXX result = basisr.matrix().conjugate() * Dfactor * basisc.matrix().transpose();
95 const complex_t phase = std::exp(
complex_t(0,1) * (S_ket - std::conj(S_bra)) / std::pow(packet.eps(),2));
96 return phase * result;
106 const AbstractScalarHaWp<D, MultiIndex>& packet,
110 return pacbra.coefficients().adjoint() * M * packet.coefficients();
117 return CMatrix1X::Ones(1, nodes.cols());
Definition: coefficients_file_parser.cpp:10
Eigen::DiagonalMatrix< complex_t, Eigen::Dynamic > CDiagonalXX
Definition: inhomogeneous_inner_product.hpp:41
RMatrix< D, D > RMatrixDD
Definition: inhomogeneous_inner_product.hpp:39
Eigen::Matrix< real_t, R, C > RMatrix
Definition: types.hpp:22
std::complex< real_t > complex_t
Definition: types.hpp:15
CMatrix< Eigen::Dynamic, Eigen::Dynamic > CMatrixXX
Definition: inhomogeneous_inner_product.hpp:33
typename QR::NodeMatrix NodeMatrix
Definition: inhomogeneous_inner_product.hpp:42
static CMatrixXX build_matrix(const AbstractScalarHaWp< D, MultiIndex > &pacbra, const AbstractScalarHaWp< D, MultiIndex > &packet, const op_t &op=default_op)
Calculate the matrix of the inner product.
Definition: inhomogeneous_inner_product.hpp:60
CMatrix< D, 1 > CMatrixD1
Definition: inhomogeneous_inner_product.hpp:36
CMatrix< 1, Eigen::Dynamic > CMatrix1X
Definition: inhomogeneous_inner_product.hpp:34
Class providing inhomogeneous inner product calculation of scalar wavepackets.
Definition: inhomogeneous_inner_product.hpp:30
CMatrix< D, D > CMatrixDD
Definition: inhomogeneous_inner_product.hpp:37
std::function< CMatrix1X(CMatrixDX, RMatrixD1)> op_t
Definition: inhomogeneous_inner_product.hpp:44
CMatrix< Eigen::Dynamic, 1 > CMatrixX1
Definition: inhomogeneous_inner_product.hpp:35
static CMatrix1X default_op(const CMatrixDX &nodes, const RMatrixD1 &pos)
Definition: inhomogeneous_inner_product.hpp:114
RMatrix< D, 1 > RMatrixD1
Definition: inhomogeneous_inner_product.hpp:40
Eigen::Matrix< complex_t, R, C > CMatrix
Definition: types.hpp:19
CMatrix< D, Eigen::Dynamic > CMatrixDX
Definition: inhomogeneous_inner_product.hpp:38
typename QR::WeightVector WeightVector
Definition: inhomogeneous_inner_product.hpp:43
int dim_t
Definition: types.hpp:16
static complex_t quadrature(const AbstractScalarHaWp< D, MultiIndex > &pacbra, const AbstractScalarHaWp< D, MultiIndex > &packet, const op_t &op=default_op)
Perform quadrature.
Definition: inhomogeneous_inner_product.hpp:105