Method for quick access to the measurement results of the state of the variable. This method returns a dictionary of the type {value : p} where p indicates the probability with which that value is measured.
Plots the measurement results as a historgram. The default is False.
The backend on which to evaluate the quantum circuit. The default can be specified in the file default_backend.py.
The amount of shots to evaluate the circuit. The default is given by the backend it runs on.
Boolean indicating if the .compile method of the underlying QuantumSession should be called before. The default is True.
Keyword arguments for the compile method. For more details check QuantumSession.compile
. The default is {}
.
A dictionary of Sympy symbols and floats to specify parameters in the case of a circuit with unspecified, abstract parameters. The default is {}.
A function which recieves a QuantumCircuit and returns one, which is applied after compilation and parameter substitution. The default is None.
The location of where to save a generated plot. The default is None.
A dictionary of values and their corresponding measurement probabilities.
If the containing QuantumSession is in a quantum environment, it is not possible to execute measurements.
Examples
We create an integer QuantumFloat, encode the value 1 and bring the qubit with significance 2 in superposition. We utilize the Qiskit transpiler by transpiling into the gate set \(\{\text{CX}, \text{U}\}\)
>>> from qrisp import QuantumFloat, h >>> qf = QuantumFloat(3,-1) >>> qf[:] = 1 >>> h(qf[2]) >>> mes_results = qf.get_measurement(transpilation_kwargs = {"basis_gates" : ["cx", "u"]}) # noqa:501 >>> print(mes_results) {1.0: 0.5, 3.0: 0.5}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4