Template Class AdjointJacobian

Inheritance Relationships

Base Type

  • public AdjointJacobianBase< StateVectorT, AdjointJacobian< StateVectorT > >

Class Documentation

template<class StateVectorT>
class AdjointJacobian : public AdjointJacobianBase<StateVectorT, AdjointJacobian<StateVectorT>>

Adjoint Jacobian evaluator following the method of arXiV:2009.02823.

Template Parameters

StateVectorT – State vector type.

Public Functions

inline void adjointJacobian(std::span<PrecisionT> jac, const JacobianData<StateVectorT> &jd, [[maybe_unused]] const StateVectorT &ref_data = {0}, bool apply_operations = false)

Calculates the Jacobian for the statevector for the selected set of parametric gates.

For the statevector data associated with psi of length num_elements, we make internal copies, one per required observable. The operations will be applied to the internal statevector copies, with the operation indices participating in the gradient calculations given in trainableParams, and the overall number of parameters for the gradient calculation provided within num_params. The resulting row-major ordered jac matrix representation will be of size jd.getSizeStateVec() * jd.getObservables().size(). OpenMP is used to enable independent operations to be offloaded to threads.

Parameters
  • jac – Preallocated vector for Jacobian data results.

  • jd – JacobianData represents the QuantumTape to differentiate.

  • apply_operations – Indicate whether to apply operations to tape.psi prior to calculation.