12 namespace wavepackets {
21 template<dim_t D,
class MultiIndex>
35 const ShapeEnum<D,MultiIndex>* base_enum,
36 const ShapeEnum<D,MultiIndex>* grad_enum)
57 Eigen::Matrix<complex_t,D,D> Pbar = P.conjugate();
59 std::array<Coefficients, std::size_t(D) > grad_coeffs;
60 for (
dim_t d = 0; d < D; d++) {
65 for (
int i = 0; i <
grad_enum_->n_slices(); i++) {
67 #pragma omp parallel for 68 for (std::size_t j = 0; j <
grad_enum_->slice(i).size(); j++) {
69 MultiIndex curr_index =
grad_enum_->slice(i)[j];
73 std::size_t curr_ordinal = 0;
74 bool central_node_exists =
false;
76 if ( (central_node_exists =
base_enum_->slice(i).try_find(curr_index, curr_ordinal)) ) {
80 cc = base_coeffs[curr_ordinal];
84 Eigen::Matrix<complex_t,D,1> cb;
85 for (
dim_t d = 0; d < D; d++) {
86 if (curr_index[d] != 0) {
87 MultiIndex prev_index = curr_index; prev_index[d] -= 1;
89 std::size_t prev_ordinal = 0;
91 if (
base_enum_->slice(i-1).try_find(prev_index, prev_ordinal)) {
93 prev_ordinal +=
base_enum_->slice(i-1).offset();
95 cb[d] = base_coeffs[prev_ordinal] * std::sqrt(
real_t(curr_index[d]));
101 Eigen::Matrix<complex_t,D,1> cf;
102 if (central_node_exists && i+1 <
base_enum_->n_slices()) {
103 for (
dim_t d = 0; d < D; d++) {
104 MultiIndex next_index = curr_index; next_index[d] += 1;
106 std::size_t next_ordinal = 0;
108 if (
base_enum_->slice(i+1).try_find(next_index, next_ordinal)) {
110 next_ordinal +=
base_enum_->slice(i+1).offset();
112 cf[d] = base_coeffs[next_ordinal] * std::sqrt(
real_t(curr_index[d]+1));
117 Eigen::Matrix<complex_t,D,1> Pcc = p*cc;
118 Eigen::Matrix<complex_t,D,1> Pcf = Pbar*cf;
119 Eigen::Matrix<complex_t,D,1> Pcb = P*cb;
121 Eigen::Matrix<complex_t,D,1> bgrad = (Pcf + Pcb)*
eps_/std::sqrt(
real_t(2)) + Pcc;
123 for (
dim_t d = 0; d < D; d++) {
124 grad_coeffs[d][
grad_enum_->slice(i).offset() + j] = bgrad(d,0);
Definition: coefficients_file_parser.cpp:10
function p(by, bw, bv)
Definition: jquery.js:23
real_t eps_
Definition: hawp_gradient_evaluator.hpp:133
Eigen::Matrix< real_t, R, C > RMatrix
Definition: types.hpp:22
Eigen::Matrix< complex_t, Eigen::Dynamic, 1 > Coefficients
Definition: types.hpp:33
std::complex< real_t > complex_t
Definition: types.hpp:15
double real_t
Definition: types.hpp:14
HaWpGradientEvaluator(real_t eps, const HaWpParamSet< D > *parameters, const ShapeEnum< D, MultiIndex > *base_enum, const ShapeEnum< D, MultiIndex > *grad_enum)
Initialisation.
Definition: hawp_gradient_evaluator.hpp:33
std::array< Coefficients, std::size_t(D) > apply(const Coefficients &base_coeffs) const
Computes the coefficients of the gradient wavepacket.
Definition: hawp_gradient_evaluator.hpp:52
This class represents the Hagedorn parameter set .
Definition: hawp_paramset.hpp:24
const ShapeEnum< D, MultiIndex > * base_enum_
enumeration of basic shape
Definition: hawp_gradient_evaluator.hpp:140
const HaWpParamSet< D > * parameters_
Definition: hawp_gradient_evaluator.hpp:135
Eigen::Matrix< complex_t, R, C > CMatrix
Definition: types.hpp:19
const ShapeEnum< D, MultiIndex > * grad_enum_
enumeration of extended shape
Definition: hawp_gradient_evaluator.hpp:145
int dim_t
Definition: types.hpp:16
This class constructs the coefficients of the Hagedorn gradient wavepacket applied to an arbitrary s...
Definition: hawp_gradient_evaluator.hpp:22