Add examples and clean up some stuff

This commit is contained in:
2024-12-08 22:06:58 -08:00
parent 5adc755be4
commit 9b8584bd6f
10 changed files with 275 additions and 102 deletions
+15 -5
View File
@@ -1,4 +1,6 @@
(defpackage :cl-quantum/math
(:documentation "Basic linear algebra subroutines used to implement the
quantum operators.")
(:use :cl)
(:export #:domatrix
#:mapmatrix
@@ -47,8 +49,10 @@
#:vector=))
(defpackage :cl-quantum/state
(:documentation "Functions for creating and applying quantum gates.")
(:use :cl :cl-quantum/math)
(:export #:+unset-projector+
(:export #:define-constant
#:+unset-projector+
#:+set-projector+
#:+identity-2x2+
#:+pauli-x-gate+
@@ -65,6 +69,7 @@
#:normalize-state
#:nnormalize-state
#:state-bits
#:make-zero-state
#:make-normal-state
#:make-uniform-normal-state
#:bit-unset-index
@@ -76,12 +81,16 @@
#:collapse
#:make-operator
#:make-controlled-operator
#:apply-operator
#:napply-operator
#:apply-controlled-operator
#:napply-controlled-operator))
#:make-n-toffoli-operator
#:make-n-controlled-z-operator
#:replace-state
#:apply-gate
#:napply-gate
#:apply-controlled-gate
#:napply-controlled-gate))
(defpackage :cl-quantum/circuit
(:documentation "High-level interface for building quantum circuits.")
(:use :cl :cl-quantum/math :cl-quantum/state)
(:export #:*circuit-measure-places*
#:*circuit-operators*
@@ -91,6 +100,7 @@
#:run-circuit))
(defpackage :cl-quantum/pprint
(:documentation "High-level interface for building quantum circuits.")
(:use :cl :cl-quantum/math :cl-quantum/state)
(:export #:pprint-complex
#:pprint-format-bits