# state_infidelity¶

Graph.state_infidelity(x, y, *, name=None)

Calculate the infidelity of two pure states.

Parameters
• x (np.ndarray or Tensor) – A pure state, $$|\psi\rangle$$, with shape (..., D). Note that the last dimension must be the same as y, and the batch dimension, if any, must be broadcastable with y.

• y (np.ndarray or Tensor) – A pure state, $$|\phi\rangle$$, with shape (..., D). Note that the last dimension must be the same as x, and the batch dimension, if any, must be broadcastable with x.

• name (str, optional) – The name of the node.

Returns

The infidelity of two pure states, with shape (...).

Return type

Tensor

inner_product()

Inner product of two vectors.

unitary_infidelity()

Infidelity between a unitary and target operators.

Notes

The infidelity of two pure states $$|\psi\rangle$$ and $$|\phi\rangle$$ is defined as $$1 - \| \langle \psi | \phi \rangle \|^2$$.

>>> graph.state_infidelity(