cutqc2.library.QFT package

Submodules

cutqc2.library.QFT.qft_circ module

class cutqc2.library.QFT.qft_circ.QFT(width, approximation_degree, inverse=False, kvals=False, barriers=True, measure=False, regname=None)[source]

Bases: object

Class which generates the circuit to perform the Quantum Fourier Transform (or its inverse) as described in Mike & Ike Chapter 5.

(Michael A Nielsen and Isaac L Chuang. Quantum computation and quantum

information (10th anniv. version), 2010.)

For another example see Figure 1 of Daniel E Browne 2007 New J. Phys. 9 146

A QFT or iQFT circuit can be generated with a given instance of the QFT class by calling the gen_circuit() method.

width

number of qubits

Type:

int

inverse

Set to true to generate the inverse quantum fourier transform

Type:

bool

kvals

optional parameter that will change the angle of the controlled rotations so that when the circuit is printed it will display the same k values that are shown in Mike & Ike Chpt 5, Fig 5.1 (NOTE: the generated circuit will no longer be valid! This is

for visualization purposes only.)

Type:

bool

barriers

should barriers be included in the generated circuit

Type:

bool

measure

should a classical register & measurement be added to the circuit

Type:

bool

regname

optional string to name the quantum and classical registers. This allows for the easy concatenation of multiple QuantumCircuits.

Type:

str

qr

Qiskit QuantumRegister holding all of the quantum bits

Type:

QuantumRegister

cr

Qiskit ClassicalRegister holding all of the classical bits

Type:

ClassicalRegister

circ

Qiskit QuantumCircuit that represents the uccsd circuit

Type:

QuantumCircuit

gen_circuit()[source]

Create a circuit implementing the UCCSD ansatz

Given the number of qubits and parameters, construct the ansatz as given in Whitfield et al.

Returns:

QuantumCircuit object of size nq with no ClassicalRegister and no measurements

Return type:

QuantumCircuit

inv_qft()[source]

Implement the inverse QFT on self.circ

j ranges from nq-1 -> 0 k ranges from nq-1 -> j+1

For each j qubit, a controlled cu1 gate is applied with target=j, control=k (for each k).

cu1 = 1 0

0 e^(-2pi*i / 2^(k-j+1))

reg_qft()[source]

Implement the QFT on self.circ

j ranges from 0 -> nq-1 k ranges from j+1 -> nq-1

For each j qubit, a controlled cu1 gate is applied with target=j, control=k (for each k).

cu1 = 1 0

0 e^(2pi*i / 2^(k-j+1))

Module contents