WavefunctionSimulator.wavefunction

WavefunctionSimulator.wavefunction(quil_program, memory_map=None)[source]

Simulate a Quil program and return the wavefunction.

Note

If your program contains measurements or noisy gates, this method may not do what you want. If the execution of quil_program is non-deterministic then the final wavefunction only represents a stochastically generated sample and the wavefunctions returned by different wavefunction calls will generally be different.

Parameters:
  • quil_program (Program) – A Quil program.
  • memory_map (Optional[Dict[MemoryReference, Any]]) – An assignment of classical registers to values, representing an initial state for the QAM’s classical memory.
Return type:

Wavefunction

Returns:

A Wavefunction object representing the state of the QVM.