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=dia, ndiags=1
[[2.718+0.j     â‹…    ]
 [    â‹…     0.368+0.j]]
>>> dq.expm(dq.sigmax())
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dense
[[1.543+0.j 1.175+0.j]
 [1.175+0.j 1.543+0.j]]