# Importing standard Qiskit libraries and configuring account
from qiskit import *
from qiskit.compiler import *
from qiskit.tools.jupyter import *
from qiskit.visualization import *
import matplotlib.pyplot as plotter
import scipy
import numpy as np
from IPython.display import display, Math, Latex
import qiskit.quantum_info as qi
%matplotlib inline
%pip install -I git+https://github.com/mnp-club/MnP_QC_Workshop.git
from mnp_qc_workshop_2020.unitary_circuit import *

U = get_unitary()
print(U.shape)
fig, (ax1, ax2) = plotter.subplots(nrows = 1, ncols = 2, figsize=(12,6))
ax1.imshow(np.real(U)) #plot real parts of each element
ax2.imshow(np.imag(U)) #plot imaginary parts of each element
fig, (ax3, ax4) = plotter.subplots(nrows = 1, ncols = 2, figsize=(12,6))
ax3.imshow(np.abs(U)) #plot the absolute values of each element
ax4.imshow(np.angle(U)) #plot the phase angles of each element

qc = QuantumCircuit(4)
qc.unitary(U, range(4))
matrix = qi.Operator(qc).data
print(matrix)
#
#
#Your code here
#
#
# qc = transpile(qc,basis_gates=['cx','u3'],optimization_level=3)
# qc.draw('mpl')

#Run this cell for getting your circuit checked
check_circuit(qc)