Skip to content

dq.cosm

cosm(x: ArrayLike) -> Array

Returns the cosine of an array.

Parameters

  • x (array_like of shape (..., n, n)) –

    Square matrix.

Returns

(array of shape (..., n, n)) Cosine of x.

Note

This function uses jax.scipy.linalg.expm() to compute the cosine of a matrix \(A\): $$ \cos(A) = \frac{e^{iA} + e^{-iA}}{2} $$

Examples

>>> dq.cosm(jnp.pi * dq.sigmax())
Array([[-1.+0.j,  0.+0.j],
       [ 0.+0.j, -1.+0.j]], dtype=complex64)