Memahami Cara Kerja Quantum Gate Pada Quantum Circuit

Spread the love

Sumber YouTube = https://www.youtube.com/watch?v=tBnWG_95F9c&list=PLOFEBzvs-Vvp2xg9-POLJhQwtVktlYGbY&index=4

Ada banyak pilihan quantum gates yang disediakan oleh Qiskit = https://quantum-computing.ibm.com/docs/circ-comp/q-gates

Bagaimana Cara Kerja Quantum Gate Pada Quantum Circuit?
Ada beberapa cara untuk representasi:

1) Bra–ket notation
https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation

Misal pada X gates (logical NOT operation):
– x gate di aplikasikan pada quantum state 0, menghasilkan quantum state 1 *

Apa itu Quantum state? baca di = https://en.wikipedia.org/wiki/Quantum_state
Apa itu Pauli-X gate? baca di = https://en.wikipedia.org/wiki/Quantum_logic_gate#Pauli-X_gate

2) Matriks uniter (unitary matrix)
Masih pada contoh sebelumnya (*)
[0 1, 1 0][1 0] = [0 1]
x gate state 0 = state 1

Untuk menampilkan representasi uniter dari x gate:

from qiskit import *
from qiskit.tools.visualization import plot_bloch_multivector
circuit = QuantumCircuit(1 ,1)
circuit.x(0)

simulator = Aer.get_backend(‘unitary_simulator’)
result = execute(circuit, backend = simulator).result()
unitary = result.get_unitary()
print(unitary)

simulator = Aer.get_backend(‘statevector_simulator’)
result = execute(circuit, backend = simulator).result()
statevector = result.get_statevector()
print(statevector)

Catatan: pada [0.+0.j 1.+0.j], 1.+0.j menunjukkan bahwa ini adalah bilangan kompleks (bilangan riil = 1, dan bilangan imajiner = 0);

3) Bloch sphere
https://en.wikipedia.org/wiki/Bloch_sphere

Masih pada contoh sebelumnya (*)
“Operation on quantum state as rotations the sphere.”
Operasi X gate pada qubit 0, hasilnya adalah quantum state 1

simulator = Aer.get_backend(‘statevector_simulator’)
result = execute(circuit, backend = simulator).result()
statevector = result.get_statevector()
print(statevector)
%matplotlib inline
circuit.draw(output=’mpl’)
plot_bloch_multivector(statevector)

4) Measurement
Masih pada contoh sebelumnya (*)
measure quantum bit (qubit) 0, dan hasilnya diletakkan pada classical bit 0, hasilnya adalah quantum state 1:

circuit.measure([0], [0])
backend = Aer.get_backend(‘qasm_simulator’)
result = execute(circuit, backend = backend, shots = 1024).result()
counts = result.get_counts()
from qiskit.tools.visualization import plot_histogram
plot_histogram(counts)

 

Kode program tersedia di GitHub = https://github.com/keamanansiber/qiskit/blob/master/1MemulaiQiskitUntukPemula/BlochSphere.ipynb

Berikut nya = https://keamanansiber.id/blog/2020/05/18/quantum-algorithm-quantum-teleportation-circuit-on-qiskit/

Tinggalkan Balasan

This site uses Akismet to reduce spam. Learn how your comment data is processed.