Experiment

This commit is contained in:
2024-12-19 12:25:23 -08:00
parent f702251949
commit 806fc10d8a
5 changed files with 105 additions and 73 deletions

View File

@ -1,29 +1,29 @@
;;;; Example Bell state creation circuits
(in-package :cl-quantum/examples)
(defun make-bell-phi+-circuit ()
(defun make-bell-phi+-circuit (bits)
"Return a circuit that makes a Bell phi+ state. That is |00>+|11>."
(with-build-circuit
(with-build-circuit bits
(:h 0)
(:cnot 1 0)))
(defun make-bell-phi--circuit ()
(defun make-bell-phi--circuit (bits)
"Return a circuit that makes a Bell phi- state. That is |00>-|11>."
(with-build-circuit
(with-build-circuit bits
(:h 0)
(:cnot 1 0)
(:z 1)))
(defun make-bell-psi+-circuit ()
(defun make-bell-psi+-circuit (bits)
"Return a circuit that makes a Bell psi+ state. That is |01>+|10>."
(with-build-circuit
(with-build-circuit bits
(:x 1)
(:h 0)
(:cnot 1 0)))
(defun make-bell-psi--circuit ()
(defun make-bell-psi--circuit (bits)
"Return a circuit that makes a Bell psi- state. That is |01>-|10>."
(with-build-circuit
(with-build-circuit bits
(:x 1)
(:h 0)
(:cnot 1 0)

View File

@ -12,7 +12,7 @@ bits and finds when the state is equal to TARGET."
(assert (> (ash 1 bits) target)
(bits target)
"Target bit of ~s out of range for state with ~s bits." target bits)
(with-build-circuit
(with-build-circuit bits
;; Setup
(loop for i below bits do (:h i))