# mqt.ddsim

MQT DDSIM Python Package.

## Submodules

* [mqt.ddsim.deterministic_noise_simulator_backend](deterministic_noise_simulator_backend/index.html.md)
* [mqt.ddsim.experiment_header](experiment_header/index.html.md)
* [mqt.ddsim.hybrid_qam_simulator_backend](hybrid_qam_simulator_backend/index.html.md)
* [mqt.ddsim.hybrid_statevector_simulator_backend](hybrid_statevector_simulator_backend/index.html.md)
* [mqt.ddsim.job](job/index.html.md)
* [mqt.ddsim.path_qasm_simulator_backend](path_qasm_simulator_backend/index.html.md)
* [mqt.ddsim.path_statevector_simulator_backend](path_statevector_simulator_backend/index.html.md)
* [mqt.ddsim.primitives](primitives/index.html.md)
* [mqt.ddsim.provider](provider/index.html.md)
* [mqt.ddsim.pyddsim](pyddsim/index.html.md)
* [mqt.ddsim.qasm_simulator_backend](qasm_simulator_backend/index.html.md)
* [mqt.ddsim.statevector_simulator_backend](statevector_simulator_backend/index.html.md)
* [mqt.ddsim.stochastic_noise_simulator_backend](stochastic_noise_simulator_backend/index.html.md)
* [mqt.ddsim.target](target/index.html.md)
* [mqt.ddsim.unitary_simulator_backend](unitary_simulator_backend/index.html.md)

## Package Contents

### \_\_version_\_ *: [str](https://docs.python.org/3/builtins/stdtypes.html#str)*

### *class* CircuitSimulator(circ: mqt.core.ir.QuantumComputation, approximation_step_fidelity: [float](https://docs.python.org/3/builtins/functions.html#float) = 1.0, approximation_steps: [int](https://docs.python.org/3/builtins/functions.html#int) = 1, approximation_strategy: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'fidelity', seed: [int](https://docs.python.org/3/builtins/functions.html#int) = -1)

#### get_number_of_qubits() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of qubits.

#### get_name() → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

Get the name of the simulator.

#### statistics() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]

Get additional statistics provided by the simulator.

#### get_active_vector_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active vector nodes, i.e., the number of vector DD nodes in the unique table with a non-zero reference count.

#### get_active_matrix_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active matrix nodes, i.e., the number of matrix DD nodes in the unique table with a non-zero reference count.

#### get_tolerance() → [float](https://docs.python.org/3/builtins/functions.html#float)

Get the tolerance for the DD package.

#### set_tolerance(tol: [float](https://docs.python.org/3/builtins/functions.html#float)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the tolerance for the DD package.

#### simulate(shots: [int](https://docs.python.org/3/builtins/functions.html#int)) → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [int](https://docs.python.org/3/builtins/functions.html#int)]

Simulate the circuit and return the result as a dictionary of counts.

#### get_constructed_dd() → [VectorDD](https://mqt.readthedocs.io/projects/core/en/stable/api/mqt/core/dd/index.html#mqt.core.dd.VectorDD)

Get the vector DD resulting from the simulation.

#### expectation_value(observable: mqt.core.ir.QuantumComputation) → [float](https://docs.python.org/3/builtins/functions.html#float)

Compute the expectation value for the given observable.

### *class* DeterministicNoiseSimulator(circ: mqt.core.ir.QuantumComputation, approximation_step_fidelity: [float](https://docs.python.org/3/builtins/functions.html#float) = 1.0, approximation_steps: [int](https://docs.python.org/3/builtins/functions.html#int) = 1, approximation_strategy: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'fidelity', seed: [int](https://docs.python.org/3/builtins/functions.html#int) = -1, noise_effects: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'APD', noise_probability: [float](https://docs.python.org/3/builtins/functions.html#float) = 0.01, amp_damping_probability: [float](https://docs.python.org/3/builtins/functions.html#float) | [None](https://docs.python.org/3/builtins/constants.html#None) = 0.02, multi_qubit_gate_factor: [float](https://docs.python.org/3/builtins/functions.html#float) = 2)

#### get_number_of_qubits() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of qubits.

#### get_name() → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

Get the name of the simulator.

#### statistics() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]

Get additional statistics provided by the simulator.

#### get_active_vector_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active vector nodes, i.e., the number of vector DD nodes in the unique table with a non-zero reference count.

#### get_active_matrix_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active matrix nodes, i.e., the number of matrix DD nodes in the unique table with a non-zero reference count.

#### get_tolerance() → [float](https://docs.python.org/3/builtins/functions.html#float)

Get the tolerance for the DD package.

#### set_tolerance(tol: [float](https://docs.python.org/3/builtins/functions.html#float)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the tolerance for the DD package.

#### simulate(shots: [int](https://docs.python.org/3/builtins/functions.html#int)) → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [int](https://docs.python.org/3/builtins/functions.html#int)]

Simulate the circuit and return the result as a dictionary of counts.

