UnivariateVariationalDistribution
class UnivariateVariationalDistribution(num_qubits, var_form, params, low=0, high=1)
The Univariate Variational Distribution.
Parameters
- num_qubits (
int
) – Number of qubits - var_form (
Union
[QuantumCircuit
,VariationalForm
]) – Variational form - params (
Union
[List
[float
],ndarray
]) – Parameters for variational form - low (
float
) – Lower bound - high (
float
) – Upper bound
Attributes
high
returns high
low
returns low
num_target_qubits
Returns the number of target qubits
num_values
returns number of values
probabilities
returns probabilities
values
returns values
Methods
build
UnivariateVariationalDistribution.build(qc, q, q_ancillas=None, params=None)
build_controlled
UnivariateVariationalDistribution.build_controlled(qc, q, q_control, q_ancillas=None, use_basis_gates=True)
Adds corresponding controlled sub-circuit to given circuit
Parameters
- qc (QuantumCircuit) – quantum circuit
- q (list) – list of qubits (has to be same length as self._num_qubits)
- q_control (Qubit) – control qubit
- q_ancillas (list) – list of ancilla qubits (or None if none needed)
- use_basis_gates (bool) – use basis gates for expansion of controlled circuit
build_controlled_inverse
UnivariateVariationalDistribution.build_controlled_inverse(qc, q, q_control, q_ancillas=None, use_basis_gates=True)
Adds controlled inverse of corresponding sub-circuit to given circuit
Parameters
- qc (QuantumCircuit) – quantum circuit
- q (list) – list of qubits (has to be same length as self._num_qubits)
- q_control (Qubit) – control qubit
- q_ancillas (list) – list of ancilla qubits (or None if none needed)
- use_basis_gates (bool) – use basis gates for expansion of controlled circuit
build_controlled_inverse_power
UnivariateVariationalDistribution.build_controlled_inverse_power(qc, q, q_control, power, q_ancillas=None, use_basis_gates=True)
Adds controlled, inverse, power of corresponding circuit. May be overridden if a more efficient implementation is possible
build_controlled_power
UnivariateVariationalDistribution.build_controlled_power(qc, q, q_control, power, q_ancillas=None, use_basis_gates=True)
Adds controlled power of corresponding circuit. May be overridden if a more efficient implementation is possible
build_inverse
UnivariateVariationalDistribution.build_inverse(qc, q, q_ancillas=None)
Adds inverse of corresponding sub-circuit to given circuit
Parameters
- qc (QuantumCircuit) – quantum circuit
- q (list) – list of qubits (has to be same length as self._num_qubits)
- q_ancillas (list) – list of ancilla qubits (or None if none needed)
build_inverse_power
UnivariateVariationalDistribution.build_inverse_power(qc, q, power, q_ancillas=None)
Adds inverse power of corresponding circuit. May be overridden if a more efficient implementation is possible
build_power
UnivariateVariationalDistribution.build_power(qc, q, power, q_ancillas=None)
Adds power of corresponding circuit. May be overridden if a more efficient implementation is possible
get_num_qubits
UnivariateVariationalDistribution.get_num_qubits()
returns number of qubits
get_num_qubits_controlled
UnivariateVariationalDistribution.get_num_qubits_controlled()
returns number of qubits controlled
pdf_to_probabilities
static UnivariateVariationalDistribution.pdf_to_probabilities(pdf, low, high, num_values)
Takes a probability density function (pdf), and returns a truncated and discretized array of probabilities corresponding to it
Parameters
- pdf (function) – probability density function
- low (float) – lower bound of equidistant grid
- high (float) – upper bound of equidistant grid
- num_values (int) – number of grid points
Returns
array of probabilities
Return type
list
required_ancillas
UnivariateVariationalDistribution.required_ancillas()
returns required ancillas
required_ancillas_controlled
UnivariateVariationalDistribution.required_ancillas_controlled()
returns required ancillas controlled
set_probabilities
UnivariateVariationalDistribution.set_probabilities(quantum_instance)
Set Probabilities
Parameters
quantum_instance (QuantumInstance) – Quantum instance