Processing math: 100%

qml.liealg.adjvec_to_op

adjvec_to_op(adj_vecs, basis, is_orthogonal=True)[source]

Transform adjoint vector representations back into operator format.

This function simply reconstructs ˆO=jcjˆbj given the adjoint vector representation cj and basis ˆbj.

See also

op_to_adjvec()

Parameters
  • adj_vecs (TensorLike) – collection of vectors with shape (batch, len(basis))

  • basis (List[Union[PauliSentence, Operator, TensorLike]]) – collection of basis operators

  • is_orthogonal (bool) – Whether the basis consists of orthogonal elements.

Returns

collection of operators corresponding to the input vectors read in the input basis. The operators are in the format specified by the elements in basis.

Return type

list

Example

>>> from pennylane.liealg import adjvec_to_op
>>> c = np.array([[0.5, 0.3, 0.7]])
>>> basis = [qml.X(0), qml.Y(0), qml.Z(0)]
>>> adjvec_to_op(c, basis)
[0.5 * X(0) + 0.3 * Y(0) + 0.7 * Z(0)]