Template Class Hamiltonian

Inheritance Relationships

Base Type

  • public HamiltonianBase< StateVectorT >

Class Documentation

template<class StateVectorT>
class Hamiltonian : public HamiltonianBase<StateVectorT>

General Hamiltonian as a sum of observables.

Public Types

using PrecisionT = typename StateVectorT::PrecisionT
using ComplexT = typename StateVectorT::ComplexT

Public Functions

template<typename T1, typename T2>
inline explicit Hamiltonian(T1 &&coeffs, T2 &&obs)

Create a Hamiltonian from coefficients and observables.

Parameters
  • coeffs – Arguments to construct coefficients

  • obs – Arguments to construct observables

inline void applyInPlace(StateVectorT &sv) const override

Public Static Functions

static inline auto create(std::initializer_list<PrecisionT> coeffs, std::initializer_list<std::shared_ptr<Observable<StateVectorT>>> obs) -> std::shared_ptr<Hamiltonian<StateVectorT>>

Convenient wrapper for the constructor as the constructor does not convert the std::shared_ptr with a derived class correctly.

This function is useful as std::make_shared does not handle brace-enclosed initializer list correctly.

Parameters
  • coeffs – Argument to construct coefficients

  • obs – Argument to construct terms