Class GateImplementationsPI¶
Defined in File GateImplementationsPI.hpp
Inheritance Relationships¶
Base Type¶
public Pennylane::LightningQubit::Gates::PauliGenerator< GateImplementationsPI >
(Template Class PauliGenerator)
Class Documentation¶
-
class GateImplementationsPI : public Pennylane::LightningQubit::Gates::PauliGenerator<GateImplementationsPI>¶
Kernel functions for gate operations with precomputed indices.
For given wires, we first compute the indices the gate applies to and use the computed indices to apply the operation.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data.
Public Static Functions
-
template<class PrecisionT>
static inline void applySingleQubitOp(std::complex<PrecisionT> *arr, size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<size_t> &wires, bool inverse = false)¶ Apply a single qubit gate to the statevector.
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
matrix – Perfect square matrix in row-major order.
wires – Wires the gate applies to.
inverse – Indicate whether inverse should be taken.
-
template<class PrecisionT>
static inline void applyTwoQubitOp(std::complex<PrecisionT> *arr, size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<size_t> &wires, bool inverse = false)¶ Apply a two qubit gate to the statevector.
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
matrix – Perfect square matrix in row-major order.
wires – Wires the gate applies to.
inverse – Indicate whether inverse should be taken.
-
template<class PrecisionT>
static inline void applyMultiQubitOp(std::complex<PrecisionT> *arr, size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<size_t> &wires, bool inverse)¶ Apply a given matrix directly to the statevector.
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
matrix – Perfect square matrix in row-major order.
wires – Wires the gate applies to.
inverse – Indicate whether inverse should be taken.
-
template<class PrecisionT>
static inline void applyIdentity(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyPauliX(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyPauliY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyPauliZ(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyHadamard(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyS(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse)¶
-
template<class PrecisionT>
static inline void applyT(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyPhaseShift(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyRX(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyRY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyRZ(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyRot(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT phi, ParamT theta, ParamT omega)¶
-
template<class PrecisionT>
static inline void applyCNOT(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyCY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyCZ(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applySWAP(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyIsingXX(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyIsingXY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyIsingYY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyIsingZZ(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyControlledPhaseShift(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyCRX(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyCRY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyCRZ(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyCRot(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, bool inverse, ParamT phi, ParamT theta, ParamT omega)¶
-
template<class PrecisionT>
static inline void applyToffoli(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyCSWAP(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static void applyDoubleExcitation(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static void applyDoubleExcitationMinus(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static void applyDoubleExcitationPlus(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyMultiRZ(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool inverse, ParamT angle)¶
-
template<class PrecisionT>
static inline auto applyGeneratorPhaseShift(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorCRX(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorIsingXX(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorIsingXY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorIsingYY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorIsingZZ(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorCRY(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorCRZ(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorControlledPhaseShift(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static auto applyGeneratorDoubleExcitation(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static auto applyGeneratorDoubleExcitationMinus(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static auto applyGeneratorDoubleExcitationPlus(std::complex<PrecisionT> *arr, size_t num_qubits, const std::vector<size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
Public Static Attributes
-
static constexpr KernelType kernel_id = KernelType::PI¶
-
static constexpr std::string_view name = "PI"¶
-
template<typename PrecisionT>
static constexpr size_t required_alignment = std::alignment_of_v<PrecisionT>¶
-
template<typename PrecisionT>
static constexpr uint32_t packed_bytes = sizeof(PrecisionT)¶
-
static constexpr std::array implemented_gates¶
-
static constexpr std::array implemented_generators = {GeneratorOperation::PhaseShift, GeneratorOperation::RX, GeneratorOperation::RY, GeneratorOperation::RZ, GeneratorOperation::IsingXX, GeneratorOperation::IsingXY, GeneratorOperation::IsingYY, GeneratorOperation::IsingZZ, GeneratorOperation::CRX, GeneratorOperation::CRY, GeneratorOperation::CRZ, GeneratorOperation::ControlledPhaseShift, GeneratorOperation::DoubleExcitation, GeneratorOperation::DoubleExcitationMinus, GeneratorOperation::DoubleExcitationPlus,}¶
-
static constexpr std::array implemented_matrices = {MatrixOperation::SingleQubitOp, MatrixOperation::TwoQubitOp, MatrixOperation::MultiQubitOp,}¶
-
static constexpr std::array<ControlledGateOperation, 0> implemented_controlled_gates = {}¶
-
static constexpr std::array<ControlledGeneratorOperation, 0> implemented_controlled_generators = {}¶
-
static constexpr std::array<ControlledMatrixOperation, 0> implemented_controlled_matrices = {}¶