Safe Haskell | None |
---|---|
Language | Haskell2010 |
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>.
- data Machine = Machine {
- qstate :: Wavefunction
- cstate :: BV
- definitions :: Definitions
- counter :: Int
- halted :: Bool
- machine :: Int -> [BitData] -> Machine
- data Definitions = Definitions {}
- type Gate = [QBit] -> Arguments -> Operator
- type Circuit = Definitions -> [QBit] -> Arguments -> Operator
- data Instruction
- = COMMENT String
- | RESET
- | I QBit
- | X QBit
- | Y QBit
- | Z QBit
- | H QBit
- | PHASE Parameter QBit
- | S QBit
- | T QBit
- | CPHASE00 Parameter QBit QBit
- | CPHASE01 Parameter QBit QBit
- | CPHASE10 Parameter QBit QBit
- | CPHASE Parameter QBit QBit
- | RX Parameter QBit
- | RY Parameter QBit
- | RZ Parameter QBit
- | CNOT QBit QBit
- | CCNOT QBit QBit QBit
- | PSWAP Parameter QBit QBit
- | SWAP QBit QBit
- | ISWAP QBit QBit
- | CSWAP QBit QBit QBit
- | CZ QBit QBit
- | DEFGATE Name [Variable] [Expression]
- | USEGATE Name [Parameter] [QBit]
- | DEFCIRCUIT Name [Variable] [QVariable] [CircuitInstruction]
- | USECIRCUIT Name [Parameter] [QBit]
- | MEASURE QBit (Maybe Address)
- | HALT
- | WAIT
- | LABEL Label
- | JUMP Label
- | JUMP_WHEN Label Address
- | JUMP_UNLESS Label Address
- | FALSE Address
- | TRUE Address
- | NOT Address
- | AND Address Address
- | OR Address Address
- | MOVE Address Address
- | EXCHANGE Address Address
- | NOP
- | INCLUDE FilePath
- | PRAGMA String
- data CircuitInstruction
- data CircuitQBit
- data Parameter
- type Name = String
- type QBit = Int
- type QVariable = String
- type Address = Int
- type Variable = String
- type Label = String
- data Expression
- type Number = Complex Double
- type Parameters = Vector Variable
- type Arguments = Vector Number
- data BitData
- toBitVector :: BitData -> BV
- boolFromBitVector :: Int -> BV -> Bool
- finiteBitsFromBitVector :: (Integral a, FiniteBits a) => Int -> BV -> a
- integerFromBitVector :: Int -> Int -> BV -> Integer
- doubleFromBitVector :: Int -> BV -> Double
- complexFromBitVector :: Int -> BV -> Number
Machines
A quantum abstract machine.
Machine | |
|
Initialize a machine.
data Definitions Source #
Definitions of gates and circuits.
Instructions
data Instruction Source #
The Quil instruction set.
data CircuitInstruction Source #
Instructions within circuit definitions.
data CircuitQBit Source #
References to qubits within circuit definitions.
Classical parameter.
Expressions
data Expression Source #
Classical expression.
type Parameters = Vector Variable Source #
Formal parameters.
Classical Bits
Data types for encoding as bit vectors.
toBitVector :: BitData -> BV Source #
Encode data as a bit vector.
Extract a boolean from a bit vector.
finiteBitsFromBitVector Source #
:: (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.
:: 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.
Extract a double from a bit vector.