#### get_constructed_dd() → [VectorDD](https://mqt.readthedocs.io/projects/core/en/stable/api/mqt/core/dd/index.html#mqt.core.dd.VectorDD)

Get the vector DD resulting from the simulation.

### *class* HybridSimulator(circ: mqt.core.ir.QuantumComputation, approximation_step_fidelity: [float](https://docs.python.org/3/builtins/functions.html#float) = 1.0, approximation_steps: [int](https://docs.python.org/3/builtins/functions.html#int) = 1, approximation_strategy: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'fidelity', seed: [int](https://docs.python.org/3/builtins/functions.html#int) = -1, mode: [HybridSimulatorMode](#mqt.ddsim.HybridSimulatorMode) = ..., nthreads: [int](https://docs.python.org/3/builtins/functions.html#int) = 2)

#### get_number_of_qubits() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of qubits.

#### get_name() → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

Get the name of the simulator.

#### statistics() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]

Get additional statistics provided by the simulator.

#### get_active_vector_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active vector nodes, i.e., the number of vector DD nodes in the unique table with a non-zero reference count.

#### get_active_matrix_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active matrix nodes, i.e., the number of matrix DD nodes in the unique table with a non-zero reference count.

#### get_tolerance() → [float](https://docs.python.org/3/builtins/functions.html#float)

Get the tolerance for the DD package.

#### set_tolerance(tol: [float](https://docs.python.org/3/builtins/functions.html#float)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the tolerance for the DD package.

#### simulate(shots: [int](https://docs.python.org/3/builtins/functions.html#int)) → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [int](https://docs.python.org/3/builtins/functions.html#int)]

Simulate the circuit and return the result as a dictionary of counts.

#### get_constructed_dd() → [VectorDD](https://mqt.readthedocs.io/projects/core/en/stable/api/mqt/core/dd/index.html#mqt.core.dd.VectorDD)

Get the vector DD resulting from the simulation.

#### get_mode() → [HybridSimulatorMode](#mqt.ddsim.HybridSimulatorMode)

Get the mode of the hybrid simulator.

#### get_final_amplitudes() → [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[complex](https://docs.python.org/3/builtins/functions.html#complex)]

Get the final amplitudes from the hybrid simulation.

### *class* HybridSimulatorMode

