12 namespace wavepackets {
24 template<dim_t D,
class MultiIndex>
128 template<dim_t D,
class MultiIndex>
157 if (this->
shape()->n_entries() != (std::size_t)coefficients().size())
158 throw std::runtime_error(
"shape.size() != coefficients.size()");
160 return this->
template create_evaluator<N>(grid).reduce(coefficients());
179 return evaluate(cgrid);
208 template<dim_t D,
class MultiIndex>
264 return coefficients_;
269 return coefficients_;
291 template<dim_t D,
class MultiIndex>
311 : owner_(that.owner_)
312 , shape_(that.shape_)
313 , coefficients_(
std::move(that.coefficients_))
317 : owner_(that.owner_)
318 , shape_(that.shape_)
319 , coefficients_(that.coefficients_)
325 coefficients_ = std::move(that.coefficients_);
338 return owner_->eps();
343 return owner_->parameters();
370 return coefficients_;
375 return coefficients_;
454 return components_[n];
466 return components_[n];
498 return components_.size();
511 bool rebuild_cache =
false;
513 if (union_cache_snapshot_.size() != n_components()) {
514 rebuild_cache =
true;
515 union_cache_snapshot_.resize(n_components());
518 for (std::size_t n = 0; n < n_components() && !rebuild_cache; n++) {
519 if (union_cache_snapshot_[n] != component(n).shape().get())
520 rebuild_cache =
true;
525 std::vector< ShapeEnum<D,MultiIndex>
const* > list(n_components());
526 for (std::size_t
c = 0;
c < n_components();
c++) {
527 list[
c] = union_cache_snapshot_[
c] = component(
c).shape().get();
532 return cached_shape_union_;
561 unionwp.
shape() = union_shape();
563 std::vector< ShapeEnum<D,MultiIndex>* > shape_list(n_components());
564 std::vector< complex_t const* > coeffs_list(n_components());
566 for (std::size_t n = 0; n < n_components(); n++) {
567 shape_list[n] = component(n).shape().get();
568 coeffs_list[n] = component(n).coefficients().data();
571 return unionwp.template create_evaluator<N>(grid).vector_reduce(shape_list.data(), coeffs_list.data(), n_components());
594 return evaluate(cgrid);
618 template<dim_t D,
class MultiIndex>
640 : owner_(that.owner_)
641 , parameters_(
std::move(that.parameters_))
642 , shape_(that.shape_)
643 , coefficients_(
std::move(that.coefficients_))
647 : owner_(that.owner_)
648 , parameters_(that.parameters_)
649 , shape_(that.shape_)
650 , coefficients_(that.coefficients_)
655 parameters_ = std::move(that.parameters_);
656 shape_ = that.shape_;
657 coefficients_ = std::move(that.coefficients_);
675 return owner_->eps();
716 return coefficients_;
721 return coefficients_;
782 return components_[n];
794 return components_[n];
826 return components_.size();
850 for (std::size_t
c = 0;
c < n_components();
c++) {
851 result.row(
c) = component(
c).evaluate(grid);
877 return evaluate(cgrid);
real_t eps() const
Retrieves the semi-classical scaling parameter of the wavepacket.
Definition: hawp_commons.hpp:750
Definition: coefficients_file_parser.cpp:10
Coefficients coefficients_
Definition: hawp_commons.hpp:382
Coefficients coefficients_
Definition: hawp_commons.hpp:276
Represents a component of a homogeneous wavepacket.
Definition: hawp_commons.hpp:302
Component const & component(std::size_t n) const
Grants read-only access to the -th component .
Definition: hawp_commons.hpp:792
std::vector< ShapeEnum< D, MultiIndex > * > union_cache_snapshot_
Definition: hawp_commons.hpp:602
real_t eps_
Definition: hawp_commons.hpp:881
Coefficients & coefficients()
Grants writeable access to the coefficients of the wavepacket.
Definition: hawp_commons.hpp:262
real_t eps() const override
Retrieves the semi-classical scaling parameter of the wavepacket.
Definition: hawp_commons.hpp:221
shapes::ShapeEnumSharedPtr< D, MultiIndex > shape_
Definition: hawp_commons.hpp:275
virtual HaWpParamSet< D > const & parameters() const =0
Grants read-only access to the Hagedorn parameter set of the wavepacket.
HaWpParamSet< D > const & parameters() const override
Grants read-only access to the Hagedorn parameter set of the wavepacket.
Definition: hawp_commons.hpp:341
Eigen::Matrix< real_t, R, C > RMatrix
Definition: types.hpp:22
HaWpParamSet< D > & parameters()
Grants writeable access to the Hagedorn parameter set .
Definition: hawp_commons.hpp:681
real_t & eps()
Grants access to the semi-classical scaling parameter of the wavepacket.
Definition: hawp_commons.hpp:395
Eigen::Matrix< complex_t, Eigen::Dynamic, 1 > Coefficients
Definition: types.hpp:33
std::shared_ptr< ShapeEnum< D, MultiIndex > > ShapeEnumSharedPtr
Definition: shape_extension_cache.hpp:14
Represents a homogeneous Hagedorn wavepacket with components . All components share the same Hagedo...
Definition: hawp_commons.hpp:292
CArray< Eigen::Dynamic, N > evaluate(CMatrix< D, N > const &grid) const
Evaluate the value of all components at once.
Definition: hawp_commons.hpp:846
Component & operator[](std::size_t n)
Grants writeable access to the -th component .
Definition: hawp_commons.hpp:804
Output strict_union(Input1 begin1, Input1 end1, Input2 begin2, Input2 end2, Output sink, Compare less)
Creates union of two shape slices.
Definition: shape_enum_union.hpp:35
HomogeneousHaWp(std::size_t n)
Definition: hawp_commons.hpp:385
std::complex< real_t > complex_t
Definition: types.hpp:15
Definition: stdarray2stream.hpp:7
complex_t prefactor() const
Computes the prefactor .
Definition: hawp_commons.hpp:190
Component(Component const &that)
Definition: hawp_commons.hpp:646
HaWpParamSet< D > const & parameters() const override
Grants read-only access to the Hagedorn parameter set of the wavepacket.
Definition: hawp_commons.hpp:687
var c
Definition: jquery.js:23
Component & operator=(Component &&that)
Definition: hawp_commons.hpp:653
real_t & eps()
Grants access to the semi-classical scaling parameter of the wavepacket.
Definition: hawp_commons.hpp:741
real_t eps() const override
Retrieves the semi-classical scaling parameter of the wavepacket.
Definition: hawp_commons.hpp:336
CArray< Eigen::Dynamic, N > evaluate(CMatrix< D, N > const &grid) const
Evaluate the value of all components at once.
Definition: hawp_commons.hpp:555
double real_t
Definition: types.hpp:14
HaWpBasisVector< N > evaluate_basis(CMatrix< D, N > const &grid) const
Evaluates all basis functions on complex grid nodes .
Definition: hawp_commons.hpp:61
shapes::ShapeEnumSharedPtr< D, MultiIndex > & shape()
Grants access to the basis shape of the wavepacket.
Definition: hawp_commons.hpp:354
Coefficients & coefficients()
Grants writeable access to the coefficients of this wavepacket component.
Definition: hawp_commons.hpp:368
HomogeneousHaWp const *const owner_
Definition: hawp_commons.hpp:379
Component const & operator[](std::size_t n) const
Grants read-only access to the -th component .
Definition: hawp_commons.hpp:816
shapes::ShapeEnumSharedPtr< D, MultiIndex > cached_shape_union_
Definition: hawp_commons.hpp:603
Component const & operator[](std::size_t n) const
Grants read-only access to the -th component .
Definition: hawp_commons.hpp:488
Evaluates a wavepacket slice by slice.
Definition: hawp_evaluator.hpp:41
Component(HomogeneousHaWp const *const owner)
Definition: hawp_commons.hpp:305
InhomogeneousHaWp(std::size_t n)
Definition: hawp_commons.hpp:732
HaWpBasisVector< N > evaluate_basis(RMatrix< D, N > const &rgrid) const
Evaluates all basis functions on real grid nodes .
Definition: hawp_commons.hpp:79
shapes::ShapeEnumSharedPtr< D, MultiIndex > extended_shape() const
Computes the extension of the stored basis shape .
Definition: hawp_commons.hpp:104
Component const & component(std::size_t n) const
Grants read-only access to the -th component .
Definition: hawp_commons.hpp:464
Component & operator[](std::size_t n)
Grants writeable access to the -th component .
Definition: hawp_commons.hpp:476
HaWpParamSet< D > parameters_
Definition: hawp_commons.hpp:727
Component(Component &&that)
Definition: hawp_commons.hpp:310
shapes::ShapeExtensionCache< D, MultiIndex > shape_extension_cache_
Definition: hawp_commons.hpp:110
Component & operator=(Component const &that)
Definition: hawp_commons.hpp:661
Coefficients & coefficients()
Grants writeable access to the coefficients of this wavepacket component.
Definition: hawp_commons.hpp:714
real_t eps() const
Retrieves the semi-classical scaling parameter of the wavepacket.
Definition: hawp_commons.hpp:404
InhomogeneousHaWp const *const owner_
Definition: hawp_commons.hpp:725
shapes::ShapeEnumSharedPtr< D, MultiIndex > shape() const override
Retrieves the basis shape of the wavepacket.
Definition: hawp_commons.hpp:359
CArray< Eigen::Dynamic, N > evaluate(RMatrix< D, N > const &rgrid) const
Evaluates the value of all components at once.
Definition: hawp_commons.hpp:591
CArray< Eigen::Dynamic, N > evaluate(RMatrix< D, N > const &rgrid) const
Evaluates the value of all components at once.
Definition: hawp_commons.hpp:874
This class represents the Hagedorn parameter set .
Definition: hawp_paramset.hpp:24
Definition: shape_extension_cache.hpp:26
Component & operator=(Component &&that)
Definition: hawp_commons.hpp:322
real_t eps_
Definition: hawp_commons.hpp:273
Component(InhomogeneousHaWp const *const owner)
Definition: hawp_commons.hpp:633
CArray< Eigen::Dynamic, N > HaWpBasisVector
Definition: types.hpp:31
HaWpParamSet< D > parameters_
Definition: hawp_commons.hpp:274
Abstract superclass that represents a set of basis function to a scalar Hagedorn wavepacket.
Definition: hawp_commons.hpp:25
std::size_t n_components() const
Returns the number of components.
Definition: hawp_commons.hpp:496
HaWpParamSet< D > & parameters()
Grants writeable access to the Hagedorn parameter set of the wavepacket.
Definition: hawp_commons.hpp:230
real_t & eps()
Grants writeable access to the semi-classical scaling parameter of the wavepacket.
Definition: hawp_commons.hpp:216
shapes::ShapeEnumSharedPtr< D, MultiIndex > shape() const override
Retrieves the basis shape of the wavepacket.
Definition: hawp_commons.hpp:705
CArray< 1, N > evaluate(CMatrix< D, N > const &grid) const
Evaluates this wavepacket at complex grid nodes .
Definition: hawp_commons.hpp:155
HaWpParamSet< D > parameters_
Definition: hawp_commons.hpp:599
Represents an inhomogeneous Hagedorn wavepacket with components . All components have a different s...
Definition: hawp_commons.hpp:619
Component & operator=(Component const &that)
Definition: hawp_commons.hpp:329
Coefficients const & coefficients() const override
Grants read-only access to the coefficients for all of this wavepacket.
Definition: hawp_commons.hpp:719
virtual shapes::ShapeEnumSharedPtr< D, MultiIndex > shape() const =0
Retrieves the basis shape of the wavepacket.
HaWpParamSet< D > const & parameters() const
Grants read-only access to the Hagedorn parameter set of the wavepacket.
Definition: hawp_commons.hpp:422
Coefficients const & coefficients() const override
Grants read-only access to the coefficients for all of this wavepacket.
Definition: hawp_commons.hpp:267
Component(Component &&that)
Definition: hawp_commons.hpp:639
shapes::ShapeEnumSharedPtr< D, MultiIndex > & shape()
Grants access to the basis shape of the wavepacket.
Definition: hawp_commons.hpp:248
std::vector< Component > & components()
Grants writeable access to all components of this wavepacket.
Definition: hawp_commons.hpp:431
Component(Component const &that)
Definition: hawp_commons.hpp:316
Abstract superclass that represents a scalar (1-component) hagedorn wavepacket.
Definition: hawp_commons.hpp:129
Component & component(std::size_t n)
Grants writeable access to the -th component .
Definition: hawp_commons.hpp:780
std::vector< Component > & components()
Grants writeable access to all components of this wavepacket.
Definition: hawp_commons.hpp:759
shapes::ShapeEnumSharedPtr< D, MultiIndex > & shape()
Grants access to the basis shape of the wavepacket.
Definition: hawp_commons.hpp:700
complex_t phasefactor() const
Computes the global phase factor .
Definition: hawp_commons.hpp:198
Concrete implementation of a scalar Hagedorn wavepacket.
Definition: hawp_commons.hpp:209
Eigen::Matrix< complex_t, R, C > CMatrix
Definition: types.hpp:19
std::size_t n_components() const
Returns the number of components.
Definition: hawp_commons.hpp:824
std::vector< Component > components_
Definition: hawp_commons.hpp:600
shapes::ShapeEnumSharedPtr< D, MultiIndex > shape_
Definition: hawp_commons.hpp:381
std::vector< Component > const & components() const
Grants read-only access to all components of this wavepacket.
Definition: hawp_commons.hpp:768
virtual real_t eps() const =0
Retrieves the semi-classical scaling parameter of the wavepacket.
Component & component(std::size_t n)
Grants writeable access to the -th component .
Definition: hawp_commons.hpp:452
Coefficients coefficients_
Definition: hawp_commons.hpp:729
std::vector< Component > const & components() const
Grants read-only access to all components of this wavepacket.
Definition: hawp_commons.hpp:440
real_t eps_
Definition: hawp_commons.hpp:598
HaWpEvaluator< D, MultiIndex, N > create_evaluator(CMatrix< D, N > const &grid) const
Definition: hawp_commons.hpp:47
CArray< 1, N > evaluate(RMatrix< D, N > const &rgrid) const
Evaluates this wavepacket at real grid nodes .
Definition: hawp_commons.hpp:176
Represents a component of an inhomogeneous wavepacket .
Definition: hawp_commons.hpp:630
std::vector< Component > components_
Definition: hawp_commons.hpp:882
shapes::ShapeEnumSharedPtr< D, MultiIndex > shape_
Definition: hawp_commons.hpp:728
Coefficients const & coefficients() const override
Grants read-only access to the coefficients for all of this wavepacket.
Definition: hawp_commons.hpp:373
HaWpParamSet< D > const & parameters() const override
Grants read-only access to the Hagedorn parameter set of the wavepacket.
Definition: hawp_commons.hpp:235
HaWpParamSet< D > & parameters()
Grants writeable access to the Hagedorn parameter set of the wavepacket.
Definition: hawp_commons.hpp:413
shapes::ShapeEnumSharedPtr< D, MultiIndex > union_shape() const
Computes the union of basis shapes of all components.
Definition: hawp_commons.hpp:508
shapes::ShapeEnumSharedPtr< D, MultiIndex > shape() const override
Retrieves the basis shape of the wavepacket.
Definition: hawp_commons.hpp:253
Eigen::Array< complex_t, R, C > CArray
Definition: types.hpp:25
real_t eps() const override
Forwards the scaling parameter of the owning inhomogeneous wavepacket.
Definition: hawp_commons.hpp:673