Template Class AdjointJacobian¶
Defined in File AdjointJacobianKokkos.hpp
Inheritance Relationships¶
Base Type¶
public AdjointJacobianBase< StateVectorT, AdjointJacobian< StateVectorT > >
Class Documentation¶
-
template<class StateVectorT>
class AdjointJacobian : public AdjointJacobianBase<StateVectorT, AdjointJacobian<StateVectorT>>¶ Kokkos-enabled adjoint Jacobian evaluator following the method of arXiV:2009.02823.
- Template Parameters
StateVectorT – State vector type.
Public Functions
-
AdjointJacobian() = default¶
-
inline void adjointJacobian(std::span<PrecisionT> jac, const JacobianData<StateVectorT> &jd, const StateVectorT &ref_data, 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 lengthnum_elements
, we make internal copies, one per required observable. Theoperations
will be applied to the internal statevector copies, with the operation indices participating in the gradient calculations given intrainableParams
, and the overall number of parameters for the gradient calculation provided withinnum_params
. The resulting row-major orderedjac
matrix representation will be of sizejd.getSizeStateVec() * jd.getObservables().size()
. OpenMP is used to enable independent operations to be offloaded to threads.Note
Only gates with pre-defined generators can be differentiated. For example,
QubitUnitary
is not differentiable as there is no generator defined for this gate.- 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.