Skip to content
diku-dkPublic

About

The Quantum Programming Playground

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

QPP — Quantum Programming Playground

QPP (Quantum Programming Playground) is an open platform for teaching and research, by which students and researchers can build new quantum software (algorithms, compilers and analyses) from a small set of building blocks that combine according to a few clear algebraic rules.

Operators

An operator is a term of type QOp, defined in QPP.Syntax:

data QOp
  = Id Nat              -- n-qubit identity; Id 0 = One is the scalar unit, Id 1 = I
  | Phase Rational      -- global phase e^{iπθ}
  | X | Y | Z | H | SX  -- single-qubit gates
  | R QOp Rational      -- rotation by θπ; the axis must be Hermitian unless θ = 0
  | C QOp               -- controlled operator, Id n ⊕ op
  | Permute [Nat]       -- permutation of qubits
  | Tensor QOp QOp      -- a ⊗ b
  | DirectSum QOp QOp   -- a ⊕ b: "if the first qubit is 0 then a, else b"
  | Compose QOp QOp     -- a ∘ b: b first, as in mathematics
  | Adjoint QOp         -- adj a

Angles are rational multiples of π. R Z (1/2) and R Z (1/4) equal S and T up to global phases; C (Phase (1/2)) and C (Phase (1/4)) give S and T exactly. There is no SWAP constructor; the swap of two adjacent qubits is Permute [1,0].

The indices in Permute refer to the operator's own qubits, not to positions in the register it will end up in, so a permutation can be tensored, controlled or direct-summed without renumbering. To place an operator in a larger register, k <@ op @> l abbreviates Id k ⊗ op ⊗ Id l: op at qubit k, with l idle qubits after it.

The combinators ⊗, ⊕, ∘ and adj (in ASCII, <.>, <+> and <>) are methods of the Operator class, implemented by QOp and by the dense backend's matrix type CMat. A function written against the class builds a term or a matrix depending on the type it is used at.

General finite-dimensional unitaries

QPP.UOp provides the smaller UOp syntax for unitaries on arbitrary finite-dimensional spaces, including dimension zero. Products and direct sums take lists; Compose d [] is the identity of matrix dimension d. Use a qualified import alongside QPP, since constructor names overlap:

import qualified QPP.UOp as U

x = U.PermuteSum [1,1] [1,0]
z = U.directSum [U.identity 1, U.phase 1]
u = U.compose 2 [U.R x (-1/2), z]
-- U.showUOp u:
-- "(R(PermuteSum [1,1] [1,0], -1/2) ∘ (I[1] ⊕ R(I[1], -2)))"

R a t means exp(-i*pi*t*A/2), with the same sign and half angle as QOp, and a Hermitian axis unless t is zero. Scalar phase U.phase t still means exp(i*pi*t) and is represented by R (identity 1) (-2*t). U.dim counts basis vectors, not qubits. The shared operator notation also works for UOp; its builders flatten nested lists without performing algebraic simplification. U.fromQOp :: QOp -> Either TypeError U.UOp checks and lowers a QOp, preserving its global phase. Apply U.normalize to the result to flatten associations, remove identities, collect scalar phases, simplify rotations, and fuse or cancel adjacent composition factors. It preserves relative phases inside direct sums. Non-scalar rotation angles use (-2,2] modulo four; scalar phase parameters use (-1,1] modulo two before encoding as R. Interchange lifts compositions out of tensors and direct sums, padding shorter operand lists with identities. This produces a sequence of parallel layers. It is a structural normal form, not a complete test for operator equality; tensor products of direct sums stay factored.

Normalization assumes well-formed input; it does not validate raw UOp syntax. General UOp validation and semantics are not yet implemented. Run cabal run QFTSyntax -- 4 to write the QOp pretty print, raw and pretty UOp, and uop.normalized.raw.txt / uop.normalized.pretty.txt into output/qft4/. The normalized pretty print puts each outer composition factor on its own line. Use 16 for the corresponding sixteen-qubit example.

Flat circuits

QPP.QCirc provides QCirc, the gate-level view of a unitary: a wire count and a time-ordered list of gates (the head acts first), each a QOp placed on an explicit list of absolute wires. Import it qualified, like QPP.UOp:

import qualified QPP.QCirc as QC

