Skip to content

dq.expm

expm(x: QArrayLike, *, max_squarings: int = 16) -> QArray

Returns the matrix exponential of a qarray.

The exponential is computed using the scaling-and-squaring approximation method.

Parameters

  • x (qarray-like of shape (..., n, n)) –

    Square matrix.

  • max_squarings –

    Number of squarings.

Returns

(qarray of shape (..., n, n)) Matrix exponential of x.

Equivalent JAX syntax

This function is equivalent to jnp.scipy.linalg.expm(x, max_squarings=max_squarings).

Examples

>>> dq.expm(dq.sigmaz())
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dense
[[2.718+0.j 0.   +0.j]
 [0.   +0.j 0.368+0.j]]