dq.cosm
cosm(x: QArrayLike) -> QArray
Returns the cosine of a qarray.
Parameters
-
x
(qarray-like of shape (..., n, n))
–
Square matrix.
Returns
(qarray 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())
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dense
[[-1.+0.j 0.+0.j]
[ 0.+0.j -1.+0.j]]