Skip to main content

Haiqu.statevector_run(circuits: QuantumCircuit | list[QuantumCircuit] | CircuitModel | list[CircuitModel], job_name: str | None = None, job_description: str | None = None) → RunJobModel

Run quantum circuits on a statevector simulator and obtain exact amplitudes of the wavefunctions. This execution type is restricted to non-parametrized circuits up to 20 qubits in size. Circuits may contain Haiqu gates, but no mid-circuit measurements or other logical operations. Final measurements in the circuit, if present, will be ignored. Statevector is measured over all qubits in their standard qiskit order.
  • Parameters:
    • circuits — The quantum circuit(s) to execute. Can be a single circuit or a list of circuits.
    • job_name (str | None) — The name for the job. If None (default), a name will be automatically generated.
    • job_description (str | None) — The description for the job.
  • Returns: The Run job that will execute the circuit. : Call .result() to get statevectors.
  • Return type: RunJobModel

Examples

Single circuit:
>>> from qiskit import QuantumCircuit
>>> qc = QuantumCircuit(2)
>>> qc.h(0)
>>> qc.cx(0, 1)
>>> qc.measure_all()  # measurements can be present or not
>>> job = haiqu.statevector_run(qc)
>>> job.result()  # Returns: [statevector]
[array([0.70710678+0.j, 0.        +0.j, 0.        +0.j, 0.70710678+0.j])]
Multiple circuits:
>>> from qiskit import QuantumCircuit
>>> import numpy as np
>>> qc_bell = QuantumCircuit(2)  # standard bell state
>>> qc_bell.h(0)
>>> qc_bell.cx(0, 1)
>>> bell_gate_phased, _ = haiqu.vector_loading([1, 0, 0, 1.j]).result()  # notice the imaginary amplitude
>>> qc_bell_phased = QuantumCircuit(2)  # bell state with different phase on |11> state
>>> qc_bell_phased.compose(bell_gate_phased, inplace=True)
>>> job = haiqu.statevector_run([qc_bell, qc_bell_phased])
>>> np.round(job.result(), 3)
array([[ 0.707+0.j   ,  0.   +0.j   ,  0.   +0.j   ,  0.707+0.j   ],
       [ 0.707+0.j   ,  0.   +0.j   ,  0.   +0.j   , -0.   +0.707j]])