Bases: [`enum.Enum`](https://docs.python.org/3/library/enum.html#enum.Enum)

Enumeration of modes for the [`HybridSimulator`](#mqt.ddsim.HybridSimulator).

#### DD *= 0*

#### amplitude *= 1*

### *class* PathSimulator(circ: mqt.core.ir.QuantumComputation, config: [PathSimulatorConfiguration](#mqt.ddsim.PathSimulatorConfiguration) = ...)

### *class* PathSimulator(circ: mqt.core.ir.QuantumComputation, mode: [PathSimulatorMode](#mqt.ddsim.PathSimulatorMode) = ..., bracket_size: [int](https://docs.python.org/3/builtins/functions.html#int) = 2, starting_point: [int](https://docs.python.org/3/builtins/functions.html#int) = 0, gate_cost: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[int](https://docs.python.org/3/builtins/functions.html#int)] = [], seed: [int](https://docs.python.org/3/builtins/functions.html#int) = 0)

#### get_number_of_qubits() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of qubits.

#### get_name() → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

Get the name of the simulator.

#### statistics() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]

Get additional statistics provided by the simulator.

#### get_active_vector_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active vector nodes, i.e., the number of vector DD nodes in the unique table with a non-zero reference count.

#### get_active_matrix_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active matrix nodes, i.e., the number of matrix DD nodes in the unique table with a non-zero reference count.

#### get_tolerance() → [float](https://docs.python.org/3/builtins/functions.html#float)

Get the tolerance for the DD package.

#### set_tolerance(tol: [float](https://docs.python.org/3/builtins/functions.html#float)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the tolerance for the DD package.

#### simulate(shots: [int](https://docs.python.org/3/builtins/functions.html#int)) → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [int](https://docs.python.org/3/builtins/functions.html#int)]

Simulate the circuit and return the result as a dictionary of counts.

#### get_constructed_dd() → [VectorDD](https://mqt.readthedocs.io/projects/core/en/stable/api/mqt/core/dd/index.html#mqt.core.dd.VectorDD)

Get the vector DD resulting from the simulation.

#### set_simulation_path(path: [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), [int](https://docs.python.org/3/builtins/functions.html#int)]], assume_correct_order: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the simulation path.

* **Parameters:**
  * **path** – The components of the simulation path.
  * **assume_correct_order** – Whether the provided path is assumed to be in the correct order. Defaults to False.

### *class* PathSimulatorConfiguration

Configuration options for the [`PathSimulator`](#mqt.ddsim.PathSimulator).

#### *property* mode *: [PathSimulatorMode](#mqt.ddsim.PathSimulatorMode)*

The mode used for determining a simulation path.

#### *property* bracket_size *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Size of the brackets one wants to combine.

#### *property* starting_point *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Start of the alternating or gate_cost strategy.

#### *property* gate_cost *: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[int](https://docs.python.org/3/builtins/functions.html#int)]*

A list that contains the number of gates which are considered in each step.

#### *property* seed *: [int](https://docs.python.org/3/builtins/functions.html#int)*

Seed for the simulator.

#### json() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), Any]

Get the configuration as a JSON-style dictionary.

### *class* PathSimulatorMode

Bases: [`enum.Enum`](https://docs.python.org/3/library/enum.html#enum.Enum)

Enumeration of modes for the [`PathSimulator`](#mqt.ddsim.PathSimulator).

#### sequential *= 0*

#### pairwise_recursive *= 1*

#### bracket *= 2*

#### alternating *= 3*

#### gate_cost *= 4*

### *class* StochasticNoiseSimulator(circ: mqt.core.ir.QuantumComputation, approximation_step_fidelity: [float](https://docs.python.org/3/builtins/functions.html#float) = 1.0, approximation_steps: [int](https://docs.python.org/3/builtins/functions.html#int) = 1, approximation_strategy: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'fidelity', seed: [int](https://docs.python.org/3/builtins/functions.html#int) = -1, noise_effects: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'APD', noise_probability: [float](https://docs.python.org/3/builtins/functions.html#float) = 0.01, amp_damping_probability: [float](https://docs.python.org/3/builtins/functions.html#float) | [None](https://docs.python.org/3/builtins/constants.html#None) = 0.02, multi_qubit_gate_factor: [float](https://docs.python.org/3/builtins/functions.html#float) = 2)

#### get_number_of_qubits() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of qubits.

#### get_name() → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

Get the name of the simulator.

#### statistics() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]

Get additional statistics provided by the simulator.

#### get_active_vector_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active vector nodes, i.e., the number of vector DD nodes in the unique table with a non-zero reference count.

#### get_active_matrix_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active matrix nodes, i.e., the number of matrix DD nodes in the unique table with a non-zero reference count.

#### get_tolerance() → [float](https://docs.python.org/3/builtins/functions.html#float)

Get the tolerance for the DD package.

#### set_tolerance(tol: [float](https://docs.python.org/3/builtins/functions.html#float)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the tolerance for the DD package.

#### simulate(shots: [int](https://docs.python.org/3/builtins/functions.html#int)) → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [int](https://docs.python.org/3/builtins/functions.html#int)]

Simulate the circuit and return the result as a dictionary of counts.

#### get_constructed_dd() → [VectorDD](https://mqt.readthedocs.io/projects/core/en/stable/api/mqt/core/dd/index.html#mqt.core.dd.VectorDD)

Get the vector DD resulting from the simulation.

### *class* UnitarySimulator(circ: mqt.core.ir.QuantumComputation, approximation_step_fidelity: [float](https://docs.python.org/3/builtins/functions.html#float) = 1.0, approximation_steps: [int](https://docs.python.org/3/builtins/functions.html#int) = 1, approximation_strategy: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'fidelity', seed: [int](https://docs.python.org/3/builtins/functions.html#int) = -1, mode: [UnitarySimulatorMode](#mqt.ddsim.UnitarySimulatorMode) = ...)

#### get_number_of_qubits() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of qubits.

#### get_name() → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

Get the name of the simulator.

#### statistics() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]

Get additional statistics provided by the simulator.

#### get_active_vector_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active vector nodes, i.e., the number of vector DD nodes in the unique table with a non-zero reference count.

#### get_active_matrix_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the number of active matrix nodes, i.e., the number of matrix DD nodes in the unique table with a non-zero reference count.

#### get_tolerance() → [float](https://docs.python.org/3/builtins/functions.html#float)

Get the tolerance for the DD package.

#### set_tolerance(tol: [float](https://docs.python.org/3/builtins/functions.html#float)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Set the tolerance for the DD package.

#### construct() → [None](https://docs.python.org/3/builtins/constants.html#None)

Construct the DD representing the unitary matrix of the circuit.

#### get_mode() → [UnitarySimulatorMode](#mqt.ddsim.UnitarySimulatorMode)

Get the mode of the unitary simulator.

#### get_construction_time() → [float](https://docs.python.org/3/builtins/functions.html#float)

Get the time taken to construct the DD.

#### get_final_node_count() → [int](https://docs.python.org/3/builtins/functions.html#int)

Get the final node count of the constructed DD.

#### get_constructed_dd() → [MatrixDD](https://mqt.readthedocs.io/projects/core/en/stable/api/mqt/core/dd/index.html#mqt.core.dd.MatrixDD)

Get the constructed DD.

### *class* UnitarySimulatorMode

Bases: [`enum.Enum`](https://docs.python.org/3/library/enum.html#enum.Enum)

Enumeration of modes for the [`UnitarySimulator`](#mqt.ddsim.UnitarySimulator).

#### recursive *= 1*

#### sequential *= 0*