QC.printQCirc (QC.fromQOp (qft 3))
-- qubits: 3
-- H @ [2]
-- C ((Phase (1 % 4) ⊗ R Z (1 % 2))) @ [1,2]
-- C ((I ⊗ (Phase (1 % 8) ⊗ R Z (1 % 4)))) @ [0,1,2]
-- H @ [1]
-- C ((Phase (1 % 4) ⊗ R Z (1 % 2))) @ [0,1]
-- H @ [0]
-- Permute [2,1,0] @ [0,1,2]

QC.fromQOp :: QOp -> QCirc lifts compositions out of tensor products and direct sums (liftComposes), pushes adjoints to the leaves, removes trivial identities, and then reads one gate per non-identity tensor factor of each layer, on its consecutive window of wires. It does not fuse, split or compact gates: C (Id 2 ⊗ X) stays one four-wire gate, H ∘ H gives two gates, and a global Phase t is a gate on no wires. It assumes well-formed input, like op_qubits; QC.checkQCirc validates a circuit.

QC.toQOp :: QCirc -> QOp is the embedding back. A gate on consecutive increasing wires is placed with identity padding. Any other wire list, such as a CNOT with its control below its target, is conjugated by the permutation that brings its wires to the front in the listed order:

QC.toQOp (QC.QCirc 2 [QC.Gate (C X) [1,0]])
-- (Permute [1,0] ∘ (C (X) ∘ Permute [1,0]))

QCirc implements the Operator class: <> composes in mathematical order, ⊗ places circuits side by side, adj reverses the gate list and takes each gate's adjoint, and a ⊕ b conditions on a new wire 0 by wrapping every gate in C. cabal run QFTSyntax -- 4 also writes the gate listing, the text diagram and the quantikz fragment of the circuit to output/qft4/qcirc*, as extracted and after QC.simplify.

QPP.QCirc.Rewrite holds the circuit passes. Each preserves the matrix of toQOp:

  • QC.flatten splits every gate into elementary gates: an atom (X, Y, Z, H, SX, R, Permute, Phase) under zero or more controls, or a diagonal gate. Atoms under controls stay as written. A composite diagonal operator, such as Phase a ⊕ Phase b or the QFT's C (Phase (θ/2) ⊗ R Z θ), becomes one canonical gate: a balanced ⊕-tree of phases over its wires in ascending order, with the global phase split off as a gate on no wires. So Phase a ⊕ Phase b becomes Phase a and C (Phase (b-a)), and the controlled phase becomes C (C (Phase θ)). Anything else is unfolded: C distributes over ∘ and ⊗, adjoints are resolved, and a non-diagonal a ⊕ b becomes X-conjugated controls of a followed by controls of b.
  • QC.compact restricts every gate to its support: C (Id 2 ⊗ X) on four wires becomes C X on the control and the target, R (X ⊗ I ⊗ Z) t acts on two wires, and fixed points of a Permute are dropped.
  • QC.absorbPermutations removes Permute gates by relabeling the wires of all later gates, leaving one trailing Permute on all wires when the net relabeling is not the identity. Drop that last gate for the circuit up to output renaming.
  • QC.fuse cancels or merges neighbours on the same wires with nothing on those wires in between: adjoint pairs, X X, H H, √X √X, rotations about one axis (angles modulo four, a half turn becoming a phase), phases, permutations, and controls whose targets fuse. Wires are first put in a canonical order where the operator allows it (QC.orderWires): controls ascend, the factors of a tensor product or of a rotation axis follow their wires, and a permutation is re-expressed on ascending wires, so a Toffoli with its controls listed either way round cancels against the other. Two diagonal gates on the same set of wires fuse in any wire order by adding their phases, whatever their spelling, so Z cancels against C (Phase 1), and a diagonal gate passes earlier diagonal gates to find its partner.
  • QC.collectPhases merges all gates on no wires into one leading global Phase.
  • QC.simplify runs the five in that order.
QC.printQCirc (QC.simplify (QC.fromQOp (qft 4)))
-- qubits: 4
-- H @ [3]
-- C (C (Phase (1 % 2))) @ [2,3]
-- C (C (Phase (1 % 4))) @ [1,3]
-- C (C (Phase (1 % 8))) @ [0,3]
-- H @ [2]
-- C (C (Phase (1 % 2))) @ [1,2]
-- C (C (Phase (1 % 4))) @ [0,2]
-- H @ [1]
-- C (C (Phase (1 % 2))) @ [0,1]
-- H @ [0]
-- Permute [3,2,1,0] @ [0,1,2,3]

