Template Class AdjointJacobianMPI¶
Defined in File AdjointJacobianGPUMPI.hpp
Inheritance Relationships¶
Base Type¶
public AdjointJacobianBase< StateVectorT, AdjointJacobianMPI< StateVectorT > >
Class Documentation¶
-
template<class StateVectorT>
class AdjointJacobianMPI : public AdjointJacobianBase<StateVectorT, AdjointJacobianMPI<StateVectorT>>¶ GPU-enabled adjoint Jacobian evaluator following the method of arXiv:2009.02823.
- Template Parameters
StateVectorT – State vector type.
Public Functions
-
AdjointJacobianMPI() = default¶
-
inline void adjointJacobian_serial(std::span<PrecisionT> jac, const JacobianDataMPI<StateVectorT> &jd, bool apply_operations = false)¶
Batches the adjoint_jacobian method over the available GPUs.
- Parameters
jac – Preallocated vector for Jacobian data results.
jd – JacobianData represents the QuantumTape to differentiate.
apply_operations – Indicate whether to apply operations to psi prior to calculation.
-
inline void adjointJacobian(std::span<PrecisionT> jac, const JacobianDataMPI<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
psiof lengthnum_elements, we make internal copies to aStateVectorCudaManaged<T>object, with one per required observable. Theoperationswill 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 orderedjacmatrix 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,
QubitUnitaryis 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.
ref_data – Reference to a
StateVectorTobject.apply_operations – Indicate whether to apply operations to psi prior to calculation.