FermionCircuitSolver

class FermionCircuitSolver(shots=None, seed=None, num_species=1)[source]

Numerically simulate fermionic systems by exactly computing the time evolution under unitary operations generated by fermionic Hamiltonians.

Parameters:
  • shots (Optional[int]) – amount of shots for the measurement simulation; if not None, measurements are performed

  • seed (Optional[int]) – seed for the RNG for the measurement simulation

  • num_species (int) – number of different fermionic species, defaults to 1 for a single type of (spinless) fermions, 2 for spin-1/2 fermions etc. If > 1, the solver will check for conservation of the particle number per fermionic species in order to reduce the Hilbert space dimension of the simulation

Attributes

FermionCircuitSolver.basis

Return the basis of fermionic occupation number states.

FermionCircuitSolver.dim

Return the dimension set by the last quantum circuit on which the solver was called.

FermionCircuitSolver.ignore_barriers

Boolean flag that defines how barrier instructions in the circuit are handled.

FermionCircuitSolver.max_dimension

The maximal Hilbert space dimension of the simulation.

FermionCircuitSolver.seed

The seed for the random number generator of the measurement simulation.

Methods

FermionCircuitSolver.__call__(circuit)

Performs the simulation of the circuit: Each operator is converted into a sparse matrix over the basis and is then exponentiated to get the unitary of the gate.

FermionCircuitSolver.draw_shots(...)

Helper function to draw counts from a given distribution of measurement outcomes.

FermionCircuitSolver.get_initial_state(circuit)

Return the initial state of the quantum circuit as a sparse column vector.

FermionCircuitSolver.operator_to_mat(operator)

Convert the fermionic operator to a sparse matrix.

FermionCircuitSolver.preprocess_circuit(circuit)

Pre-processing fermionic circuits includes setting up the basis for the simulation by extracting the size, particle number and spin conservation from the circuit.

FermionCircuitSolver.to_operators(circuit)

Convert a circuit to a list of second quantized operators that describe the generators of the gates applied to the circuit.

FermionCircuitSolver.__call__(circuit)

Performs the simulation of the circuit: Each operator is converted into a sparse matrix over the basis and is then exponentiated to get the unitary of the gate.