Struct qoqo_aqt::BackendWrapper
source · pub struct BackendWrapper {
pub internal: Backend,
}
Expand description
AQT backend
provides functions to run circuits and measurements on AQT devices.
Fields§
§internal: Backend
Internal storage of roqoqo_aqt::Backend
Implementations§
source§impl BackendWrapper
impl BackendWrapper
sourcepub fn new(device: &PyAny, access_token: Option<String>) -> PyResult<Self>
pub fn new(device: &PyAny, access_token: Option<String>) -> PyResult<Self>
Create a new AQT Backend.
Args: device (Device): AQT Device providing information about the endpoint running Circuits. access_token (Optionalstr): Optional access token to AQT endpoints. When None access token is read from $AQT_ACCESS_TOKEN environmental variable
Raises: TypeError: Device Parameter is not AqtDevice RuntimeError: No access token found
sourcepub fn to_aqt_json(&self, circuit: &PyAny) -> PyResult<String>
pub fn to_aqt_json(&self, circuit: &PyAny) -> PyResult<String>
Create an AQT json represenstaion of a Circuit.
Args: circuit (Circuit): The circuit that is translated to a AQT json.
Returns: str: The output registers written by the evaluated circuits.
Raises: TypeError: Circuit argument cannot be converted to qoqo Circuit RuntimeError: Translating Circuit failed
sourcepub fn __copy__(&self) -> BackendWrapper
pub fn __copy__(&self) -> BackendWrapper
Return a copy of the Backend (copy here produces a deepcopy).
Returns: Backend: A deep copy of self.
sourcepub fn __deepcopy__(&self, _memodict: Py<PyAny>) -> BackendWrapper
pub fn __deepcopy__(&self, _memodict: Py<PyAny>) -> BackendWrapper
Return a deep copy of the Backend.
Returns: Backend: A deep copy of self.
sourcepub fn to_bincode(&self) -> PyResult<Py<PyByteArray>>
pub fn to_bincode(&self) -> PyResult<Py<PyByteArray>>
sourcepub fn from_bincode(input: &PyAny) -> PyResult<BackendWrapper>
pub fn from_bincode(input: &PyAny) -> PyResult<BackendWrapper>
Convert the bincode representation of the Backend to a Backend using the bincode crate.
Args: input (ByteArray): The serialized Backend (in bincode form).
Returns: Backend: The deserialized Backend.
Raises: TypeError: Input cannot be converted to byte array. ValueError: Input cannot be deserialized to Backend.
sourcepub fn run_circuit(
&self,
circuit: &PyAny
) -> PyResult<(HashMap<String, BitOutputRegister>, HashMap<String, FloatOutputRegister>, HashMap<String, ComplexOutputRegister>)>
pub fn run_circuit( &self, circuit: &PyAny ) -> PyResult<(HashMap<String, BitOutputRegister>, HashMap<String, FloatOutputRegister>, HashMap<String, ComplexOutputRegister>)>
Run a circuit with the AQT backend.
A circuit is passed to the backend and executed. During execution values are written to and read from classical registers (Listbool, List[float], List[complex]). To produce sufficient statistics for evaluating expectation values, circuits have to be run multiple times. The results of each repetition are concatenated in OutputRegisters (List[Listbool], List[List[float]], List[List[complex]]).
Args: circuit (Circuit): The circuit that is run on the backend.
Returns: Tuple[Dict[str, List[Listbool]], Dict[str, List[List[float]]]], Dict[str, List[List[complex]]]]: The output registers written by the evaluated circuits.
Raises: TypeError: Circuit argument cannot be converted to qoqo Circuit RuntimeError: Running Circuit failed
sourcepub fn run_measurement_registers(
&self,
measurement: &PyAny
) -> PyResult<(HashMap<String, BitOutputRegister>, HashMap<String, FloatOutputRegister>, HashMap<String, ComplexOutputRegister>)>
pub fn run_measurement_registers( &self, measurement: &PyAny ) -> PyResult<(HashMap<String, BitOutputRegister>, HashMap<String, FloatOutputRegister>, HashMap<String, ComplexOutputRegister>)>
Run all circuits corresponding to one measurement with the AQT backend.
An expectation value measurement in general involves several circuits. Each circuit is passes to the backend and executed separately. A circuit is passed to the backend and executed. During execution values are written to and read from classical registers (Listbool, List[float], List[complex]). To produce sufficient statistics for evaluating expectation values, circuits have to be run multiple times. The results of each repetition are concatenated in OutputRegisters (List[Listbool], List[List[float]], List[List[complex]]).
Args: measurement (Measurement): The measurement that is run on the backend.
Returns: Tuple[Dict[str, List[Listbool]], Dict[str, List[List[float]]]], Dict[str, List[List[complex]]]]: The output registers written by the evaluated circuits.
Raises: TypeError: Circuit argument cannot be converted to qoqo Circuit RuntimeError: Running Circuit failed
sourcepub fn run_measurement(
&self,
measurement: &PyAny
) -> PyResult<Option<HashMap<String, f64>>>
pub fn run_measurement( &self, measurement: &PyAny ) -> PyResult<Option<HashMap<String, f64>>>
Evaluates expectation values of a measurement with the backend.
Args: measurement (Measurement): The measurement that is run on the backend.
Returns: Optional[Dict[str, float]]: The dictionary of expectation values.
Raises: TypeError: Measurement evaluate function could not be used RuntimeError: Internal error measurement.evaluation returned unknown type
Trait Implementations§
source§impl Clone for BackendWrapper
impl Clone for BackendWrapper
source§fn clone(&self) -> BackendWrapper
fn clone(&self) -> BackendWrapper
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BackendWrapper
impl Debug for BackendWrapper
source§impl PartialEq for BackendWrapper
impl PartialEq for BackendWrapper
source§fn eq(&self, other: &BackendWrapper) -> bool
fn eq(&self, other: &BackendWrapper) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PyClassImpl for BackendWrapper
impl PyClassImpl for BackendWrapper
source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type ThreadChecker = SendablePyClass<BackendWrapper>
type ThreadChecker = SendablePyClass<BackendWrapper>
type Inventory = Pyo3MethodsInventoryForBackendWrapper
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<BackendWrapper> for PyClassImplCollector<BackendWrapper>
impl PyClassNewTextSignature<BackendWrapper> for PyClassImplCollector<BackendWrapper>
fn new_text_signature(self) -> Option<&'static str>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a BackendWrapper
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a BackendWrapper
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut BackendWrapper
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut BackendWrapper
source§impl PyTypeInfo for BackendWrapper
impl PyTypeInfo for BackendWrapper
§type AsRefTarget = PyCell<BackendWrapper>
type AsRefTarget = PyCell<BackendWrapper>
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object
is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object
is an instance of this type.impl Eq for BackendWrapper
impl StructuralPartialEq for BackendWrapper
Auto Trait Implementations§
impl RefUnwindSafe for BackendWrapper
impl Send for BackendWrapper
impl Sync for BackendWrapper
impl Unpin for BackendWrapper
impl UnwindSafe for BackendWrapper
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<'a, T> FromPyObject<'a> for T
impl<'a, T> FromPyObject<'a> for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.