Template Struct ApplyCRX¶
Defined in File ApplyCRX.hpp
Struct Documentation¶
-
template<typename PrecisionT, std::size_t packed_size>
struct ApplyCRX¶ 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). After applying this permutation, the array will be [Re(v[0]), Im(v[0]), Re(v[1]), Im(v[1]), Im(v[3]), Re(v[3]), Im(v[2]), Re(v[2])].
We implement CRX 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) -i sin(phi/2)] [0 0 -i 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, -i sin(phi/2) v[3], -i 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)¶ Factor for (1) [1, 1, 1, 1, cos(phi/2), cos(phi/2), cos(phi/2), cos(phi/2)].
-
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) when the target bit is 0/1.
-
template<std::size_t control, typename ParamT>
static inline auto applyInternalExternalOffDiagFactor(ParamT angle)¶ Factor for (2) when the target bit is 0/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>
static inline consteval auto applyExternalInternalOffDiagPerm()¶ Permutation that flips the target bit.
-
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¶