modules.applications.qml.qleet.simulators.circuit_simulators.CircuitSimulator

class CircuitSimulator(circuit: CircuitDescriptor, noise_model: NoiseModel | None = None)

Bases: object

The interface for users to execute their CircuitDescriptor objects

__init__(circuit: CircuitDescriptor, noise_model: NoiseModel | None = None) None

Initialize the state simulator :type circuit: CircuitDescriptor :param circuit: the target circuit to simulate :type noise_model: Noise model as a dict or in the library format :param noise_model: the noise model as dict or empty dict for density matrix simulations,

None if performing state vector simulations

Methods

__init__(circuit[, noise_model])

Initialize the state simulator :type circuit: CircuitDescriptor :param circuit: the target circuit to simulate :type noise_model: Noise model as a dict or in the library format :param noise_model: the noise model as dict or empty dict for density matrix simulations, None if performing state vector simulations

simulate(param_resolver[, shots])

Simulate to get the state vector or the density matrix :type param_resolver: Dict to resolve all parameters to a static float value :param param_resolver: a dictionary of all the symbols/parameters mapping to their values :type shots: int :param shots: number of times to run the qiskit density matrix simulator :returns: state vector or density matrix resulting from the simulation :rtype: np.array :raises NotImplementedError: if circuit simulation is not supported for a backend

Attributes

result

Get the results stored from the circuit simulator :return: stored result of the circuit simulation if it has been performed, else None.

property result: ndarray | None

Get the results stored from the circuit simulator :return: stored result of the circuit simulation if it has been performed, else None. :rtype: np.array or None

simulate(param_resolver: Dict[Parameter, float], shots: int = 1024) ndarray

Simulate to get the state vector or the density matrix :type param_resolver: Dict to resolve all parameters to a static float value :param param_resolver: a dictionary of all the symbols/parameters mapping to their values :type shots: int :param shots: number of times to run the qiskit density matrix simulator :returns: state vector or density matrix resulting from the simulation :rtype: np.array :raises NotImplementedError: if circuit simulation is not supported for a backend