C (C (Phase θ)) is the controlled phase gate: C (Phase θ) is already the one-qubit gate diag(1, e^{iπθ}), the direct sum of two scalars, and the outer C controls it. qft n simplifies to n Hadamards, n(n-1)/2 controlled phases and the final reversal. A composite diagonal wider than QC.maxDiagonalWires is unfolded structurally instead, since the phase list of a k-wire diagonal has 2^k entries.

QC.layers groups the gates into layers on disjoint wires, as soon as possible, and QC.depth counts the layers that hold a gate on a wire; a global phase joins the first layer and does not count. Two printers draw a circuit on its wires from one shared layout: gates are placed in columns as soon as possible without two gates covering a common row, and each gate is drawn as its controls around one element, ⊕ for a controlled X, crosses for a swap, a phase dot P(θ) for C^k (Phase θ), and otherwise a labelled box. A box on non-consecutive wires numbers its other inputs by local qubit, and a gate whose controls lie between its target's wires is drawn as one box. Angles are shown as multiples of π.

QC.printQCircDiagram (QC.simplify (QC.fromQOp (qft 4)))
-- q0: ───────────────────────●──────────────────●──────────●─────H──Perm[3,2,1,0]──
--                            │                  │          │              │
-- q1: ───────────────●───────┼──────────●───────┼─────H──P(π/2)──────────#1────────
--                    │       │          │       │                         │
-- q2: ───────●───────┼───────┼─────H──P(π/2)──P(π/4)─────────────────────#2────────
--            │       │       │                                            │
-- q3: ──H──P(π/2)──P(π/4)──P(π/8)────────────────────────────────────────#3────────

QC.printQCircDiagramVertical draws the same layout with the wires as columns and time running down the page, which suits long circuits:

QC.printQCircDiagramVertical (QC.QCirc 3 [QC.Gate (C (C (Phase (1/4)))) [0,2], QC.Gate H [1]])
-- q0  q1    q2
-- │   │     │
-- ●───┼───P(π/4)
-- │   │     │
-- │   H     │
-- │   │     │

QC.showQuantikz emits the same layout as a quantikz environment for LaTeX, using \ctrl, \targ, \swap, \phase and \gate; a spanning box gets \linethrough on the wires it does not act on and \gateinput numbers, and global phases become % comments before the environment:

putStrLn (QC.showQuantikz (QC.QCirc 2 [QC.Gate H [0], QC.Gate (C X) [0,1]]))
-- \begin{quantikz}
-- \lstick{$q_{0}$} & \gate{H} & \ctrl{1} & \qw \\
-- \lstick{$q_{1}$} & \qw & \targ{} & \qw
-- \end{quantikz}

Syntax trees in the terminal

printOpTree draws the syntax tree of a QOp as text. Each constructor is a node with its operands below it from left to right, so the rightmost operand of a composition acts first. A rotation shows its angle and has its axis as its child.

printOpTree (C X ∘ (H ⊗ I))
--    ∘
-- ┌──┴──┐
-- C     ⊗
-- │   ┌─┴─┐
-- X   H   I

printOpTreeWithQubits adds, after each node, the qubit count of the term rooted there:

printOpTreeWithQubits (C X ∘ (H ⊗ I))
--       ∘ : 2
-- ┌─────┴─────┐
-- C : 2       ⊗ : 2
-- │       ┌───┴───┐
-- X : 1   H : 1   I : 1

U.printUOpTree and U.printUOpTreeWithQubits draw a UOp, with dimensions in brackets as in I[3] and ∘[8]; a node whose dimension is not a power of two is annotated : d=.... Each of the four has a show... counterpart that returns the drawing as a string. Leaves are spelled as showOp and showUOp spell them, and the counts assume well-formed input, as n_qubits does. Printing neither normalizes nor type-checks the term.

A drawing is as wide as its leaves put side by side: qft 2 takes 72 columns and qft 3 takes 164. Draw the parts of a large term separately.

These are the same trees as in the TikZ diagrams of the next section.

TikZ operator diagrams

showTikZQOp and showTikZUOp produce LaTeX fragments for both syntaxes:

import qualified QPP as Q
import qualified QPP.UOp as U

writeFile "qop.tex" (Q.showTikZQOp (Q.Compose (Q.C Q.X) (Q.Tensor Q.H Q.I)))
writeFile "uop.tex" (U.showTikZUOp (U.DirectSum [U.identity 1, U.phase (1/4)]))

Copy latex/qpp-tikz.sty beside the document, load \usepackage{qpp-tikz}, then use \input{qop.tex}. Each operator is a node in a syntax tree, with its operands as children from left to right. Outlined nodes use pale constructor colors, joined by compact horizontal branches with vertical drops. The rightmost child of a composition acts first. Printing preserves the input syntax, including arbitrary UOp dimensions and zero-dimensional spaces, and does not type-check or normalize it.

