Class GateImplementationsLM¶
Defined in File GateImplementationsLM.hpp
Inheritance Relationships¶
Base Type¶
public Pennylane::LightningQubit::Gates::PauliGenerator< GateImplementationsLM >
(Template Class PauliGenerator)
Class Documentation¶
-
class GateImplementationsLM : public Pennylane::LightningQubit::Gates::PauliGenerator<GateImplementationsLM>¶
A gate operation implementation with less memory.
We use a bitwise operation to calculate the indices where the gate applies to on the fly.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data
Public Static Functions
-
static inline std::size_t parity_2_offset(const std::vector<std::size_t> &parity, const std::size_t k)¶
-
template<class PrecisionT>
static inline void applyNCSingleQubitOp(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::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.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wire – A wire the gate applies to.
inverse – Indicate whether inverse should be taken.
-
template<class PrecisionT>
static inline void applySingleQubitOp(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<std::size_t> &wires, bool inverse = false)¶
-
template<class PrecisionT>
static inline void applyNCTwoQubitOp(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::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.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
inverse – Indicate whether inverse should be taken.
-
template<class PrecisionT>
static inline void applyTwoQubitOp(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<std::size_t> &wires, bool inverse = false)¶
-
template<class PrecisionT, class FuncT>
static inline void applyNCN(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, FuncT core_function)¶ Apply a matrix with controls to the statevector.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data
FuncT – Gate function type.
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
matrix – Perfect square matrix in row-major order.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
core_function – Gate function returning the matrix-vector product for a wire block.
-
template<class PrecisionT>
static inline void applyNCMultiQubitOp(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse)¶ Apply a matrix with controls to the statevector.
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
matrix – Perfect square matrix in row-major order.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
inverse – Indicate whether inverse should be taken.
-
template<class PrecisionT>
static inline void applyMultiQubitOp(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::complex<PrecisionT> *matrix, const std::vector<std::size_t> &wires, bool inverse)¶
-
template<class PrecisionT>
static inline void applyPauliRot(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse, PrecisionT angle, const std::string &word)¶
-
template<class PrecisionT, class ParamT = PrecisionT, class FuncT, bool has_controls = true>
static inline void applyNC1(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, FuncT core_function)¶ Apply a single-qubit gate with controls to the statevector.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data
ParamT – Floating point precision of the gate parameters
FuncT – Gate function type.
has_controls – True if the gate has control wires and false otherwise (for optimization)
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
core_function – Gate function returning the matrix-vector product for a wire block.
-
template<class PrecisionT>
static inline void applyNCPauliX(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool inverse)¶
-
template<class PrecisionT>
static inline void applyPauliX(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse)¶
-
template<class PrecisionT>
static inline void applyCNOT(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool inverse)¶
-
template<class PrecisionT>
static inline void applyToffoli(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyNCPauliY(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool inverse)¶
-
template<class PrecisionT>
static inline void applyPauliY(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse)¶
-
template<class PrecisionT>
static inline void applyCY(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool inverse)¶
-
template<class PrecisionT>
static inline void applyNCPauliZ(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool inverse)¶
-
template<class PrecisionT>
static inline void applyPauliZ(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse)¶
-
template<class PrecisionT>
static inline void applyCZ(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool inverse)¶
-
template<class PrecisionT>
static inline void applyNCHadamard(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool inverse)¶
-
template<class PrecisionT>
static inline void applyHadamard(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse)¶
-
template<class PrecisionT>
static inline void applyNCS(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, const bool inverse)¶
-
template<class PrecisionT>
static inline void applyS(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse)¶
-
template<class PrecisionT>
static inline void applyNCT(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, const bool inverse)¶
-
template<class PrecisionT>
static inline void applyT(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyNCPhaseShift(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyPhaseShift(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyControlledPhaseShift(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyNCRX(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyRX(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyCRX(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyNCRY(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyRY(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyCRY(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyNCRZ(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyRZ(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyCRZ(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, const bool inverse, ParamT angle)¶
-
template<class PrecisionT>
static inline void applyIdentity(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool inverse)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyNCRot(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, const bool inverse, ParamT phi, ParamT theta, ParamT omega)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyRot(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT phi, ParamT theta, ParamT omega)¶
-
template<class PrecisionT, class ParamT = PrecisionT>
static inline void applyCRot(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT phi, ParamT theta, ParamT omega)¶
-
template<class PrecisionT, class ParamT = PrecisionT, class FuncT, bool has_controls = true>
static inline void applyNC2(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, FuncT core_function)¶ Apply a two-qubit gate with controls to the statevector.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data
ParamT – Floating point precision of the gate parameters
FuncT – Gate function type.
has_controls – True if the gate has control wires and false otherwise (for optimization)
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
core_function – Gate function returning the matrix-vector product for a wire block.
-
template<class PrecisionT>
static inline void applyNCSWAP(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applySWAP(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT>
static inline void applyCSWAP(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool inverse)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCIsingXX(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyIsingXX(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCIsingXY(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyIsingXY(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCIsingYY(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyIsingYY(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCIsingZZ(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyIsingZZ(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCSingleExcitation(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applySingleExcitation(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCSingleExcitationMinus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applySingleExcitationMinus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCSingleExcitationPlus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applySingleExcitationPlus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT = PrecisionT, class FuncT, bool has_controls = true, bool compute_indices = true>
static inline void applyNC4(std::complex<PrecisionT> *arr, const std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, FuncT core_function)¶ Apply a four-qubit gate with controls to the statevector.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data
ParamT – Floating point precision of the gate parameters
FuncT – Gate function type.
has_controls – True if the gate has control wires and false otherwise (for optimization)
compute_indices – True if the controlled gate requires the computation of all statevector indices, otherwise only the 3rd and 12th entries are calculated (for optimization)
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
core_function – Gate function returning the matrix-vector product for a wire block.
-
template<class PrecisionT, class ParamT>
static inline void applyNCDoubleExcitation(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCDoubleExcitationMinus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCDoubleExcitationPlus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyDoubleExcitation(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyDoubleExcitationMinus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyDoubleExcitationPlus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyMultiRZ(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCMultiRZ(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyGlobalPhase(std::complex<PrecisionT> *arr, std::size_t num_qubits, [[maybe_unused]] const std::vector<std::size_t> &wires, [[maybe_unused]] bool inverse, [[maybe_unused]] ParamT angle)¶
-
template<class PrecisionT, class ParamT>
static inline void applyNCGlobalPhase(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, [[maybe_unused]] const std::vector<std::size_t> &wires, bool inverse, ParamT angle)¶
-
template<class PrecisionT, class FuncT>
static inline void applyNCGenerator1(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, FuncT core_function)¶ Apply a single-qubit generator with controls to the statevector.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data
FuncT – Gate function type.
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
core_function – Gate function returning the matrix-vector product for a wire block.
-
template<class PrecisionT>
static inline auto applyNCGeneratorGlobalPhase(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, [[maybe_unused]] const std::vector<std::size_t> &wires, [[maybe_unused]] const bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorGlobalPhase([[maybe_unused]] std::complex<PrecisionT> *arr, [[maybe_unused]] std::size_t num_qubits, [[maybe_unused]] const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorPhaseShift(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorPhaseShift(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorControlledPhaseShift(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorRX(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorCRX(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorRY(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorCRY(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorRZ(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] const bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorCRZ(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT, class FuncT>
static inline void applyNCGenerator2(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, FuncT core_function)¶ Apply a two-qubit generator with controls to the statevector.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data
FuncT – Gate function type.
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
core_function – Gate function returning the matrix-vector product for a wire block.
-
template<class PrecisionT>
static inline auto applyNCGeneratorIsingXX(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorIsingXX(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorIsingXY(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorIsingXY(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorIsingYY(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorIsingYY(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorIsingZZ(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorIsingZZ(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorSingleExcitation(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorSingleExcitation(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorSingleExcitationMinus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorSingleExcitationMinus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorSingleExcitationPlus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorSingleExcitationPlus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, bool adj) -> PrecisionT¶
-
template<class PrecisionT, class FuncT, bool compute_indices = true>
static inline void applyNCGenerator4(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, FuncT core_function)¶ Apply a single-qubit generator with controls to the statevector.
- Template Parameters
PrecisionT – Floating point precision of underlying statevector data
FuncT – Gate function type.
compute_indices – True if the controlled gate requires the computation of all statevector indices, otherwise only the 3rd and 12th entries are calculated (for optimization)
- Parameters
arr – Pointer to the statevector.
num_qubits – Number of qubits.
controlled_wires – Control wires.
controlled_values – Control values (false or true).
wires – Wires the gate applies to.
core_function – Gate function returning the matrix-vector product for a wire block.
-
template<class PrecisionT>
static inline auto applyNCGeneratorDoubleExcitation(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorDoubleExcitation(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorDoubleExcitationMinus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorDoubleExcitationMinus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorDoubleExcitationPlus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorDoubleExcitationPlus(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyGeneratorMultiRZ(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
-
template<class PrecisionT>
static inline auto applyNCGeneratorMultiRZ(std::complex<PrecisionT> *arr, std::size_t num_qubits, const std::vector<std::size_t> &controlled_wires, const std::vector<bool> &controlled_values, const std::vector<std::size_t> &wires, [[maybe_unused]] bool adj) -> PrecisionT¶
Public Static Attributes
-
static constexpr KernelType kernel_id = KernelType::LM¶
-
static constexpr std::string_view name = "LM"¶
-
template<typename PrecisionT>
static constexpr std::size_t required_alignment = std::alignment_of_v<PrecisionT>¶
-
template<typename PrecisionT>
static constexpr std::size_t packed_bytes = sizeof(PrecisionT)¶
-
static constexpr std::array implemented_gates¶
-
static constexpr std::array implemented_controlled_gates = {ControlledGateOperation::PauliX, ControlledGateOperation::PauliY, ControlledGateOperation::PauliZ, ControlledGateOperation::Hadamard, ControlledGateOperation::S, ControlledGateOperation::T, ControlledGateOperation::PhaseShift, ControlledGateOperation::RX, ControlledGateOperation::RY, ControlledGateOperation::RZ, ControlledGateOperation::Rot, ControlledGateOperation::SWAP, ControlledGateOperation::IsingXX, ControlledGateOperation::IsingXY, ControlledGateOperation::IsingYY, ControlledGateOperation::IsingZZ, ControlledGateOperation::SingleExcitation, ControlledGateOperation::SingleExcitationMinus, ControlledGateOperation::SingleExcitationPlus, ControlledGateOperation::DoubleExcitation, ControlledGateOperation::DoubleExcitationMinus, ControlledGateOperation::DoubleExcitationPlus, ControlledGateOperation::MultiRZ, ControlledGateOperation::GlobalPhase,}¶
-
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::SingleExcitation, GeneratorOperation::SingleExcitationMinus, GeneratorOperation::SingleExcitationPlus, GeneratorOperation::DoubleExcitation, GeneratorOperation::DoubleExcitationMinus, GeneratorOperation::DoubleExcitationPlus, GeneratorOperation::MultiRZ, GeneratorOperation::GlobalPhase,}¶
-
static constexpr std::array implemented_controlled_generators = {ControlledGeneratorOperation::PhaseShift, ControlledGeneratorOperation::RX, ControlledGeneratorOperation::RY, ControlledGeneratorOperation::RZ, ControlledGeneratorOperation::IsingXX, ControlledGeneratorOperation::IsingXY, ControlledGeneratorOperation::IsingYY, ControlledGeneratorOperation::IsingZZ, ControlledGeneratorOperation::SingleExcitation, ControlledGeneratorOperation::SingleExcitationMinus, ControlledGeneratorOperation::SingleExcitationPlus, ControlledGeneratorOperation::DoubleExcitation, ControlledGeneratorOperation::DoubleExcitationMinus, ControlledGeneratorOperation::DoubleExcitationPlus, ControlledGeneratorOperation::MultiRZ, ControlledGeneratorOperation::GlobalPhase,}¶
-
static constexpr std::array implemented_matrices = {MatrixOperation::SingleQubitOp, MatrixOperation::TwoQubitOp, MatrixOperation::MultiQubitOp,}¶
-
static constexpr std::array implemented_controlled_matrices = {ControlledMatrixOperation::NCSingleQubitOp, ControlledMatrixOperation::NCTwoQubitOp, ControlledMatrixOperation::NCMultiQubitOp,}¶