Template Struct ApplyCRY¶
Defined in File ApplyCRY.hpp
Struct Documentation¶
-
template<typename PrecisionT, std::size_t packed_size>
struct ApplyCRY¶ Public Types
-
using Precision = PrecisionT¶
-
using PrecisionAVXConcept = AVXConceptType<PrecisionT, packed_size>¶
Public Static Functions
-
template<std::size_t control, std::size_t target>
static inline consteval auto applyInternalInternalPermutation()¶ Permutation for (2). Flip the target bit if control bit is 1.
We implement CRY gate by dividing the matrix into diagonal and off-diagonal parts. The matrix is written as: [1 0 0 0 ] [0 1 0 0 ] [0 0 cos(phi/2) -sin(phi/2) ] [0 0 sin(phi/2) cos(phi/2) ]
Applying the matrix to a vector v, we thus (1) compute [v[0], v[1], cos(phi/2) v[2], cos(phi/2) v[3]] (2) compute [0, 0, -sin(phi/2) v[3], sin(phi/2) v[2])] and sum them.
Functions related to (1) contains “Diag” in the name whereas those related to (2) contains “OffDiang”.
-
template<std::size_t control, std::size_t target, class ParamT>
static inline auto applyInternalInternalOffDiagFactor(ParamT angle)¶ Factor for (2). [0, 0, 0, 0, -sin(phi/2), -sin(phi/2), sin(phi/2), sin(phi/2)].
-
template<std::size_t control, std::size_t target, class ParamT>
static inline auto applyInternalInternalDiagFactor(ParamT angle)¶
-
template<std::size_t control, std::size_t target, class ParamT>
static inline void applyInternalInternal(std::complex<PrecisionT> *arr, std::size_t num_qubits, bool inverse, ParamT angle)¶
-
template<std::size_t control, typename ParamT>
static inline auto applyInternalExternalDiagFactor(ParamT angle)¶ Factor for (1). [1, 1, 1, 1, cos(phi/2), cos(phi/2), cos(phi/2), cos(phi/2)].
-
template<std::size_t control, typename ParamT>
static inline auto applyInternalExternalOffDiagFactor(ParamT angle)¶ Factor for (2) when the target bit is 1.
-
template<std::size_t control, typename ParamT>
static inline void applyInternalExternal(std::complex<PrecisionT> *arr, std::size_t num_qubits, std::size_t target, bool inverse, ParamT angle)¶ Implementation for the case where the control qubit acts on internal wires (inside of packed bytes) but the target acts on external wires.
-
template<std::size_t target, typename ParamT>
static inline auto applyExternalInternalOffDiagFactor(ParamT angle)¶ Factor for (2) when the control bit is 1.
-
template<std::size_t target, typename ParamT>
static inline void applyExternalInternal(std::complex<PrecisionT> *arr, std::size_t num_qubits, std::size_t control, bool inverse, ParamT angle)¶
-
template<typename ParamT>
static inline void applyExternalExternal(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::size_t control, const std::size_t target, bool inverse, ParamT angle)¶
Public Static Attributes
-
static constexpr auto packed_size_ = packed_size¶
-
static constexpr bool symmetric = false¶
-
using Precision = PrecisionT¶