Interface to pyQuil and the Rigetti Forest.

class quantumflow.forest.QuantumFlowQVM

A Quantum Virtual Machine that runs pyQuil programs.

load(binary: pyquil.quil.Program) → quantumflow.forest.QuantumFlowQVM

Load a pyQuil program, and initialize QVM into a fresh state.

Parameters:binary – A pyQuil program
read_from_memory_region(*, region_name: str, offsets: Sequence[int] = None) → Sequence[int]

Reads from a memory region named region_name on the QAM.

This is a shim over the eventual API and only can return memory from a region named “ro” of type BIT.

Parameters:region_name – The string naming the declared memory region.
Returns:A list of values of the appropriate type.
run() → quantumflow.forest.QuantumFlowQVM

Run a previously loaded program

wait() → quantumflow.forest.QuantumFlowQVM

Blocks until the QPU enters the halted state.

wavefunction() → pyquil.wavefunction.Wavefunction

Return the wavefunction of a completed program.

write_memory(*, region_name: str, offset: int = 0, value: int = None) → quantumflow.forest.QuantumFlowQVM

Writes a value into a memory region on the QAM at a specified offset.

  • region_name – Name of the declared memory region on the QAM.
  • offset – Integer offset into the memory region to write to.
  • value – Value to store at the indicated location.
quantumflow.forest.circuit_to_pyquil(circuit: qf.Circuit) → pyquil.quil.Program

Convert a QuantumFlow circuit to a pyQuil program

quantumflow.forest.pyquil_to_circuit(program: pyquil.quil.Program) → qf.Circuit

Convert a protoquil pyQuil program to a QuantumFlow Circuit

quantumflow.forest.pyquil_to_image(program: pyquil.quil.Program) → <module 'PIL.Image' from '/home/docs/checkouts/'>

Returns an image of a pyquil circuit.

See circuit_to_latex() for more details.

quantumflow.forest.wavefunction_to_state(wfn: pyquil.wavefunction.Wavefunction) → qf.State

Convert a pyQuil Wavefunction to a QuantumFlow State

quantumflow.forest.state_to_wavefunction(state: qf.State) → pyquil.wavefunction.Wavefunction

Convert a QuantumFlow state to a pyQuil Wavefunction