qml.qchem.excitations_to_wires¶

excitations_to_wires(singles, doubles, wires=None)[source]

Map the indices representing the single and double excitations generated with the function excitations() to the wires that the Unitary Coupled-Cluster (UCCSD) template will act on.

Parameters
• singles (list[list[int]]) – list with the indices r, p of the two qubits representing the single excitation $$\vert r, p \rangle = \hat{c}_p^\dagger \hat{c}_r \vert \mathrm{HF}\rangle$$

• doubles (list[list[int]]) – list with the indices s, r, q, p of the four qubits representing the double excitation $$\vert s, r, q, p \rangle = \hat{c}_p^\dagger \hat{c}_q^\dagger \hat{c}_r \hat{c}_s \vert \mathrm{HF}\rangle$$

• wires (Iterable[Any]) – Wires of the quantum device. If None, will use consecutive wires.

The indices $$r, s$$ and $$p, q$$ in these lists correspond, respectively, to the occupied and virtual orbitals involved in the generated single and double excitations.

Returns

lists with the sequence of wires, resulting from the single and double excitations, that the Unitary Coupled-Cluster (UCCSD) template will act on.

Return type

tuple[list[list[Any]], list[list[list[Any]]]]

Example

>>> singles = [[0, 2], [1, 3]]
>>> doubles = [[0, 1, 2, 3]]
>>> singles_wires, doubles_wires = excitations_to_wires(singles, doubles)
>>> print(singles_wires)
[[0, 1, 2], [1, 2, 3]]
>>> print(doubles_wires)
[[[0, 1], [2, 3]]]

>>> wires=['a0', 'b1', 'c2', 'd3']
>>> singles_wires, doubles_wires = excitations_to_wires(singles, doubles, wires=wires)
>>> print(singles_wires)
[['a0', 'b1', 'c2'], ['b1', 'c2', 'd3']]
>>> print(doubles_wires)
[[['a0', 'b1'], ['c2', 'd3']]]


Using PennyLane

Development

API

Internals