ddsim package
Submodules
ddsim.error module
Exception for errors raised by DDSIM simulator.
ddsim.hybridqasmsimulator module
Backend for DDSIM Hybrid Schrodinger-Feynman Simulator.
- class ddsim.hybridqasmsimulator.HybridQasmSimulatorBackend(configuration=None, provider=None)[source]
Bases:
BackendV1
Python interface to MQT DDSIM Hybrid Schrodinger-Feynman Simulator
- SHOW_STATE_VECTOR = False
- run(quantum_circuits: QuantumCircuit | List[QuantumCircuit], **options)[source]
Run on the backend.
This method returns a
Job
object that runs circuits. Depending on the backend this may be either an async or sync call. It is at the discretion of the provider to decide whether running should block until the execution is finished or not: the Job class can handle either situation.- Parameters:
run_input (QuantumCircuit or Schedule or list) – An individual or a list of
QuantumCircuit
orSchedule
objects to run on the backend. For legacy providers migrating to the new versioned providers, provider interface aQasmQobj
orPulseQobj
objects should probably be supported too (but deprecated) for backwards compatibility. Be sure to update the docstrings of subclasses implementing this method to document that. New provider implementations should not do this though asqiskit.qobj
will be deprecated and removed along with the legacy providers interface.options – Any kwarg options to pass to the backend for running the config. If a key is also present in the options attribute/object then the expectation is that the value specified will be used instead of what’s set in the options object.
- Returns:
The job object for the run
- Return type:
Job
ddsim.hybridstatevectorsimulator module
Backend for DDSIM Hybrid Schrodinger-Feynman Simulator.
ddsim.job module
- class ddsim.job.DDSIMJob(backend, job_id, fn, qobj_experiment, **args)[source]
Bases:
JobV1
AerJob class. .. attribute:: _executor
executor to handle asynchronous jobs
- type:
futures.Executor
- result(timeout=None)[source]
Get job result. The behavior is the same as the underlying concurrent Future objects, https://docs.python.org/3/library/concurrent.futures.html#future-objects :param timeout: number of seconds to wait for results. :type timeout: float
- Returns:
Result object
- Return type:
qiskit.Result
- Raises:
concurrent.futures.TimeoutError – if timeout occurred.
concurrent.futures.CancelledError – if job cancelled before completed.
ddsim.pathqasmsimulator module
Backend for DDSIM Task-Based Simulator.
- class ddsim.pathqasmsimulator.PathQasmSimulatorBackend(configuration=None, provider=None)[source]
Bases:
BackendV1
Python interface to MQT DDSIM Simulation Path Framework
- SHOW_STATE_VECTOR = False
- run(quantum_circuits: QuantumCircuit | List[QuantumCircuit], **options)[source]
Run on the backend.
This method returns a
Job
object that runs circuits. Depending on the backend this may be either an async or sync call. It is at the discretion of the provider to decide whether running should block until the execution is finished or not: the Job class can handle either situation.- Parameters:
run_input (QuantumCircuit or Schedule or list) – An individual or a list of
QuantumCircuit
orSchedule
objects to run on the backend. For legacy providers migrating to the new versioned providers, provider interface aQasmQobj
orPulseQobj
objects should probably be supported too (but deprecated) for backwards compatibility. Be sure to update the docstrings of subclasses implementing this method to document that. New provider implementations should not do this though asqiskit.qobj
will be deprecated and removed along with the legacy providers interface.options – Any kwarg options to pass to the backend for running the config. If a key is also present in the options attribute/object then the expectation is that the value specified will be used instead of what’s set in the options object.
- Returns:
The job object for the run
- Return type:
Job
ddsim.pathstatevectorsimulator module
Backend for DDSIM.
ddsim.provider module
- class ddsim.provider.DDSIMProvider[source]
Bases:
ProviderV1
- backends(name=None, filters=None, **kwargs)[source]
Return a list of backends matching the specified filtering.
- Parameters:
name (str) – name of the backend.
**kwargs – dict used for filtering.
- Returns:
- a list of Backends that match the filtering
criteria.
- Return type:
list[Backend]
- get_backend(name=None, **kwargs)[source]
Return a single backend matching the specified filtering.
- Parameters:
name (str) – name of the backend.
**kwargs – dict used for filtering.
- Returns:
a backend matching the filtering.
- Return type:
Backend
- Raises:
QiskitBackendNotFoundError – if no backend could be found or more than one backend matches the filtering criteria.
ddsim.pyddsim module
ddsim.qasmsimulator module
Backend for DDSIM.
- class ddsim.qasmsimulator.QasmSimulatorBackend(configuration=None, provider=None)[source]
Bases:
BackendV1
Python interface to MQT DDSIM
- SHOW_STATE_VECTOR = False
- run(quantum_circuits: QuantumCircuit | List[QuantumCircuit], **options) DDSIMJob [source]
Run on the backend.
This method returns a
Job
object that runs circuits. Depending on the backend this may be either an async or sync call. It is at the discretion of the provider to decide whether running should block until the execution is finished or not: the Job class can handle either situation.- Parameters:
run_input (QuantumCircuit or Schedule or list) – An individual or a list of
QuantumCircuit
orSchedule
objects to run on the backend. For legacy providers migrating to the new versioned providers, provider interface aQasmQobj
orPulseQobj
objects should probably be supported too (but deprecated) for backwards compatibility. Be sure to update the docstrings of subclasses implementing this method to document that. New provider implementations should not do this though asqiskit.qobj
will be deprecated and removed along with the legacy providers interface.options – Any kwarg options to pass to the backend for running the config. If a key is also present in the options attribute/object then the expectation is that the value specified will be used instead of what’s set in the options object.
- Returns:
The job object for the run
- Return type:
Job
ddsim.statevectorsimulator module
Backend for DDSIM.
ddsim.unitarysimulator module
Backend for DDSIM Unitary Simulator.
- class ddsim.unitarysimulator.UnitarySimulatorBackend(configuration=None, provider=None, **fields)[source]
Bases:
BackendV1
Decision diagram-based unitary simulator.
- run(quantum_circuits: QuantumCircuit | List[QuantumCircuit], **options)[source]
Run on the backend.
This method returns a
Job
object that runs circuits. Depending on the backend this may be either an async or sync call. It is at the discretion of the provider to decide whether running should block until the execution is finished or not: the Job class can handle either situation.- Parameters:
run_input (QuantumCircuit or Schedule or list) – An individual or a list of
QuantumCircuit
orSchedule
objects to run on the backend. For legacy providers migrating to the new versioned providers, provider interface aQasmQobj
orPulseQobj
objects should probably be supported too (but deprecated) for backwards compatibility. Be sure to update the docstrings of subclasses implementing this method to document that. New provider implementations should not do this though asqiskit.qobj
will be deprecated and removed along with the legacy providers interface.options – Any kwarg options to pass to the backend for running the config. If a key is also present in the options attribute/object then the expectation is that the value specified will be used instead of what’s set in the options object.
- Returns:
The job object for the run
- Return type:
Job
Module contents
- class ddsim.CircuitSimulator
Bases:
pybind11_object
- get_name(self: mqt.ddsim.pyddsim.CircuitSimulator) str
- get_number_of_qubits(self: mqt.ddsim.pyddsim.CircuitSimulator) int
- get_vector(self: mqt.ddsim.pyddsim.CircuitSimulator) List[complex]
- simulate(self: mqt.ddsim.pyddsim.CircuitSimulator, shots: int) Dict[str, int]
- statistics(self: mqt.ddsim.pyddsim.CircuitSimulator) Dict[str, str]
- class ddsim.ConstructionMode
Bases:
pybind11_object
Members:
recursive
sequential
- property name
- recursive = <ConstructionMode.recursive: 1>
- sequential = <ConstructionMode.sequential: 0>
- property value
- class ddsim.DDSIMProvider[source]
Bases:
ProviderV1
- backends(name=None, filters=None, **kwargs)[source]
Return a list of backends matching the specified filtering.
- Parameters:
name (str) – name of the backend.
**kwargs – dict used for filtering.
- Returns:
- a list of Backends that match the filtering
criteria.
- Return type:
list[Backend]
- get_backend(name=None, **kwargs)[source]
Return a single backend matching the specified filtering.
- Parameters:
name (str) – name of the backend.
**kwargs – dict used for filtering.
- Returns:
a backend matching the filtering.
- Return type:
Backend
- Raises:
QiskitBackendNotFoundError – if no backend could be found or more than one backend matches the filtering criteria.
- class ddsim.HybridCircuitSimulator
Bases:
pybind11_object
- get_final_amplitudes(self: mqt.ddsim.pyddsim.HybridCircuitSimulator) List[complex]
- get_mode(self: mqt.ddsim.pyddsim.HybridCircuitSimulator) mqt.ddsim.pyddsim.HybridMode
- get_name(self: mqt.ddsim.pyddsim.HybridCircuitSimulator) str
- get_number_of_qubits(self: mqt.ddsim.pyddsim.HybridCircuitSimulator) int
- get_vector(self: mqt.ddsim.pyddsim.HybridCircuitSimulator) List[complex]
- simulate(self: mqt.ddsim.pyddsim.HybridCircuitSimulator, shots: int) Dict[str, int]
- statistics(self: mqt.ddsim.pyddsim.HybridCircuitSimulator) Dict[str, str]
- class ddsim.HybridMode
Bases:
pybind11_object
Members:
DD
amplitude
- DD = <HybridMode.DD: 0>
- amplitude = <HybridMode.amplitude: 1>
- property name
- property value
- class ddsim.PathCircuitSimulator
Bases:
pybind11_object
- get_name(self: mqt.ddsim.pyddsim.PathCircuitSimulator) str
- get_number_of_qubits(self: mqt.ddsim.pyddsim.PathCircuitSimulator) int
- get_vector(self: mqt.ddsim.pyddsim.PathCircuitSimulator) List[complex]
- set_simulation_path(self: mqt.ddsim.pyddsim.PathCircuitSimulator, arg0: List[Tuple[int, int]], arg1: bool) None
- simulate(self: mqt.ddsim.pyddsim.PathCircuitSimulator, shots: int) Dict[str, int]
- statistics(self: mqt.ddsim.pyddsim.PathCircuitSimulator) Dict[str, str]
- class ddsim.PathSimulatorConfiguration
Bases:
pybind11_object
Configuration options for the Path Simulator
- property bracket_size
Size of the brackets one wants to combine
- property gate_cost
A list that contains the number of gates which are considered in each step
- json(self: mqt.ddsim.pyddsim.PathSimulatorConfiguration) nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>
- property mode
Setting the mode used for determining a simulation path
- property seed
Seed for the simulator
- property starting_point
Start of the alternating or gate_cost strategy
- class ddsim.PathSimulatorMode
Bases:
pybind11_object
Members:
sequential
pairwise_recursive
cotengra
bracket
alternating
gate_cost
- alternating = <PathSimulatorMode.alternating: 3>
- bracket = <PathSimulatorMode.bracket: 2>
- cotengra = <PathSimulatorMode.cotengra: 4>
- gate_cost = <PathSimulatorMode.gate_cost: 5>
- property name
- pairwise_recursive = <PathSimulatorMode.pairwise_recursive: 1>
- sequential = <PathSimulatorMode.sequential: 0>
- property value
- class ddsim.UnitarySimulator
Bases:
pybind11_object
- construct(self: mqt.ddsim.pyddsim.UnitarySimulator) None
- get_construction_time(self: mqt.ddsim.pyddsim.UnitarySimulator) float
- get_final_node_count(self: mqt.ddsim.pyddsim.UnitarySimulator) int
- get_max_node_count(self: mqt.ddsim.pyddsim.UnitarySimulator) int
- get_mode(self: mqt.ddsim.pyddsim.UnitarySimulator) mqt.ddsim.pyddsim.ConstructionMode
- get_name(self: mqt.ddsim.pyddsim.UnitarySimulator) str
- get_number_of_qubits(self: mqt.ddsim.pyddsim.UnitarySimulator) int
- ddsim.dump_tensor_network(circ: object, filename: str) None
dump a tensor network representation of the given circuit
- ddsim.get_matrix(sim: mqt.ddsim.pyddsim.UnitarySimulator, mat: numpy.ndarray[numpy.complex128]) None