Basis Change¶
-
U3_gates_placement
(n, n_measure, a_a_p_coeffs, circuit)[source]¶ Places the U3 gates according to the mermin_IBM monomial
Parameters: - n (int) – the size of the register to be evaluated
- n_measure (int) – The measure to be performed. Dictates whether a_i or a’_i is used on each wire
- a_a_p_coeffs (list[list[real]]) – Contains the list of coefficients for a_i and a’_i in the packed shape
- circuit (QuantumCircuit) – The circuit on which the measures are appended
Returns: None
-
convert_in_binary
(number_to_convert, number_of_bits=0)[source]¶ Converts an int into a string containing its bits
- Example :
>>> convert_in_binary(5,3) 101 >>> convert_in_binary(5,5) 00101
Parameters: - number_to_convert (int) – The number that is going to be converted.
- number_of_bits (int) – The number of bits required.
Returns: str – The converted number.
-
mermin_coeffs_to_U3_coeffs
(x, y, z)[source]¶ - Generates the coefficients of the U3 gate from mermin coefficients:
- x*X + y*Y + z*Z = U3(theta, phi, -phi-pi)
Parameters: - x (float) – The coefficient alpha for the matrix X.
- y (float) – The coefficient beta for the matrix Y.
- z (float) – The coefficient gamma for the matrix Z.
Returns: (float, float) – The two angles of U3 gate.