Poly-X Gate

Qiskit Representation

This is the process of a one quibit circuit being built, having an X-Gate and measurement applied, then ploting the results goes in code

In [19]:
import numpy as np
import qiskit as q
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, Aer, IBMQ
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *

# Loading your IBM Quantum account(s)
provider = IBMQ.load_account()
ibmqfactory.load_account:WARNING:2021-05-25 01:54:22,806: Credentials are already in use. The existing account in the session will be replaced.

Constructing the circuit

Makes the quantum circuit "foundation". The first parameter is the number of qubits (quantum bits) the second parameter is the number of cbits (classical bits), this lets us store the information to be read by the simulator

In [ ]:
xGateExample = QuantumCircuit(1,1)

Adds an Poly-X gate to the first qubit (represented by the number zero)

In [ ]:
xGateExample.x(0)

Adds an measurement operator to the first qubit and results stored in the first cbit

In [ ]:
xGateExample.measure(0,0)

Draws the circuit out for a visual representation

In [20]:
xGateExample.draw()
Out[20]:

Choosing the backend and gathering results

Choosing a backend from the avaible computers with my account. The QASM Simulator is a regular computer doing this as a simulation to give an idea of what probabilities of the outcomes are for the circuit

In [21]:
backend = Aer.get_backend("qasm_simulator")

Executes the circuit made (argument one [xGateExample]) on the backend (argument two [backend])

In [22]:
job = q.execute(xGateExample, backend)

Gathers the results from the execution done in the previous statement

In [23]:
results = job.result()

Gathers the counts of how many times 1 or 0 was the result

In [24]:
counts = results.get_counts()

Results

Plots the counts on a histogram shown below

In [25]:
plot_histogram(counts)
Out[25]:

The above shows that the first qubits value after measurement is 1 with 100% probability