qrao.encoding.QuantumRandomAccessEncoding¶
- class QuantumRandomAccessEncoding(max_vars_per_qubit=3)[source]¶
This class specifies a Quantum Random Access Code that can be used to encode the binary variables of a QUBO (quadratic unconstrained binary optimization problem).
- Parameters:
max_vars_per_qubit (
int) – maximum possible compression ratio. Supported values are 1, 2, or 3.
Methods
__init__([max_vars_per_qubit])encode(problem)Encode the (n,1,p) QRAC relaxed Hamiltonian of this problem.
ensure_thawed()Raise a
RuntimeErrorif the object is frozen and thus cannot be modified.freeze()Freeze the object to prevent further modification.
state_prep(dvars)Prepare a multiqubit QRAC state.
term2op(*variables)Construct a
PauliSumOpthat is a product of encoded decisionvariable(s).Attributes
OPERATORScompression_ratioCompression ratio
frozenTrueif the object can no longer be modified,Falseotherwise.max_vars_per_qubitMaximum number of variables per qubit
minimum_recovery_probabilityMinimum recovery probability, as set by
max_vars_per_qubitnum_qubitsNumber of qubits
num_varsNumber of decision variables
offsetRelaxed Hamiltonian offset
problemThe
QuadraticProgramused as basis for the encodingq2varsEach element contains the list of decision variable indice(s) encoded on that qubit
qubit_opRelaxed Hamiltonian operator
var2opMaps each decision variable to
(qubit_index, operator)