Template Class Observable

Inheritance Relationships

Derived Types

Class Documentation

template<typename T>
class Observable

A base class for all observable classes.

We note that all subclasses must be immutable (does not provide any setter).

Template Parameters

T – Floating point type

Subclassed by Pennylane::Algorithms::Hamiltonian< T >, Pennylane::Algorithms::HermitianObs< T >, Pennylane::Algorithms::NamedObs< T >, Pennylane::Algorithms::TensorProdObs< T >

Public Functions

virtual ~Observable() = default
virtual void applyInPlace(StateVectorManagedCPU<T> &sv) const = 0

Apply the observable to the given statevector in place.

virtual auto getObsName() const -> std::string = 0

Get the name of the observable.

virtual auto getWires() const -> std::vector<size_t> = 0

Get the wires the observable applies to.

inline bool operator==(const Observable<T> &other) const

Test whether this object is equal to another object.

inline bool operator!=(const Observable<T> &other) const

Test whether this object is different from another object.

Protected Functions

Observable() = default
Observable(const Observable&) = default
Observable(Observable&&) noexcept = default
Observable &operator=(const Observable&) = default
Observable &operator=(Observable&&) noexcept = default