Template Class HamiltonianTNCuda

Inheritance Relationships

Base Type

Class Documentation

template<class TensorNetT>
class HamiltonianTNCuda : public Pennylane::LightningTensor::TNCuda::Observables::ObservableTNCuda<TensorNetT>

Hamiltonian representation as a sum of observables.

Template Parameters

TensorNetT – tensor network class.

Public Types

using BaseType = ObservableTNCuda<TensorNetT>
using PrecisionT = typename TensorNetT::PrecisionT

Public Functions

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

Create a Hamiltonian from coefficients and observables.

Parameters
  • coeffs – Arguments to construct coefficients

  • obs – Arguments to construct observables

inline virtual auto getWires() const -> std::vector<std::size_t> override

Get the wires the observable applies to.

inline virtual auto getObsName() const -> std::string override

Get the name of the observable.

inline auto getObs() const -> std::vector<std::shared_ptr<ObservableTNCuda<TensorNetT>>>

Get the observable.

inline auto getCoeffs() const -> std::vector<PrecisionT>

Get the coefficients of the observable.

Public Static Functions

static inline auto create(std::initializer_list<PrecisionT> coeffs, std::initializer_list<std::shared_ptr<ObservableTNCuda<TensorNetT>>> obs) -> std::shared_ptr<HamiltonianTNCuda<TensorNetT>>

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 – Arguments to construct coefficients

  • obs – Arguments to construct observables

Returns

std::shared_ptr<HamiltonianTNCuda<TensorNetT>>