SpinCircuitSolver

class SpinCircuitSolver(spin=Fraction(1, 2), shots=None, seed=None)[source]

Performs numerical simulations of spin systems by exactly computing the time evolution under unitary operations generated by exponentiating spin Hamiltonians.

Initialize a spin circuit solver.

Parameters:
  • spin (Union[float, Fraction]) – The length of the spin of each wire in the circuit.

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

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

Raises:

QiskitColdAtomError – if the spin is not a positive integer or half-integer.

Attributes

SpinCircuitSolver.dim

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

SpinCircuitSolver.ignore_barriers

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

SpinCircuitSolver.max_dimension

The maximal Hilbert space dimension of the simulation.

SpinCircuitSolver.seed

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

Methods

SpinCircuitSolver.__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.

SpinCircuitSolver.draw_shots(...)

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

SpinCircuitSolver.get_initial_state(circuit)

Return the initial state as a sparse column vector.

SpinCircuitSolver.operator_to_mat(operator)

Convert a SpinOp describing a gate generator to a sparse matrix.

SpinCircuitSolver.preprocess_circuit(circuit)

Compute the Hilbert space dimension of the given quantum circuit as \((2S+1)^N\) where \(S\) is the length of the spin and \(N\) is the number of spins in the quantum circuit.

SpinCircuitSolver.to_operators(circuit)

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

SpinCircuitSolver.__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.