Template Class JacobianData

Inheritance Relationships

Derived Type

Class Documentation

template<class StateVectorT>
class JacobianData

Represent the serialized data of a QuantumTape to differentiate.

Template Parameters

StateVectorT

Subclassed by Pennylane::Algorithms::JacobianDataMPI< StateVectorT >

Public Functions

JacobianData(const JacobianData&) = default
JacobianData(JacobianData&&) noexcept = default
JacobianData &operator=(const JacobianData&) = default
JacobianData &operator=(JacobianData&&) noexcept = default
virtual ~JacobianData() = default
inline JacobianData(std::size_t num_params, std::size_t num_elem, const CFP_t *sv_ptr, std::vector<std::shared_ptr<Observable<StateVectorT>>> obs, OpsData<StateVectorT> ops, std::vector<std::size_t> trainP)

Construct a JacobianData object.

Each value \(i\) in trainable params means that we want to take a derivative respect to the \(i\)-th operation.

Further note that ops does not contain state preparation operations (e.g. StatePrep) or Hamiltonian coefficients.

Parameters
  • num_params – Number of parameters in the Tape.

  • num_elem – Length of the statevector data.

  • ps – Pointer to the statevector data.

  • obs – Observables for which to calculate Jacobian.

  • ops – Operations used to create given state.

  • trainP – Sorted list of parameters participating in Jacobian computation.

inline auto getNumParams() const -> std::size_t

Get Number of parameters in the Tape.

Returns

std::size_t

inline auto getSizeStateVec() const -> std::size_t

Get the length of the statevector data.

Returns

std::size_t

inline auto getPtrStateVec() const -> const CFP_t*

Get the pointer to the statevector data.

Returns

CFP_t *

inline auto getObservables() const -> const std::vector<std::shared_ptr<Observable<StateVectorT>>>&

Get observables for which to calculate Jacobian.

Returns

List of observables

inline auto getNumObservables() const -> std::size_t

Get the number of observables for which to calculate Jacobian.

Returns

std::size_t

inline auto getOperations() const -> const OpsData<StateVectorT>&

Get operations used to create given state.

Returns

OpsData<StateVectorT>&

inline auto getTrainableParams() const -> const std::vector<std::size_t>&

Get list of parameters participating in Jacobian calculation.

Returns

std::vector<std::size_t>&

inline auto hasTrainableParams() const -> bool

Get if the number of parameters participating in Jacobian calculation is zero.

Returns

true If it has trainable parameters; false otherwise.