Every node has a gray qubit count outside its outline, such as [⊕]: 4. Counts assume well-formed input and are computed from the children without building matrices. For UOp, dimension 2^n gives count n; other dimensions are explicitly labelled d=.... Thus dimension one has zero qubits, while dimension zero is labelled d=0. Use showTikZQOpWithoutQubits or showTikZUOpWithoutQubits to omit the outside annotations.

Restyle diagrams with ordinary TikZ keys, without changing generated files:

\tikzset{
  qpp/gate/.append style={fill=yellow!20},
  qpp/node/.append style={font=\footnotesize},
  qpp/edge/.append style={thick, draw=blue!60!black},
  qpp/annotation/.append style={text=black!70}
}
\forestset{qpp tree/.append style={for tree={l sep=5mm, s sep=7mm, fork sep=2.5mm}}}

Shared TikZ styles are qpp/node, qpp/edge, and qpp/annotation; the Forest style qpp tree controls layout: l sep sets the vertical gap, s sep the horizontal spacing, and fork sep the drop from the parent to the horizontal branch. Constructor styles are gate, identity, phase, permutation, tensor, sum, compose, rotation, control, and adjoint, each under qpp/. Both syntaxes use R(t) for the same rotation convention; identity subscripts and UOp composition subscripts are matrix dimensions.

Both tree printers draw the trees built by QPP.PrettyPrint.SyntaxTree, which translates each syntax into a Data.Tree of subterms with their sizes; each printer only names the nodes. QPP.PrettyPrint.TikZ recursively emits Forest's bracket notation. Forest handles spacing and edges; the .sty file holds the styles and measures annotation widths to keep neighboring nodes clear. The TikZ printer never estimates text widths or calculates coordinates. QPP.PrettyPrint.Tree lays out the text drawing itself, each subtree in its own rectangle.

Run cabal run TikZOperators from the repository root to generate examples and QFT fragments in output/tikz/, including circuit diagrams from showQuantikz. Run make -C latex to generate them and compile the gallery to output/pdf/operator-diagrams.pdf (requires latexmk and a TeX installation with Forest and quantikz). The gallery source is latex/operator-diagrams.tex. Large terms retain their full structure; they may need a larger page or explicit decomposition for presentation.

Type-checking

typeCheck, exported by QPP and QPP.TypeCheck, checks a QOp and returns its qubit count or the first TypeError:

typeCheck (C X)                    -- Right 2
typeCheck (R (X <.> Z) (1/3))      -- Right 2
typeCheck (X <+> Id 2)             -- Left (ArityMismatch (DirectSum X (Id 2)) 1 2)
typeCheck (R SX (1/3))             -- Left (UnprovenHermitian SX)
typeCheck (R SX 0)                 -- Right 1: zero-angle rotations are identity

Identity widths must be nonnegative; composition and direct sum require equal operand widths. Permute ks must contain each index in [0 .. length ks - 1] exactly once, so Permute [] is the zero-qubit identity. Tensor, control, and direct sum widths are also checked for Int overflow.

A rotation axis must be provably Hermitian when the angle is nonzero. At exactly zero, the rotation is identity for any well-formed axis. The axis is still checked recursively for valid widths, permutations, and nested rotations; a zero angle cannot hide an invalid subterm. The checker propagates the more general property A† = exp(i*pi*p) A, using exact rational phases modulo 2. The exported adjointPhase :: QOp -> Either TypeError (Maybe Rational) exposes this proof: Just 0 proves Hermiticity, another Just p proves non-Hermiticity, and Nothing means unknown. An invalid subterm still returns Left.

A phase-labelled Pauli expression has the form exp(i*pi*q) (P₀ ⊗ … ⊗ Pₙ₋₁), where each Pᵢ is I, X, Y, or Z. For example, X <> Y = iZ, while (X ⊗ X) <> (Z ⊗ Z) = -(Y ⊗ Y). Products can therefore introduce phases even without an explicit Phase. The checker normalizes these expressions to a rational phase and a sparse map of nonidentity Pauli factors. Every bare Pauli string is Hermitian, so the expression is Hermitian exactly when q is an integer.

This gives a complete Hermiticity decision for the well-formed sublanguage generated by Id, Phase, X, Y, Z, Tensor, Compose, and Adjoint, with arbitrary nesting. It does not claim to recognize every expression outside that grammar which happens to denote a Pauli operator.

