Hot answers tagged

4

Q# is not compiled into QASM, so that would be tricky. Q# compilation and execution process is approximately as follows: Q# code is parsed into an internal data structure representing an abstract syntax tree. This data structure undergoes some transformations (for example, to generate adjoint and controlled versions of operations used in the code). I don't ...


3

How is correct that new scheme of Controlled-$G^\dagger$ gate may be constructed from this known scheme of Controlled-G gate by reversing the order of used gates ($U$) and each $U$ in this scheme changes to the corresponding $U^\dagger$ (if $U≠U^\dagger$ of course)? It's 100% correct: Inverting a composed quantum gate is done with the algorithm you gave. ...


3

There are many forms of QASM, so I'll answer for OpenQASM 2.0, as is currently used by IBM. Declaring a gate to be random means that it would be randomly generated at compile time. Since QASM is used as an expression of a compiled circuit, such randomness must be resolved by the time the QASM is created. It is true that are transpilation processes in the ...


2

This is the matrix for $Z^t$: $$Z^t = \begin{bmatrix} 1&0\\0&(-1)^t \end{bmatrix} = \begin{bmatrix} 1&0\\0&e^{i \pi t} \end{bmatrix}$$ This is the matrix for $R_Z(\pi t)$: $$R_Z(\pi t) = e^{-iZt/2} = \begin{bmatrix} e^{-i \pi t / 2}&0\\0&e^{+i \pi t / 2} \end{bmatrix} = e^{-i \pi t/2} Z^t $$ Which means that $$Z^t \equiv R_Z(\pi ...


2

Note that $$RX(\phi) = \begin{pmatrix} \cos(\phi/2) & -i\sin(\phi/2) \\-isin(\phi/2) & \cos(\phi/2)\end{pmatrix}$$ Then $$RX(\pi q) = \begin{pmatrix} \cos(\pi q/2) & -i\sin(\pi q/2) \\-isin(\pi q/2) & \cos(\pi q/2)\end{pmatrix}.$$ Now, using that $\cos(\pi k + \pi/2) = 0 = \sin(\pi k)$ and $\cos(\pi k) = 1 = \sin(\pi k + \pi/2)$ for $k\in \...


2

You need to extract the compiled qasm from a qobj object. You can create this by compiling from qiskit import compile qobj = compile(qc,backend,shots=shots) If you want to create a batch job, where you send many circuits in at once, you can replace the single circuit qc with a list of circuits. Information about the circuits, the backend on which they'll ...


2

If I understand the question correctly, you're assuming that you have some gate $V$ that you've decomposed as $\prod_{i=1}^NU_i$ and you want to show that $V^\dagger$ is $\prod_{i=1}^NU_{N+1-i}^\dagger$ where the product is taken in the opposite order? In that case, you just need to show that $VV^\dagger=\mathbb{I}$ given that $U_iU_i^\dagger=\mathbb{I}$. ...


1

Unfortunately, I'm pretty sure that the functionality you desire does not exist. You'll need to do it by constructing the unitary yourself, for example via this method provided in the answer to another question. For reference, the full specification for OpenQASM 2.0 can be found here.


Only top voted, non community-wiki answers of a minimum length are eligible