haquil-0.2.1.14: A Haskell implementation of the Quil instruction set for quantum computing.

Safe HaskellNone
LanguageHaskell2010

Language.Quil.Types

Contents

Description

Types for the Quil language for quantum computing, <https://arxiv.org/abs/1608.03355/>, and generally conforming to <https://github.com/rigetticomputing/pyquil/blob/master/pyquil/_parser/Quil.g4>.

Synopsis

Machines

data Machine Source #

A quantum abstract machine.

Constructors

Machine 

Fields

machine Source #

Arguments

:: Int

The number of qubits.

-> [BitData]

The classical bits.

-> Machine

The machine.

Initialize a machine.

data Definitions Source #

Definitions of gates and circuits.

Constructors

Definitions 

Fields

Instances

type Gate = [QBit] -> Arguments -> Operator Source #

A gate.

type Circuit = Definitions -> [QBit] -> Arguments -> Operator Source #

A circuit

Instructions

data Instruction Source #

The Quil instruction set.

type Name = String Source #

Name of a gate or circuit.

type QBit = Int Source #

Index of a qubit.

type QVariable = String Source #

Qubit variable name.

type Address = Int Source #

Address of a classical bit.

type Variable = String Source #

Classical variable name.

type Label = String Source #

Label for a jump target.

Expressions

type Number = Complex Double Source #

Complex number.

type Parameters = Vector Variable Source #

Formal parameters.

type Arguments = Vector Number Source #

Argument list.

Classical Bits

toBitVector :: BitData -> BV Source #

Encode data as a bit vector.

boolFromBitVector Source #

Arguments

:: Int

Which bit to start from, counting from zero.

-> BV

The bit vector.

-> Bool

The boolean.

Extract a boolean from a bit vector.

finiteBitsFromBitVector Source #

Arguments

:: (Integral a, FiniteBits a) 
=> Int

Which bit to start from, counting from zero.

-> BV

The bit vector.

-> a

The finite bits.

Extract a finite bits from a bit vector.

integerFromBitVector Source #

Arguments

:: Int

Which bit to start from, counting from zero.

-> Int

How many bits to encode.

-> BV

The bit vector

-> Integer

The integer (unsigned).

Extract an integer from a bit vector.

doubleFromBitVector Source #

Arguments

:: Int

Which bit to start from, counting from zero.

-> BV

THe bit vector.

-> Double

The double.

Extract a double from a bit vector.

complexFromBitVector Source #

Arguments

:: Int

Which bit to start from, counting from zero.

-> BV

THe bit vector.

-> Number

The complex number.

Extract a complex number from a bit vector.