SwapRZ

class SwapRZ(num_qubits, depth=3, entangler_map=None, entanglement='full', initial_state=None, skip_unentangled_qubits=False)[source]

DEPRECATED. The SwapRZ Variational Form.

This trial wave function is layers of swap plus \(z\) rotations with entanglements. It was designed principally to be a particle-preserving variational form for qiskit.chemistry. Given an initial state as a set of 1’s and 0’s it will preserve the number of 1’s - where for chemistry a 1 will indicate a particle.

Note

In chemistry, to define the particles for SwapRZ, use a HartreeFock initial state with the Jordan-Wigner qubit mapping

For the case of none of qubits are unentangled to other qubits, the number of optimizer parameters SwapRz creates and uses is given by \(q + d \times \left(q + \sum_{k=0}^{q-1}|D(k)|\right)\), where \(|D(k)|\) denotes the cardinality of \(D(k)\) or, more precisely, the length of \(D(k)\) (since \(D(k)\) is not just a set, but a list). 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 Rz gates to the unentangled qubits only introduce overhead without bringing any benefit; furthermore, theoretically, applying multiple Rz gates in a row can be reduced to a single Rz gate with the summed rotation angles.

See RY for more detail on entangler_map and entanglement which apply here too but note SwapRZ only supports ‘full’ and ‘linear’ values.

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 describes [source, target], or None for full entanglement. Note that the order is the list is the order of applying the two-qubit gate.

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

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

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

Attributes

SwapRZ.num_parameters

Number of parameters of the variational form.

SwapRZ.num_qubits

Number of qubits of the variational form.

SwapRZ.parameter_bounds

Parameter bounds.

SwapRZ.preferred_init_points

Return preferred init points.

SwapRZ.setting

SwapRZ.support_parameterized_circuit

Whether or not the sub-class support parameterized circuit.

Methods

SwapRZ.construct_circuit(parameters[, q])

Construct the variational form, given its parameters.

SwapRZ.get_entangler_map(map_type, num_qubits)

returns entangler map

SwapRZ.validate_entangler_map(entangler_map, …)

validate entangler map