uniqc.simulator.get_backend module

uniqc.simulator.get_backend.create_simulator(backend='statevector', program_type='originir', **kwargs)[source]

Create a simulator backend.

Parameters:
  • backend (str) – Simulator backend name. Supported values include "statevector", "density_matrix", "densitymatrix", "density", "torchquantum", and "mps" (alias "matrix_product_state").

  • program_type (str) – Ignored — Simulator auto-detects the input format. Kept for backward compatibility.

  • **kwargs – Additional arguments passed to the simulator constructor.

Returns:

A simulator instance for the requested backend.

Raises:
  • ValueError – If the backend is not supported.

  • ImportError – If the TorchQuantum backend is requested but optional dependencies are not installed.

Return type:

BaseSimulator | TorchQuantumSimulator | MPSSimulator

uniqc.simulator.get_backend.get_backend(backend_type='statevector', program_type='originir', **kwargs)[source]

Deprecated: use get_simulator() or create_simulator().

Parameters:
  • backend_type (str)

  • program_type (str)

Return type:

BaseSimulator | TorchQuantumSimulator | MPSSimulator

uniqc.simulator.get_backend.get_simulator(backend_type='statevector', program_type='originir', **kwargs)[source]

Create a simulator instance (alias for create_simulator()).

The argument order matches create_simulator()backend_type first, then program_type. Both arguments default to the most common case ("statevector" + "originir").

Parameters:
  • backend_type (str) – Simulator backend, e.g. "statevector", "density_matrix", "mps", "torchquantum".

  • program_type (str) – Ignored — Simulator auto-detects the input format.

  • **kwargs – Additional arguments passed to the simulator constructor.

Returns:

A simulator instance.

Return type:

BaseSimulator | TorchQuantumSimulator | MPSSimulator