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 performedseed (
Optional
[int
]) – seed for the RNG for the measurement simulationnum_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
Return the basis of fermionic occupation number states.
Return the dimension set by the last quantum circuit on which the solver was called.
Boolean flag that defines how barrier instructions in the circuit are handled.
The maximal Hilbert space dimension of the simulation.
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.
Helper function to draw counts from a given distribution of measurement outcomes.
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.
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.