The cl-forest Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-forest Reference Manual

This is the cl-forest Reference Manual, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 08:01:37 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

CL-FOREST

Unofficial bindings to Rigetti Forest, a quantum computing service. These bindings are directly based off of the forest module of pyQuil.

Currently, this library is written for pedagogical example of the API, not for efficiency.

Examples

Below are a few examples using the Rigetti Forest API.

Here we construct a Bell pair, and measure the pair. The interesting property about Bell states is that they always measure to the same value. Here we measure the Bell pair 10 times.

CL-FOREST> (run (quil "H 0"
                      "CNOT 0 1"
                      "MEASURE 0 [0]"
                      "MEASURE 1 [1]")
                '(0 1)
                10)

((0 0) (1 1) (1 1) (1 1) (1 1) (0 0) (0 0) (1 1) (0 0) (0 0))

Next, we show that a Bell pair is exactly the state (|00> + |11>)/sqrt(2) by looking directly at the wavefunction.

CL-FOREST> (wavefunction (quil "H 0"
                               "CNOT 0 1"))

#(#C(0.7071067811865475d0 0.0d0) #C(0.0d0 0.0d0) #C(0.0d0 0.0d0)
  #C(0.7071067811865475d0 0.0d0))

We can recover the probabilities of each of these by computing the square modulus of each amplitude:

CL-USER> (map 'vector (lambda (a) (expt (abs a) 2)) *)

#(0.4999999999999999d0 0.0d0 0.0d0 0.4999999999999999d0)

We see immediately that |00> and |11> both have a 50% chance of being observed.

API Key

Before starting, you'll need to set your API key by setting the variable cl-forest:*api-key*.

(setf cl-forest:*api-key* "<< YOUR API KEY >>")

You can check that it works by pinging the server:

> (cl-forest:ping)
"pong 3696180851"

Once your API key is set, you can construct Quil programs (which are currently just represented as strings) conveniently using the quil function, and then use run or wavefunction to run that program.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-forest

Author

Robert Smith

License

Apache 2.0

Description

Unofficial Common Lisp bindings to Rigetti Forest.

Dependencies
Source

cl-forest.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 cl-forest.asd

Location

cl-forest.asd

Systems

cl-forest (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 cl-forest/package.lisp

Parent

cl-forest (system)

Location

package.lisp

Packages

cl-forest


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 cl-forest/cl-forest.lisp

Dependency

package.lisp (file)

Parent

cl-forest (system)

Location

cl-forest.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 cl-forest

Package for symbols to interact with Rigetti Forest.

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *api-key*
Package

cl-forest

Source

cl-forest.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: ping ()

Ping the Forest server.

Package

cl-forest

Source

cl-forest.lisp (file)

Function: quil &rest INSTRUCTIONS

A helper function to make Quil program strings.

Package

cl-forest

Source

cl-forest.lisp (file)

Function: run PROGRAM ADDRESSES &optional NUM-TRIALS

Run the Quil program PROGRAM (as a string) a total number of NUM-TRIALS (default: 1) times, reading the classical bits addressed by the list of addresses ADDRESSES.

Return a list of lists of sampled bits corresponding to the requested ADDRESSES.

Package

cl-forest

Source

cl-forest.lisp (file)

Function: version ()

Query the version of the remote Forest software.

Package

cl-forest

Source

cl-forest.lisp (file)

Function: wavefunction PROGRAM &optional ADDRESSES

Get the wavefunctions for the program PROGRAM. Optionally, provide a list of addresses of bits that should be returned as a second value.

Return two values:

1. The wavefunction as an array of complex numbers.

2. The requested memory addresses.

Package

cl-forest

Source

cl-forest.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Constants

Constant: +octets-per-complex-double+
Package

cl-forest

Source

cl-forest.lisp (file)

Constant: +octets-per-double+
Package

cl-forest

Source

cl-forest.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Special variables

Special Variable: *endpoint*
Package

cl-forest

Source

cl-forest.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Macros

Macro: quill &rest INSTRUCTIONS

A helper function to make Quil program from LoL

Package

cl-forest

Source

cl-forest.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Functions

Function: check-api-key ()
Package

cl-forest

Source

cl-forest.lisp (file)

Function: dict &rest KEY-VALS
Package

cl-forest

Source

cl-forest.lisp (file)

Function: post-json JSON

POST the JSON data structure (as interpreted by YASON) to Rigetti Forest.

Return two values:

1. The response payload, either as a string, an octet vector, or a stream.

2. The content length or NIL.

Package

cl-forest

Source

cl-forest.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-forest.asd: The cl-forest<dot>asd file
cl-forest/cl-forest.lisp: The cl-forest/cl-forest<dot>lisp file
cl-forest/package.lisp: The cl-forest/package<dot>lisp file

F
File, Lisp, cl-forest.asd: The cl-forest<dot>asd file
File, Lisp, cl-forest/cl-forest.lisp: The cl-forest/cl-forest<dot>lisp file
File, Lisp, cl-forest/package.lisp: The cl-forest/package<dot>lisp file

L
Lisp File, cl-forest.asd: The cl-forest<dot>asd file
Lisp File, cl-forest/cl-forest.lisp: The cl-forest/cl-forest<dot>lisp file
Lisp File, cl-forest/package.lisp: The cl-forest/package<dot>lisp file

Jump to:   C   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   D   F   M   P   Q   R   V   W  
Index Entry  Section

C
check-api-key: Internal functions

D
dict: Internal functions

F
Function, check-api-key: Internal functions
Function, dict: Internal functions
Function, ping: Exported functions
Function, post-json: Internal functions
Function, quil: Exported functions
Function, run: Exported functions
Function, version: Exported functions
Function, wavefunction: Exported functions

M
Macro, quill: Internal macros

P
ping: Exported functions
post-json: Internal functions

Q
quil: Exported functions
quill: Internal macros

R
run: Exported functions

V
version: Exported functions

W
wavefunction: Exported functions

Jump to:   C   D   F   M   P   Q   R   V   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *   +  
C   S  
Index Entry  Section

*
*api-key*: Exported special variables
*endpoint*: Internal special variables

+
+octets-per-complex-double+: Internal constants
+octets-per-double+: Internal constants

C
Constant, +octets-per-complex-double+: Internal constants
Constant, +octets-per-double+: Internal constants

S
Special Variable, *api-key*: Exported special variables
Special Variable, *endpoint*: Internal special variables

Jump to:   *   +  
C   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
cl-forest: The cl-forest system
cl-forest: The cl-forest package

P
Package, cl-forest: The cl-forest package

S
System, cl-forest: The cl-forest system

Jump to:   C   P   S