mqt.ddsim

MQT DDSIM Python Package.

Submodules

Package Contents

__version__: str
class CircuitSimulator(circ: QuantumComputation, approximation_step_fidelity: float = 1.0, approximation_steps: int = 1, approximation_strategy: str = 'fidelity', seed: int = -1)
get_number_of_qubits() int

Get the number of qubits.

get_name() str

Get the name of the simulator.

statistics() dict[str, str]

Get additional statistics provided by the simulator.

get_active_vector_node_count() 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

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

Get the tolerance for the DD package.

set_tolerance(tol: float) None

Set the tolerance for the DD package.

simulate(shots: int) dict[str, int]

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

get_constructed_dd() VectorDD

Get the vector DD resulting from the simulation.

expectation_value(observable: QuantumComputation) float

Compute the expectation value for the given observable.

class DeterministicNoiseSimulator(circ: QuantumComputation, approximation_step_fidelity: float = 1.0, approximation_steps: int = 1, approximation_strategy: str = 'fidelity', seed: int = -1, noise_effects: str = 'APD', noise_probability: float = 0.01, amp_damping_probability: float | None = 0.02, multi_qubit_gate_factor: float = 2)
get_number_of_qubits() int

Get the number of qubits.

get_name() str

Get the name of the simulator.

statistics() dict[str, str]

Get additional statistics provided by the simulator.

get_active_vector_node_count() 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

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

Get the tolerance for the DD package.

set_tolerance(tol: float) None

Set the tolerance for the DD package.

simulate(shots: int) dict[str, int]

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

get_constructed_dd() VectorDD

Get the vector DD resulting from the simulation.

class HybridSimulator(circ: QuantumComputation, approximation_step_fidelity: float = 1.0, approximation_steps: int = 1, approximation_strategy: str = 'fidelity', seed: int = -1, mode: HybridSimulatorMode = ..., nthreads: int = 2)
get_number_of_qubits() int

Get the number of qubits.

get_name() str

Get the name of the simulator.

statistics() dict[str, str]

Get additional statistics provided by the simulator.

get_active_vector_node_count() 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

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

Get the tolerance for the DD package.

set_tolerance(tol: float) None

Set the tolerance for the DD package.

simulate(shots: int) dict[str, int]

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

get_constructed_dd() VectorDD

Get the vector DD resulting from the simulation.

get_mode() HybridSimulatorMode

Get the mode of the hybrid simulator.

get_final_amplitudes() list[complex]

Get the final amplitudes from the hybrid simulation.

class HybridSimulatorMode(*args, **kwds)

Bases: enum.Enum

Enumeration of modes for the HybridSimulator.

DD = 0
amplitude = 1
class PathSimulator(circ: QuantumComputation, config: PathSimulatorConfiguration = ...)
class PathSimulator(circ: QuantumComputation, mode: PathSimulatorMode = ..., bracket_size: int = 2, starting_point: int = 0, gate_cost: Sequence[int] = [], seed: int = 0)
get_number_of_qubits() int

Get the number of qubits.

get_name() str

Get the name of the simulator.

statistics() dict[str, str]

Get additional statistics provided by the simulator.

get_active_vector_node_count() 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

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

Get the tolerance for the DD package.

set_tolerance(tol: float) None

Set the tolerance for the DD package.

simulate(shots: int) dict[str, int]

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

get_constructed_dd() VectorDD

Get the vector DD resulting from the simulation.

set_simulation_path(path: Sequence[tuple[int, int]], assume_correct_order: bool = False) 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.

property mode: PathSimulatorMode

The mode used for determining a simulation path.

property bracket_size: int

Size of the brackets one wants to combine.

property starting_point: int

Start of the alternating or gate_cost strategy.

property gate_cost: list[int]

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

property seed: int

Seed for the simulator.

json() dict[str, Any]

Get the configuration as a JSON-style dictionary.

class PathSimulatorMode(*args, **kwds)

Bases: enum.Enum

Enumeration of modes for the PathSimulator.

sequential = 0
pairwise_recursive = 1
bracket = 2
alternating = 3
gate_cost = 4
class StochasticNoiseSimulator(circ: QuantumComputation, approximation_step_fidelity: float = 1.0, approximation_steps: int = 1, approximation_strategy: str = 'fidelity', seed: int = -1, noise_effects: str = 'APD', noise_probability: float = 0.01, amp_damping_probability: float | None = 0.02, multi_qubit_gate_factor: float = 2)
get_number_of_qubits() int

Get the number of qubits.

get_name() str

Get the name of the simulator.

statistics() dict[str, str]

Get additional statistics provided by the simulator.

get_active_vector_node_count() 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

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

Get the tolerance for the DD package.

set_tolerance(tol: float) None

Set the tolerance for the DD package.

simulate(shots: int) dict[str, int]

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

get_constructed_dd() VectorDD

Get the vector DD resulting from the simulation.

class UnitarySimulator(circ: QuantumComputation, approximation_step_fidelity: float = 1.0, approximation_steps: int = 1, approximation_strategy: str = 'fidelity', seed: int = -1, mode: UnitarySimulatorMode = ...)
get_number_of_qubits() int

Get the number of qubits.

get_name() str

Get the name of the simulator.

statistics() dict[str, str]

Get additional statistics provided by the simulator.

get_active_vector_node_count() 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

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

Get the tolerance for the DD package.

set_tolerance(tol: float) None

Set the tolerance for the DD package.

construct() None

Construct the DD representing the unitary matrix of the circuit.

get_mode() UnitarySimulatorMode

Get the mode of the unitary simulator.

get_construction_time() float

Get the time taken to construct the DD.

get_final_node_count() int

Get the final node count of the constructed DD.

get_constructed_dd() MatrixDD

Get the constructed DD.

class UnitarySimulatorMode(*args, **kwds)

Bases: enum.Enum

Enumeration of modes for the UnitarySimulator.

recursive = 1
sequential = 0