A simulator that propagates a wavefunction representation of a quantum state.
Simulate a Quil program and return the wavefunction.
expectation(prep_prog, pauli_terms[, memory_map])
Calculate the expectation value of Pauli operators given a state prepared by prep_program.
run_and_measure(quil_program[, qubits, …])
Run a Quil program once to determine the final wavefunction, and measure multiple times.
Encapsulate a wavefunction representing a quantum state as returned by
The elements of the wavefunction are ordered by bitstring. E.g., for two qubits the order is
00, 01, 10, 11, where the the bits are ordered in reverse by the qubit index, i.e., for qubits 0 and 1 the bitstring
01indicates that qubit 0 is in the state 1. See also the related documentation section in the QVM Overview.
Initializes a wavefunction
Parameters: amplitude_vector – A numpy array of complex amplitudes
Attributes and Methods
Returns an array of probabilities in lexicographical order
Returns a string repr of the wavefunction, ignoring all outcomes with approximately zero amplitude (up to a certain number of decimal digits) and rounding the amplitudes to decimal_digits.
Prints outcome probabilities, ignoring all outcomes with approximately zero probabilities (up to a certain number of decimal digits) and rounding the probabilities to decimal_digits.
Sample bitstrings from the distribution defined by the wavefunction.
Constructs the groundstate wavefunction for a given number of qubits.