# Useful additional packages 
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
from math import pi

from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
from qiskit.tools.visualization import circuit_drawer
from qiskit.quantum_info import state_fidelity
from qiskit import BasicAer

backend = BasicAer.get_backend('unitary_simulator')

q = QuantumRegister(2)

qc = QuantumCircuit(q)
qc.cx(q[0],q[1])
qc.draw(output='mpl')

job = execute(qc, backend)
job.result().get_unitary(qc, decimals=3)

qc = QuantumCircuit(q)
qc.cy(q[0],q[1])
qc.draw(output='mpl')

job = execute(qc, backend)
job.result().get_unitary(qc, decimals=3)

qc = QuantumCircuit(q)
qc.cz(q[0],q[1])
qc.draw(output='mpl')

job = execute(qc, backend)
job.result().get_unitary(qc, decimals=3)

qc = QuantumCircuit(q)
qc.ch(q[0],q[1])
qc.draw(output='mpl')

job = execute(qc, backend)
job.result().get_unitary(qc, decimals=3)

qc = QuantumCircuit(q)
qc.crz(pi/2,q[0],q[1])
qc.draw(output='mpl')

job = execute(qc, backend)
job.result().get_unitary(qc, decimals=3)

qc = QuantumCircuit(q)
qc.cu1(pi/2,q[0], q[1])
qc.draw(output='mpl')

job = execute(qc, backend)
job.result().get_unitary(qc, decimals=3)

qc = QuantumCircuit(q)
qc.cu3(pi/2, pi/2, pi/2, q[0], q[1])
qc.draw(output='mpl')

job = execute(qc, backend)
job.result().get_unitary(qc, decimals=3)

qc = QuantumCircuit(q)
qc.swap(q[0], q[1])
qc.draw(output='mpl')

job = execute(qc, backend)
job.result().get_unitary(qc, decimals=3)

import qiskit.tools.jupyter
%qiskit_version_table
%qiskit_copyright

