qubiter.adv_applications.PhaseEstSEO_writer module

class qubiter.adv_applications.PhaseEstSEO_writer.AtomWriter(do_write, test=False, file_prefix=None, emb=None, **kwargs)[source]

Bases: qubiter.SEO_writer.SEO_writer

An object of this class or of a subclass thereof is an attribute of PhaseEstSEO_writer(). If test=False, this class must be subclassed. If test=True, you get an example. In this example, the atom matrix is a simple controlled Ry rotation, but more generally, it can be a whole circuit.

Variables:
  • class has all the attributes of SEO_writer (This) –
  • test (bool) – If test=True, the class uses testing parameters. If test=False, this becomes an abstract class that must be subclassed.
__init__(do_write, test=False, file_prefix=None, emb=None, **kwargs)[source]

Constructor

Parameters:
  • do_write (bool) –
  • test (bool) –
  • file_prefix (str) –
  • emb (CktEmbedder) –
write()[source]

Same as write_pow(1)

Returns:
Return type:None
write_hermitian()[source]

Write Hermitian conjugate of circuit written by write()

Returns:
Return type:None
write_pow(power)[source]

Writes circuit for U^power, where U is the atom matrix.

Parameters:power (int) –
Returns:
Return type:None
write_pow_hermitian(power)[source]

Write Hermitian conjugate of circuit written by write_pow()

Parameters:power (int) –
Returns:
Return type:None
class qubiter.adv_applications.PhaseEstSEO_writer.PhaseEstSEO_writer(do_write, num_probe_bits, atom_writer, file_prefix, emb, do_perm=True, **kwargs)[source]

Bases: qubiter.SEO_writer.SEO_writer

The quantum phase estimation algorithm or PEA (see

https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm

for an introduction) was invented by Kitaev in 1995. Since then, it has been used for many purposes such as for finding the ground state energy of molecules.

This class is a subclass of SEO_writer. It writes the PEA circuit that is given, for example, in the Wikipedia article just mentioned.

We will divide the qubits used by PEA into 2 disjoint sets and refer to those sets as: probe qubits and atom qubits. A matrix U that acts on the atom qubits will be referred to as the atom matrix or just the atom. First a Hadamard matrix is applied to each probe qubit. Then each probe qubit interacts with a different power of the atom matrix U. Finally, an inverse quantum Fourier transform is applied to all the probe qubits together.

Even though these probe-atom interactions would not change the state of the probe qubits if they were classical particles, the probes do become correlated with the atom powers and this shows up after we take the inverse Fourier transform.

Note that this class writes the whole PEA circuit, but it requires as input an object of a subclass of the class AtomWriter given below. This object will write the atom matrix powers.

Variables:
  • atom_wr (AtomWriter) – An object of a subclass of the class AtomWriter given below. This object will write the atom matrix powers.
  • do_perm (bool) – True if want quantum Fourier Transform circuit to include permutation that reverses qbit order
  • num_probe_bits (int) – Number of probe qubits.
__init__(do_write, num_probe_bits, atom_writer, file_prefix, emb, do_perm=True, **kwargs)[source]

Constructor

Parameters:
  • do_write (bool) – True if want constructor to write automatically without being asked.
  • atom_writer (AtomWriter) –
  • num_probe_bits (int) –
  • file_prefix (str) –
  • emb (CktEmbedder) –
  • do_perm (bool) – True if want quantum Fourier Transform circuit to include permutation that reverses qbit order
write()[source]

Writes the circuit for quantum phase estimation.

Returns:
Return type:None
write_hermitian()[source]

Write Hermitian conjugate of circuit written by write()

Returns:
Return type:None