QQuantLib.AA
amplitude_amplification
This module contains all functions needed for creating Grover-like operators mandatory for using Quantum Amplitude Amplification and Estimation as explained in the 2000 Brassard paper:
Gilles Brassard, Peter Hoyer, Michele Mosca and Alain Tapp Quantum Amplitude Amplification and Estimation AMS Contemporary Mathematics Series, 305, 06-2000 https://arxiv.org/abs/quant-ph/0005055v1
Authors: Alberto Pedro Manzano Herrero & Gonzalo Ferro
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.create_u0_gate(oracle: qat.lang.AQASM.QRoutine, target: numpy.ndarray, index: numpy.ndarray, mcz_qlm=True)
This function creates a QLM AbstractGate that implements an oracle: a reflection around the perpendicular state to a given state.
Notes
\[If \hspace{1em} |\Psi\rangle=\alpha_0|\Psi_0\rangle+ \ \alpha_1|\Psi_1\rangle \hspace{1em} where \hspace{1em} \ |\Psi_0\rangle \perp |\Psi_1\rangle \hspace{1em} then \ \hspace{1em} \mathcal{U0}(|\Psi_0\rangle)=\mathcal{I}-2 \ |\Psi_0\rangle\langle\Psi_0|\]- Parameters:
oracle (QLM routine/gate) – oracle that created the state
target (list of ints) – target state
index (list of ints) – index for the qubits that define the register
mcz_qlm (bool) – If True QLM construction for multi-controlled Z will be used.
- Returns:
u0_gate
- Return type:
QLM gate
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.create_u_gate(oracle: qat.lang.AQASM.QRoutine, mcz_qlm=True)
This function creates a QLM AbstractGate that implements a grover diffusion operator from an input state.
Notes
\[\mathcal{U}(|\Psi\rangle) = \mathcal{I}-2|\Psi\rangle\langle\Psi|\]- Parameters:
oracle (QLM routine/gate) – operator O
mcz_qlm (bool) – If True QLM construction for multi-controlled Z will be used.
- Returns:
u_gate
- Return type:
QLM gate
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.grover(oracle: qat.lang.AQASM.QRoutine, target: numpy.ndarray, index: numpy.ndarray, mcz_qlm=True)
This function creates a QLM AbstractGate that returns the grover operator associated to a given oracle. This function is a composition of QLM AbstractGates generate by functions U and U0.
Notes
\[\mathcal{G} = \mathcal{U}(|\Psi\rangle)\mathcal{U0}(|\Psi_0\rangle)\]- Parameters:
oracle (QLM routine/gate)
target (list of ints) – the state that we want to amplify
index (list of ints) – index for the qubits that define the register
mcz_qlm (bool) – If True QLM construction for multi-controlled Z will be used.
- Returns:
grover_gate
- Return type:
QLM gate
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.grover_extended(oracle: qat.lang.AQASM.QRoutine, target: numpy.ndarray, index: numpy.ndarray, mcz_qlm=True)
This function creates a QLM AbstractGate that returns the grover extended operator associated to a given oracle.
Notes
\[\mathcal{G} = \mathcal{U}(|\Psi\rangle)\mathcal{U0}(|\Psi_0\rangle)\]- Parameters:
oracle (QLM routine/gate)
target (list of ints) – the state that we want to amplify
index (list of ints) – index for the qubits that define the register
mcz_qlm (bool) – If True QLM construction for multi-controlled Z will be used.
- Returns:
grover_gate
- Return type:
QLM gate
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.multiplexor_controlled_ph(angle, number_qubits)
Multiplexor implementation for a Multi-Controlled-phase gate
- Parameters:
angle (float) – Desired angle for Controlled-Phase application
number_qubits (int) – Number of qubits for the multi-controlled phase gate
- Returns:
routine – QLM routine with the implementation of a multi-controlled phase gate
- Return type:
QLM routine
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.multiplexor_controlled_z(number_qubits)
Multiplexor implementation for a multi-controlled-Z gate
- Parameters:
number_qubits (int) – Number of qubits for the multi-controlled phase gate gate
- Returns:
routine – QLM routine with the implementation of a multi-controlled Z gate
- Return type:
QLM routine
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.phase_multiplexor_base(theta)
Implement an initial multiplexor for a controlled phase gate.
- Parameters:
angle (float) – Phase angle to apply
- Returns:
routine – QLM routine with the implementation of the basis multiplexor for the controlled phase gate
- Return type:
QLM routine
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.recursive_multiplexor(input_gate)
Create a new multiplexor from an input gate. In this case takes the input gate adds a new qubit and creates a new multiplexor by applying the input gate, a c-NOT and the input gate again
- Parameters:
input_gate (QLM routine) – QLM routine with the gate we want for multiplexor
- Returns:
routine – QLM routine with a multiplexor of the input_gate
- Return type:
QLM routine
- tnbs.BTC_02_AE.QQuantLib.AA.amplitude_amplification.reflection(lista: numpy.ndarray, mcz_qlm=True)
This function returns a QLM AbstractGate that implement a reflection around the perpendicular state of a given state.
Notes
\[|\Psi\rangle=|\Psi_0\rangle+|\Psi_1\rangle\]\[\begin{split}\mathcal{reflection}(|\Psi_0\rangle)|\Psi\rangle= -|\Psi_0\rangle+|\Psi_1\rangle\\\end{split}\]- Parameters:
lista (list of ints) – binary representation of the State that we want to rotate pi
mcz_qlm (bool) – If True QLM construction for multi-controlled Z will be used.
- Returns:
reflection_gate
- Return type:
QLM gate