2024-12-08 22:06:58 -08:00
|
|
|
;;;; Example Bell state creation circuits
|
|
|
|
(in-package :cl-quantum/examples)
|
|
|
|
|
2024-12-19 12:25:23 -08:00
|
|
|
(defun make-bell-phi+-circuit (bits)
|
2024-12-08 22:06:58 -08:00
|
|
|
"Return a circuit that makes a Bell phi+ state. That is |00>+|11>."
|
2024-12-19 12:25:23 -08:00
|
|
|
(with-build-circuit bits
|
2024-12-08 22:06:58 -08:00
|
|
|
(:h 0)
|
|
|
|
(:cnot 1 0)))
|
|
|
|
|
2024-12-19 12:25:23 -08:00
|
|
|
(defun make-bell-phi--circuit (bits)
|
2024-12-08 22:06:58 -08:00
|
|
|
"Return a circuit that makes a Bell phi- state. That is |00>-|11>."
|
2024-12-19 12:25:23 -08:00
|
|
|
(with-build-circuit bits
|
2024-12-08 22:06:58 -08:00
|
|
|
(:h 0)
|
|
|
|
(:cnot 1 0)
|
|
|
|
(:z 1)))
|
|
|
|
|
2024-12-19 12:25:23 -08:00
|
|
|
(defun make-bell-psi+-circuit (bits)
|
2024-12-08 22:06:58 -08:00
|
|
|
"Return a circuit that makes a Bell psi+ state. That is |01>+|10>."
|
2024-12-19 12:25:23 -08:00
|
|
|
(with-build-circuit bits
|
2024-12-08 22:06:58 -08:00
|
|
|
(:x 1)
|
|
|
|
(:h 0)
|
|
|
|
(:cnot 1 0)))
|
|
|
|
|
2024-12-19 12:25:23 -08:00
|
|
|
(defun make-bell-psi--circuit (bits)
|
2024-12-08 22:06:58 -08:00
|
|
|
"Return a circuit that makes a Bell psi- state. That is |01>-|10>."
|
2024-12-19 12:25:23 -08:00
|
|
|
(with-build-circuit bits
|
2024-12-08 22:06:58 -08:00
|
|
|
(:x 1)
|
|
|
|
(:h 0)
|
|
|
|
(:cnot 1 0)
|
|
|
|
(:z 1)))
|