Skip to content

dq.powm

powm(x: QArrayLike, n: int) -> QArray

Returns the \(n\)-th matrix power of a qarray.

Parameters

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

    Square matrix.

  • n –

    Integer exponent.

Returns

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

Examples

>>> dq.powm(dq.sigmax(), 2)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=1
[[1.+0.j   â‹…   ]
 [  â‹…    1.+0.j]]