UnivariatePiecewiseLinearObjective¶
-
class
UnivariatePiecewiseLinearObjective
(num_state_qubits, min_state_value, max_state_value, breakpoints, slopes, offsets, f_min, f_max, c_approx, i_state=None, i_objective=None)[source]¶ Bases:
qiskit.aqua.utils.circuit_factory.CircuitFactory
Univariate Piecewise Linear Objective Function.
This objective function applies controlled Y-rotation to the target qubit, where the control qubits represent integer value, and rotation approximates a piecewise linear function of the amplitude f:
\[|x\rangle |0\rangle \mapsto |x\rangle (\sqrt(1 - f(x))|0\rangle + sqrt(f(x))|1\rangle )\]- Parameters
num_state_qubits (
int
) – number of qubits to represent the statemin_state_value (
float
) – lower bound of values to be represented by state qubitsmax_state_value (
float
) – upper bound of values to be represented by state qubitsbreakpoints (
Union
[List
[float
],ndarray
]) – breakpoints of piecewise linear functionslopes (
Union
[List
[float
],ndarray
]) – slopes of linear segmentsoffsets (
Union
[List
[float
],ndarray
]) – offset of linear segmentsf_min (
float
) – minimal value of resulting function (required for normalization of amplitude)f_max (
float
) – maximal value of resulting function (required for normalization of amplitude)c_approx (
float
) – approximating factor (linear segments are approximated by contracting rotation around pi/4, where sin^2() is locally linear)i_state (
Optional
[List
[int
]]) – indices of qubits that represent the statei_objective (
Optional
[int
]) – index of target qubit to apply the rotation to
Methods
Adds corresponding controlled sub-circuit to given circuit
Adds controlled inverse of corresponding sub-circuit to given circuit
Adds controlled, inverse, power of corresponding circuit.
Adds controlled power of corresponding circuit.
Adds inverse of corresponding sub-circuit to given circuit
Adds inverse power of corresponding circuit.
Adds power of corresponding circuit.
returns number of qubits
returns number of qubits controlled
requires ancillas
returns required ancillas controlled
value to estimation
Attributes
-
num_target_qubits
¶ Returns the number of target qubits