Template Class Hamiltonian¶
Defined in File Observables.hpp
Inheritance Relationships¶
Base Type¶
public Pennylane::Algorithms::Observable< T >
(Template Class Observable)
Class Documentation¶
-
template<typename T>
class Hamiltonian : public Pennylane::Algorithms::Observable<T>¶ General Hamiltonian as a sum of observables.
TODO: Check whether caching a sparse matrix representation can give a speedup
Public Functions
-
template<typename T1, typename T2>
inline Hamiltonian(T1 &&arg1, T2 &&arg2)¶ Create a Hamiltonian from coefficients and observables.
- Parameters
arg1 – Arguments to construct coefficients
arg2 – Arguments to construct observables
-
inline virtual void applyInPlace(StateVectorManagedCPU<T> &sv) const override¶
Apply the observable to the given statevector in place.
-
inline virtual auto getWires() const -> std::vector<size_t> override¶
Get the wires the observable applies to.
-
inline virtual auto getObsName() const -> std::string override¶
Get the name of the observable.
Public Static Functions
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
arg1 – Argument to construct coefficients
arg2 – Argument to construct terms
-
template<typename T1, typename T2>