from qiskit import *
from qiskit.quantum_info import Statevector
from math import pi

qc=QuantumCircuit(3)
qc.ccx(0,1,2)
qc.draw(output="mpl")

backend = Aer.get_backend('unitary_simulator')

job = execute(qc, backend)
result = job.result()
#Obtain the unitary matrix for ccx gate
print(result.get_unitary(qc, decimals=3))

state = Statevector.from_instruction(qc)
state.draw(output='latex')

qc=QuantumCircuit(3)
qc.x(0)
qc.x(1)
qc.ccx(0,1,2)
qc.draw(output="mpl")

state = Statevector.from_instruction(qc)
state.draw(output='latex')

from qiskit import *
from qiskit.quantum_info import Statevector
from math import pi

qc=QuantumCircuit(3)
qc.cswap(0,1,2)
qc.draw(output="mpl")

backend = Aer.get_backend('unitary_simulator')

job = execute(qc, backend)
result = job.result()
#Obtain the unitary matrix for cswap gate
print(result.get_unitary(qc, decimals=3))

state = Statevector.from_instruction(qc)
state.draw(output='latex')

qc=QuantumCircuit(3)
qc.x(0)
qc.x(1)
qc.cswap(0,1,2)
qc.draw(output="mpl")

state = Statevector.from_instruction(qc)
state.draw(output='latex')

