pyquil.unitary_tools.lifted_pauli(pauli_sum, qubits)[source]

Takes a PauliSum object along with a list of qubits and returns a matrix corresponding the tensor representation of the object.

Useful for generating the full Hamiltonian after a particular fermion to pauli transformation. For example:

Converting a PauliSum X0Y1 + Y1X0 into the matrix

[[ 0.+0.j,  0.+0.j,  0.+0.j,  0.-2.j],
 [ 0.+0.j,  0.+0.j,  0.+0.j,  0.+0.j],
 [ 0.+0.j,  0.+0.j,  0.+0.j,  0.+0.j],
 [ 0.+2.j,  0.+0.j,  0.+0.j,  0.+0.j]]

Developer note: Quil and the QVM like qubits to be ordered such that qubit 0 is on the right. Therefore, in qubit_adjacent_lifted_gate, lifted_pauli, and lifted_state_operator, we build up the lifted matrix by performing the kronecker product from right to left.

  • pauli_sum (Union[PauliSum, PauliTerm]) – Pauli representation of an operator
  • qubits (List[int]) – list of qubits in the order they will be represented in the resultant matrix.
Return type:



matrix representation of the pauli_sum operator