Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.31 KB

README.org

File metadata and controls

52 lines (40 loc) · 1.31 KB

MicroQiskit for Racket

This version of MicroQiskit is compatible with the Racket Programming Language, which is based on the Scheme dialect of LISP.

Setup

Download the microqiskit.rkt, and place it in your project directory. And you can import it just like any other Racket modules. In Racket, you can import your module just like the following:

(require "microqiskit.rkt")

Examples

Generating Quantum Circuit

(define qc (new quantum-circuit% [qubits 2] [clbits 2]))

Applying Gates

;; (send qc <gatename> <qubit#>)
(send qc h 0)

Full example

;; quantumcircuit-example.rkt

#lang racket

(require "microqiskit.rkt")

(define qc (new quantum-circuit% [qubits 2] [clbits 2]))
(send qc h 0)
(send qc x 1)
(send qc cx 0 1)
(send qc z 1)
(send qc measure 0 0)
(send qc measure 1 1)

(displayln "statevector")
(simulate qc 1024 "statevector")

(displayln "\nprob-dict")
(simulate qc 1024 "prob-dict")

(displayln "\ncounts")
(simulate qc 1024 "counts")

Documentation