3
$\begingroup$

I would like to implement $S^{\dagger}$ gate in Q# and I would like the best way to do it, is it correct to say that $S^{\dagger}$ is equivalent to R1( -Pi()/2 , q) ? Is it also correct to say that $S^{\dagger}$ is equivalent to Rz( -Pi()/2 , q) but with a global phase ?

Thank you.

$\endgroup$

2 Answers 2

1
$\begingroup$

It is correct. Since you have $R_1(\theta) = \begin{bmatrix}1 & 0\\ 0 & e^{i\theta}\end{bmatrix}$ and $R_z(\theta) = \begin{bmatrix}e^{-i\theta/2} & 0\\ 0 & e^{i\theta/2}\end{bmatrix}$ just using the value of $\theta = -\pi/2$ gives you $R_1(-\pi/2) = \begin{bmatrix}1 & 0\\ 0 & -i\end{bmatrix} = S^{\dagger}$ and $R_z(-\pi/2) = e^{i\pi/4}\begin{bmatrix}1 & 0\\ 0 & -i\end{bmatrix}$ which works exactly the same as $S^{\dagger}$ but with a global phase of $e^{i\pi/4}$.

$\endgroup$
4
$\begingroup$

Since the S operation supports the Adjoint functor, the Q# call Adjoint S(target) is the easiest way to call the $S^{\dagger}$ gate.

To verify that this is the same as the suggestion made above by Tharrmashastha V, you can use the AssertOperationsEqualReferenced operation:

AssertOperationsEqualReferenced(1,
    ApplyToEachCA(Adjoint S, _),
    ApplyToEachCA(Rz(-PI() / 2.0, _), _)
);
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.