API documentation¶
- pytket.extensions.qulacs.qulacs_convert.tk_to_qulacs(circuit, reverse_index=False, replace_implicit_swaps=False)[source]¶
- Convert a pytket circuit to a qulacs circuit object. - Return type:
- QuantumCircuit
 
- class pytket.extensions.qulacs.backends.qulacs_backend.QulacsBackend(result_type='state_vector')[source]¶
- Backend for running simulations on the Qulacs simulator - circuit_status(handle)[source]¶
- Return a CircuitStatus reporting the status of the circuit execution corresponding to the ResultHandle - Return type:
 
 - default_compilation_pass(optimisation_level=1)[source]¶
- A suggested compilation pass that will will, if possible, produce an equivalent circuit suitable for running on this backend. - At a minimum it will ensure that compatible gates are used and that all two- qubit interactions are compatible with the backend’s qubit architecture. At higher optimisation levels, further optimisations may be applied. - This is a an abstract method which is implemented in the backend itself, and so is tailored to the backend’s requirements. - Parameters:
- optimisation_level ( - int) –- The level of optimisation to perform during compilation. - Level 0 does the minimum required to solves the device constraints, without any optimisation. 
- Level 1 additionally performs some light optimisations. 
- Level 2 (the default) adds more computationally intensive optimisations that should give the best results from execution. 
 
- Return type:
- Returns:
- Compilation pass guaranteeing required predicates. 
 
 - get_operator_expectation_value(state_circuit, operator, n_shots=0, valid_check=True, **kwargs)[source]¶
- Calculates the expectation value of the given circuit with respect to the operator using functionality built into the backend. - Raises an exception if the backend does not provide custom expectation value features. - Return type:
 
 - process_circuits(circuits, n_shots=None, valid_check=True, **kwargs)[source]¶
- Submit circuits to the backend for running. The results will be stored in the backend’s result cache to be retrieved by the corresponding get_<data> method. - If the postprocess keyword argument is set to True, and the backend supports the feature (see - supports_contextual_optimisation), then contextual optimisatioons are applied before running the circuit and retrieved results will have any necessary classical postprocessing applied. This is not enabled by default.- Use keyword arguments to specify parameters to be used in submitting circuits See specific Backend derived class for available parameters, from the following list: - seed: RNG seed for simulators 
- postprocess: if True, apply contextual optimisations 
 - Note: If a backend is reused many times, the in-memory results cache grows indefinitely. Therefore, when processing many circuits on a statevector or unitary backend (whose results may occupy significant amounts of memory), it is advisable to run - empty_cache()after each result is retrieved.- Parameters:
- circuits ( - Sequence[- Circuit]) – Circuits to process on the backend.
- n_shots ( - None|- int|- Sequence[- int|- None]) – Number of shots to run per circuit. Optionally, this can be a list of shots specifying the number of shots for each circuit separately. None is to be used for state/unitary simulators. Defaults to None.
- valid_check ( - bool) – Explicitly check that all circuits satisfy all required predicates to run on the backend. Defaults to True
 
- Return type:
- Returns:
- Handles to results for each input circuit, as an iterable in the same order as the circuits. 
 
 - rebase_pass()[source]¶
- A single compilation pass that when run converts all gates in a Circuit to an OpType supported by the Backend (ignoring architecture constraints). - Return type:
- Returns:
- Compilation pass that converts gates to primitives supported by Backend. 
 
 - property backend_info: BackendInfo | None¶
- Retrieve all Backend properties in a BackendInfo object, including device architecture, supported gate set, gate errors and other hardware-specific information. - Returns:
- The BackendInfo describing this backend if it exists.