Skip to content

msteudtner/pylove_simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pylove simultor

What is Pylove?

Pylove is a quantum circuit simulator specifically for noisy circuits acting on stabilizer codes. The types of circuits it is build to handle consist of rotations generated by logical operators. Noisy circuits are simulated via statevector simulation, where a mixed state density matrix is constructed from a mixture of pure states coming from a specified number of shots.

For an $[[n,k,d]]$ stabilizer code, the simulation complexity is exponential in $k$ and poly in $(n-k)$.

Pylove makes use of the OpenFermion software package for manipulating Pauli operators and Fermionic operators.

This simulator was used in a study of quantum error mitigation using encodings of fermionic systems into stabilizer codes. As such, included in this simulator code are a number of tools for generating fermionic encodings and encodings fermionic Hamiltonians into qubit Hamiltonians acting on a stabilizer code. Fermionic operators are mapped to logical operators of the code.

Let us now discuss the usage of the simulator code with a simple example that is given in more detail in tutorial.ipynb and example notebooks. Also refer to the documentation in docs.ipynb.

Specifying a stabilizer code

Specify a stabilizer group by a list of generators given as OpenFermion QubitOperator objects

stabs = [
    QubitOperator('X1 Z0 Z2 Z4'),
    QubitOperator('X3 Z2 Z4 Z8'),
    QubitOperator('X5 Z0 Z4 Z6'),
    QubitOperator('X7 Z4 Z6 Z8')
]

Fixing the initial state

The initial state is specified to be the $(+1)$ eigenstate of a commuting collection of Pauli operators. Such a state is assumed to be easily prepared. As the stabilizers usually do not uniquely fix a particular pure state, we supplement the stabilizers with a collection of logical operators.

log_ops = [
    QubitOperator('Z0'),
    QubitOperator('Z2', -1),
    QubitOperator('Z4'),
    QubitOperator('Z6', -1),
    QubitOperator('Z8', -1)]

Building the circuit

The circuit is assumed to consist of a sequence of rotations $$U_1 U_2\dots = \exp^{i\theta_1 Q_1}\exp^{i\theta_2 Q_2}\ldots$$ generated by logical operators ${Q_1,Q_2,\ldots}$.

Specified by a list of pairs, specifyin the angle and the logical operator

circuit_schedule = [
    angle[0]*logical_op[0],
    angle[1]*logical_op[1],
    ...
]

In the above, logical_op[i] must all commute with all of the stabilizers

Pauli noise channels

Pauli noise channels can be simulated, one specifies the Pauli Kraus operators as always as OpenFermion QubitOperator objects. Noise acting following CNOT gates can be constructed as below, where qubit 0 is the control qubit and qubit 1 is te target.

my_gate_noise = [
    [QubitOperator(()), QubitOperator('Y0'), QubitOperator('Y0 Y1')],
    [.998, .001, .001]]

Simulation

The most important function is pylove_simulation which contains all the relevant functions for simulation. It uses the stabilizers and the logical operators to fix the initial state. The quantum circuit is then simulated

output_state = pylove_simulation(
    stabilizers=stabs,
    logical_operators=log_ops,
    quantum_circuit=circuit,
    gate_noise=my_gate_noise,
    shots=100
)

One also has the option of specifying how many CPUs should be used for parallel processing with the keywork arg cpus=.

After the simulation, the resulting pylove_state object can be manipulated. One can calculate expectation values of observables or simulation fidelities with the tr function

tr(output_state, output_state.ideal())

Syndrome spaces

The simulator is originally intended to be used for studies of quantum error mitigation in the presence of a collection of $\mathbb{Z}_2$ symmetries or more specifically a stabilizer code. The code enables the simulation of postselection onto different subspaces:

  • code: Only the codespace is kept, this is the cheapest simulation in terms of memory
  • full: All syndrome spaces are kept, this is exponentially costly in the rank of the stabilizer group
  • custom: One can specify which syndrome spaces to keep by giving the syndrome patters of the desired subspaces

One can then simulate postselection with the postselect function. The result is a new state with a larger overlap with the ideal state

postselected_state = postselect(state=new_graphstate, mode='code')
tr(output_state.ideal(), postselected_state)

Further reference

See the notebook tutorial.ipynb for an example of Pylove in action and refer to the documentation in docs.ipynb.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published