RY

class RY(num_qubits, depth=3, entangler_map=None, entanglement='full', initial_state=None, entanglement_gate='cz', skip_unentangled_qubits=False, skip_final_ry=False)[source]

DEPRECATED. The RY Variational Form.

The RY trial wave function is layers of \(y\) rotations with entanglements. When none of qubits are unentangled to other qubits the number of parameters and the entanglement gates themselves have no additional parameters, the number of optimizer parameters this form creates and uses is given by \(q \times (d + 1)\), where \(q\) is the total number of qubits and \(d\) is the depth of the circuit.

Nonetheless, in some cases, if an entangler_map does not include all qubits, that is, some qubits are not entangled by other qubits. The number of parameters is reduced by \(d \times q'\) where \(q'\) is the number of unentangled qubits. This is because adding more parameters to the unentangled qubits only introduce overhead without bringing any benefit; furthermore, theoretically, applying multiple RY gates in a row can be reduced to a single RY gate with the summed rotation angles.

If the form uses entanglement gates with parameters (such as ‘crx’) the number of parameters increases by the number of entanglements. For instance with ‘linear’ or ‘sca’ entanglement the total number of parameters is \(2q \times (d + 1/2)\). For ‘full’ entanglement an additional \(q \times (q - 1)/2 \times d\) parameters, hence a total of \(d \times q \times (q + 1) / 2 + q\). It is possible to skip the final layer or \(y\) rotations by setting the argument skip_final_ry to True. Then the number of parameters in above formulae decreases by \(q\).

  • ‘full’ entanglement is each qubit is entangled with all the others.

  • ‘linear’ entanglement is qubit \(i\) entangled with qubit \(i + 1\), for all \(i \in \{0, 1, ... , q - 2\}\), where \(q\) is the total number of qubits.

  • ‘sca’ (shifted-circular-alternating) entanglement it is a generalized and modified version of the proposed circuit 14 in Sim et al.. It consists of circular entanglement where the ‘long’ entanglement connecting the first with the last qubit is shifted by one each block. Furthermore the role of control and target qubits are swapped every block (therefore alternating).

The entanglement parameter can be overridden by an entangler_map explicitly The entangler map is specified in the form of a list; where each element in the list is a list pair of a source qubit and a target qubit index. Indexes are integer values from \(0\) to \(q-1\), where \(q\) is the total number of qubits, as in the following example:

entangler_map = [[0, 1], [0, 2], [1, 3]]

Parameters
  • num_qubits (int) – Number of qubits, has a minimum value of 1.

  • depth (int) – Number of rotation layers, has a minimum value of 1.

  • entangler_map (Optional[List[List[int]]]) – Describe the connectivity of qubits, each list pair describes [source, target], or None for as defined by entanglement. Note that the order is the list is the order of applying the two-qubit gate.

  • entanglement (str) – (‘full’ | ‘linear’ | ‘sca’), overridden by ‘entangler_map` if its provided. ‘full’ is all-to-all entanglement, ‘linear’ is nearest-neighbor and ‘sca’ is a shifted-circular-alternating entanglement.

  • initial_state (Optional[InitialState]) – An initial state object

  • entanglement_gate (str) – (‘cz’ | ‘cx’ | ‘crx’)

  • skip_unentangled_qubits (bool) – Skip the qubits not in the entangler_map

  • skip_final_ry (bool) – Skip the final layer of Y rotations

Attributes

RY.num_parameters

Number of parameters of the variational form.

RY.num_qubits

Number of qubits of the variational form.

RY.parameter_bounds

Parameter bounds.

RY.preferred_init_points

Return preferred init points.

RY.setting

RY.support_parameterized_circuit

Whether or not the sub-class support parameterized circuit.

Methods

RY.construct_circuit(parameters[, q])

Construct the variational form, given its parameters.

RY.get_entangler_map(map_type, num_qubits[, …])

returns entangler map

RY.validate_entangler_map(entangler_map, …)

validate entangler map