For other operators, the sufficient rules include:

Construction Adjoint-phase rule (all phases modulo 2)
a ⊗ b Add the operand phases.
a ⊕ b Both blocks must have the same phase; retain it.
adj a Negate the phase.
C a The operand's phase must be 0 because the other block is identity.
a <> b Add the phases and the commutation phase, when commutation or anticommutation is proved.
u <> a <> adj u Retain a's phase, for either association.
a <> R k t, or R k t <> a Retain a's phase if a anticommutes with k.

Commutation is proved by exact Pauli arithmetic, equal operands, scalar operands, or disjoint support. The checker also recognizes inverse pairs, SX <> SX, involutive permutations, integral-angle rotations, and adjacent rotations about the same syntactic axis whose angles sum to an integer. Some controls, direct sums, and rotations also normalize to Pauli forms.

adjointPhase (X <> Y)                        -- Right (Just 1): anti-Hermitian
typeCheck (R ((X <.> X) <> (Z <.> Z)) (1/3)) -- Right 2
typeCheck (R (X <> R Z (1/3)) (1/5))         -- Right 1

Soundness follows by induction: each stored Pauli form denotes the original operator, and each phase rule preserves A† = exp(i*pi*p) A. For example, if b a = exp(i*pi*w) a b, then (a b)† = exp(i*pi*(p_a+p_b+w)) a b. Nonzero-angle rotations are admitted only after their axes have phase 0; zero-angle rotations are identity. Thus all checked operators remain unitary.

Outside the complete fragment, UnprovenHermitian can still mean a Hermitian axis needs additional algebra. For example, (H ⊗ H) <> (Y ⊗ Y) is Hermitian but is not currently proved. Analysis is polynomial in the expression size and rational bit lengths; no matrices or expansions into sums of Pauli strings are constructed. Even large Id n nodes use constant-size Pauli forms.

Call the checker explicitly before evaluation or rewriting. It checks QOp well-formedness; individual backends can have additional restrictions on supported operators or rotation axes.

Programs

A program is a list of steps:

data Step
  = Unitary QOp
  | Initialize [Nat] [Bit]    -- set the given qubits to classical values
  | Measure    [Nat]

type Program  = [Step]
type Outcomes = [Bit]         -- most recent first
type RNG      = [Double]      -- an infinite stream in [0,1)

Bit is the type of a classical bit: the literals 0 and 1, with + and * modulo 2. Measurement draws from a random stream that the caller supplies, so a run can be repeated exactly.

Example: the quantum Fourier transform

The QFT on n qubits is the QFT on the first n−1 qubits, after a layer that puts a Hadamard on the last qubit and then a phase on it controlled by each of the earlier qubits. QPP lets you write exactly that:

import QPP
import QPP.Semantics.Matrix        -- exactly one backend; swap this line to switch

-- | Phase gate diag(1, e^{2πi/2^k}): a Z-rotation times a global phase.
p :: Int -> QOp
p k = Phase (1/2^k) ⊗ R Z (2/2^k)

-- | Hadamard on the last of n qubits, then a phase on it controlled by each earlier qubit.
layer :: Int -> QOp
layer n = foldr (∘) ((n-1) <@ H) [ k <@ C ((n-k-2) <@ p (n-k)) | k <- [0..n-2] ]

-- | QFT on n qubits, output bits in reverse order.
qftrev :: Int -> QOp
qftrev 0 = One
qftrev n = (qftrev (n-1) ⊗ I) ∘ layer n

-- | QFT on n qubits.
qft :: Int -> QOp
qft n = Permute [n-1, n-2 .. 0] ∘ qftrev n

main :: IO ()
main = do
  putStrLn (showOp (cleanop (qft 2)))          -- the simplified term
  printM (evalOp (qft 2))                      -- its matrix
  let (_, outcomes, _) = evalProg [Unitary (qft 3), Measure [0,1,2]] (ket [0,0,1]) (cycle [0.3, 0.7])
  print outcomes                               -- a run, with an explicit random stream
(Permute [1,0] ∘ ((H ⊗ I) ∘ (C ((Phase (1 % 4) ⊗ R Z (1 % 2))) ∘ (I ⊗ H))))
0.5 *
 [[1, 1, 1, 1],
  [1, 1,-1,-1],
  [1,-1, 0, 0],
  [1,-1, 0, 0]]

0.5 *
i *
 [[0,0, 0, 0],
  [0,0, 0, 0],
  [0,0, 1,-1],
  [0,0,-1, 1]]

