QPEA vectors variation¶
- qpea.angles_determination(min, max, step)[source]¶
- Generates a table of different values.
Each table value corresponds to an angle which will be involved in the algorithms calculations and variations.
- Example:
>>> angles_determination(0, 10, 1) [0 1 2 3 4 5 6 7 8 9]
- Parameters:
min (int) – The minimal value of the angle.
max (int) – The maximal value of the angle.
step (float) – The step of variation of the angle.
- Returns:
np.array[float] – The table of float values of the angle.
- qpea.calcul_invariant_cm(n, psi)[source]¶
Calculates the value of the invariant based on the coefficient matrices.
- Parameters:
n (int) – The number of qubits.
:parameter np.array[complex] psi : The table of vectors for the algorithm. :return: np.array[complex] – The list of the coefficients calculated.
- qpea.calcul_invariant_gme(n, angles, psi)[source]¶
Calculates the value of the invariant based on Mermin polynomials.
- Parameters:
n (int) – The number of qubits.
:parameter np.array[float] angles : The table of the angle values. :parameter np.array[float] psi : The table of vectors for the algorithm. :return: np.array[complex] – The list of the coefficients calculated.
- qpea.calcul_invariant_mu(n, angles, psi)[source]¶
Calculates the value of the invariant based on Mermin polynomials.
- Parameters:
n (int) – The number of qubits.
:parameter np.array[float] angles : The table of the angle values. :parameter np.array[float] psi : The table of vectors for the algorithm. :return: np.array[complex] – The list of the coefficients calculated.
- qpea.cas_matrice_g(n, angles, basis)[source]¶
Generates the vectors depending on the basis and also the angles for QCA.
Example: >>> cas_matrice_g(2, [0, 1, 2], 1) [[0.5 (0.5+0j) 0.5 (0.5+0j)]
[0.5 (0.5+0j) 0.5 (0.5+0j)] [0.5 (0.5+0j) 0.5 0.5]]
- Parameters:
n (int) – The number of qubits.
:parameter np.array[float] angles : The table of the angle values. :parameter int basis: The value of the number of qubits on the second register. :return: np.array[complex] – A table of vectors corresponding to each angle value.
- qpea.cas_matrice_z(n, angles, basis)[source]¶
- Generates the vectors for the algorithm computation.
This depends on the basis and also on the angles for QPEA.
- Example:
>>> cas_matrice_z(2, [0, 1, 2], 1) [[0.5 (0.5+0j) 0.5 (0.5+0j)] [0.5 (0.5+0j) 0.5 (0.5-1.2246467991473532e-16j)] [0.5 (0.5+0j) 0.5 (0.5-2.4492935982947064e-16j)]]
- Parameters:
n (int) – The number of qubits.
:parameter np.array[float] angles : The table of the angle values. :parameter int basis: The value of the number of qubits on the second register. :return: np.array[complex] – A table of vectors corresponding to each angle value.
- qpea.psi_calculation_qca_base_0(n, thetas)[source]¶
- Computes the vector for each angle for QCA.
This is for the case where there are only one qubit on the second register. This means that the total number of qubits of all the system is n + 1.
- Example:
>>> psi_calculation_qca_base_0(3, [0, 1]) [[(0.35355339059327373+0j) (0.35355339059327373+0j) (0.35355339059327373+0j) (0.35355339059327373+0j) (0.35355339059327373+0j) (0.35355339059327373+0j) (0.35355339059327373+0j) (0.35355339059327373+0j)] [(-0.35355339059327373-4.329780281177466e-17j) (-0.35355339059327373-4.329780281177466e-17j) (-0.35355339059327373-1.2989340843532398e-16j) (-0.35355339059327373+4.329780281177466e-17j) (-0.35355339059327373-2.164890140588733e-16j) (-0.35355339059327373+1.2989340843532398e-16j) (-0.35355339059327373-3.0308461968242264e-16j) (-0.35355339059327373+2.164890140588733e-16j)]]
- Parameters:
n (int) – The number of qubits.
:parameter np.array(float) thetas : The table of float values of the angle. :return: np.array[complex] – A table of vectors corresponding to each angle value.
- qpea.psi_calculation_qca_base_00(n, thetas)[source]¶
- Computes the vector for each angle for QCA.
This is the case where there are two qubits on the second register. This means that the total number of qubits of all the system is n + 2.
- Example:
>>> psi_calculation_qca_base_00(3, [0, 1]) [[(0.17677669529663687+0j) (0.17677669529663687+0j) (0.17677669529663687+0j) (0.17677669529663687+0j) (0.17677669529663687+0j) (0.17677669529663687+0j) (0.17677669529663687+0j) (0.17677669529663687+0j)] [(-0.17677669529663687-2.164890140588733e-17j) (-0.17677669529663687-2.164890140588733e-17j) (-0.17677669529663687-2.164890140588733e-17j) (-0.17677669529663687-2.164890140588733e-17j) (-0.17677669529663687-6.494670421766199e-17j) (-0.17677669529663687-6.494670421766199e-17j) (-0.17677669529663687+2.164890140588733e-17j) (-0.17677669529663687+2.164890140588733e-17j)]]
- Parameters:
n (int) – The number of qubits.
:parameter np.array[float] thetas : The table of float values of the angle. :return: np.array[complex] – A table of vectors corresponding to each angle value on which the algorithm will be performed.
- qpea.psi_calculation_qpea_base_0(n, phis)[source]¶
Computes the vector for each angle for the QPEA. This is the case where there are only one qubit on the second register. This means that the total number of qubits of all the system is n + 1.
- Example:
>>> psi_calculation_qca_base_0(3, [0, 1]) [[0.35355339059327373 (0.35355339059327373+0j) 0.35355339059327373 (0.35355339059327373+0j) 0.35355339059327373 (0.35355339059327373+0j) 0.35355339059327373 (0.35355339059327373+0j)] [0.35355339059327373 (0.35355339059327373+0j) 0.35355339059327373 (0.35355339059327373-8.659560562354932e-17j) 0.35355339059327373 (0.35355339059327373-1.7319121124709863e-16j) 0.35355339059327373 (0.35355339059327373-2.5978681687064796e-16j)]]
- Parameters:
n (int) – The number of qubits.
:parameter np.array[float] phis : The table of float values of the angle. :return: np.array[complex] – A table of vectors corresponding to each angle value.
- qpea.psi_calculation_qpea_base_00(n, phis)[source]¶
- Computes the vector for each angle for the QPEA.
This is the case where there are two qubits on the second register. This means that the total number of qubits of all the system is n + 2.
- Example:
>>> psi_calculation_qca_base_0(3, [0, 1]) [[0.35355339059327373 0.35355339059327373 (0.35355339059327373+0j) (0.35355339059327373+0j) 0.35355339059327373 -0.35355339059327373 (0.35355339059327373+0j) (0.35355339059327373+0j)] [0.35355339059327373 0.35355339059327373 (0.35355339059327373+0j) (0.35355339059327373+0j) 0.35355339059327373 -0.35355339059327373 (0.35355339059327373+8.659560562354932e-17j) (0.35355339059327373-8.659560562354932e-17j)]]
- Parameters:
n (int) – The number of qubits.
:parameter np.array[float] phis : The table of float values of the angle. :return: np.array[complex] – A table of vectors corresponding to each angle value.
- qpea.run(n_first_register, n_second_register, case, test, cm=True, mu=True, gm=True)[source]¶
- Generates a table of different values that corresponds to an angle.
The angles will be involved in the algorithms calculations and variations.
- Parameters:
n_first_register (int) – The number of qubits on the first register of the system.
n_second_register (int) – The value of the number of qubits on the second register.
case (str) – The value that determines the type of algorithm : “G” for qca or “Z” for qpea.
test (boolean) – This determines if all the cases will be run or not.
:parameter boolean cm : This determines if the invariant based on coefficient matrices should be calculated or not :parameter boolean mu : This determines if the invariant based on Mermin polynials should be calculated or not :parameter boolean gm : This determines if the geometric measure invariant should be calculated or not :return: np.array[float] – The table of float values of the angle.