[0,1,0]

The same qft is in Programs.QFT, where Programs.QuantumAdder builds addition from it.

Backends

A backend is a module, not a class instance. Every backend defines the same two types and six functions:

StateT, OpT                                          -- states and operators
ket      :: [Bit] -> StateT                          -- a computational-basis state
evalOp   :: QOp -> OpT                               -- interpret a term
apply    :: OpT -> StateT -> StateT
measure1 :: (StateT, Outcomes, RNG) -> Nat -> (StateT, Outcomes, RNG)
evalStep :: (StateT, Outcomes, RNG) -> Step -> (StateT, Outcomes, RNG)
evalProg :: Program -> StateT -> RNG -> (StateT, Outcomes, RNG)
Module Representation
QPP.Semantics.Matrix dense hmatrix matrices; the reference semantics
QPP.Semantics.Statevector hmatrix state vectors; one rule per QOp constructor, applied to the amplitudes without forming an operator matrix larger than 2×2
QPP.Semantics.MPS matrix product states with truncation
QPP.Semantics.Stabilizer empty; writing the stabilizer-tableau backend is a course exercise

A program imports QPP and exactly one backend. QPP re-exports the syntax, rewriting and pretty-printing layers but no backend, so the choice of backend is always visible in the import list.

A new backend defines the two types, implements ket, evalOp, apply and measure1, and takes the two interpreters from QPP.Semantics:

evalStep = evalStepWith (apply . evalOp) measure1
evalProg = evalProgWith (apply . evalOp) measure1

To have it validated, give OpT a Convertible OpT CMat instance and add the module to qpp/test/BackendValidation.hs, which compares each backend it imports against the dense reference on random operators. The convention is spelled out in the header comment of QPP.Semantics.

Compiler passes and analyses

A compiler pass is a function QOp -> QOp. QPP.Rewrite contains the semantics-preserving ones that come with the library — merging identities, reducing angles (rotations modulo four, phases modulo two), pushing adjoints inward, flattening compositions — and simplifyFixpoint, which applies a list of passes until nothing changes; cleanop runs all of the built-in ones. Two of them, pushComposes and liftComposes, bring a term into the normal forms "tensor products of compositions" and "compositions of tensor products", the natural starting point for a translation to a stabilizer or ZX representation. An analysis is a function that reads a term: QPP.Syntax has op_qubits, op_support, dagger and adjointPair, and QPP.PrettyPrint has the printers used above. The pairwise gate identities (an adjoint pair is the identity, SX <> SX = X, same-axis rotations and phases add, permutations compose) are written once, as fuseOps in QPP.Rewrite; doComposes, the circuit fuser and the type checker all consult it.

Building and running

QPP needs GHC 9.6 or later, cabal 3.10 or later, and BLAS/LAPACK for hmatrix.

git clone git@github.com:diku-dk/QPP.git
cd QPP
cabal build lib:qpp          # the library
cabal build all              # library, exercises, problem sheets, test suites
cabal test all               # the thirteen test suites
cabal run NoCloning          # a worked exercise
cabal run QubitsProblem      # a weekly problem sheet
cabal repl lib:qpp           # the library in GHCi

Layout

qpp/
  src/QPP/           the library: Syntax, Rewrite, Semantics, the backends, PrettyPrint, Util
  src/Programs/      example programs: QFT, quantum adder, repeater protocol,
                     block encodings, QSVT phase sequences
  exercises/         worked course demos, one executable each
  problems/          weekly problem sheets: they compile and run, with the
                     interesting functions left as stubs (see problems/README.md)
  solutions/         answer keys; not part of the cabal build
  test/              tasty/QuickCheck suites (see test/README.md)
  limbo/             parked designs and legacy code; not built
  attic/             retired code, kept for reference; not built (see attic/README.md)
  CHANGELOG.md       HQPlayground → QPP module and symbol map
docs/                notes on block encodings, QSVT and matrix inversion; design notes

Coming from HQPlayground

QPP was previously named HQPlayground. The module names changed with the rename; the mapping, including moved symbols, is in qpp/CHANGELOG.md. The rationale for Id n, Phase, rational angles and relative Permute indices is in docs/v2-to-v3-changes.md.

Authors and license

QPP is developed by James Avery, Thomas Mork, Michael Kirkedal Thomasen, and Fritz Henglein at the Department of Computer Science, University of Copenhagen (DIKU). It is released under the BSD 3-Clause license.

About

The Quantum Programming Playground

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages