# Tag Info

8


4

You can draw the circuit using construct_circuit().draw(). In the tutorial you are talking about, if you scroll down to the 4x4 randomly generated section that uses params5 you can run print(hhl.construct_circuit()), after the line hhl = HHL.init_params(params5, algo_input). This may take a little while to complete but it should eventually print out ASCII ...

4

There is actually a nice way to do this in Qiskit, since it has decompositions for single-qubit unitaries built in. The QuantumCircuit.squ method takes a unitary 2x2 matrix $U$ and a qubit and computes the decomposition $$U = R_Z(\alpha) R_Y(\beta) R_Z(\gamma)$$ This is a common decomposition, you can find a proof here https://arxiv.org/pdf/quant-ph/...

4

You want to implement $$e^{i3\pi/4}e^{iX\pi/4}.$$ I would rewrite this as $$e^{i3\pi/4}He^{iZ\pi/4}H.$$ This is the same as $$-HS^\dagger H$$ in standard gate terminology. If you're only implementing the gate $e^{iAt}$, then you can neglect the global phase and just implement $HS^\dagger H$. Both of these gates are readily implemented in qiskit as sdg ...

4

To find the expectation value of a given Pauli matrix, you just measure in the basis defined by the Pauli matrix. For example, to evaluate the expectation value of the $X$ matrix, you find the basis vectors of the $X$ matrix. These are $|+\rangle$ and $|-\rangle$, with corresponding eigenvalues +1 and -1. You measure in the $|\pm\rangle$ basis many times and ...

4

These aren't error messages, they are just outputs. The first message simply means it will be using your credentials for the session. This has probably popped up because you have run IBMQ.load_accounts() more than once. The second message appears to just be the output of the creation of the circuits variable.

3

1) Are we not applying the conditional Hamiltonian evolution to $|\Psi_0 \rangle |b \rangle$? The operation $$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau| \otimes e^{iA\tau t_0 / T}$$ is a controlled operation. You can read it as: $\forall \tau \in [0, T-1]$, if the first register is in the state $\vert \tau \rangle$, apply $e^{iA\tau t_0 / T}$. ...

3

The simplest method to implement $e^{iA\theta}$ for a small, Hermitian matrix $A$ is to: Find the eigenvectors $|\lambda\rangle$ and eigenvalues $\lambda$ of $A$. Construct the unitary $U=\sum_i|i\rangle\langle\lambda_i|$. Implement the gate sequence: $U$ $e^{i\theta\sum_i\lambda_i|i\rangle\langle i|}$ $U^\dagger$ Now, for one qubit, you have the middle ...

3

Disclaimer: I'm the one that wrote the code of the 4x4 HHL. Controlling a quantum gate $U$ can be achieved by controlling each of the $U_i$ gates that are composing $U$. For the specific example you are considering, the implementation is available online. Some remarks about the code: I think the code is not up to date with the last version of Qiskit. I ...

3

It's not possible to create the initial states $\left| \Psi_0\right>$ and $\left|b\right>$ on the IBM 16 qubits version. On the other hand, it is possible to approximate them with an arbitrarily low error1 as the gates implemented by the IBM chips offer this possibility. Here you ask for 2 different quantum states: $\left| b \right>$ is not ...

3

You are half right, in that the $C$ factor is only kept there for (what I assume being) explanatory purposes. However, the $1/\lambda_j$ factors definitely stays there after postselection. One way to see this is that you can think of those factors as attached to the other registers, so that the state is equivalently written as $$\left(\sum_j\beta_j\sqrt{1-... 3 I don't see the need for the swap gate either. Although I also don't think you need the set of swap gates that you're wanting. Remember that the standard implementation of the Fourier transform outputs the binary string j\in\{0,1\}^4 where the eigenvalues are of the form 2\pi j/16 but in reverse order, so the least significant bit is at the top, and the ... 3 Let's assume that you have a Hermitian matrix$$ H=\left(\begin{array}{cc} 0 & A^\dagger \\ A & 0 \end{array}\right). $$Let |b\rangle be the state that we want to apply A to, extended to work on the space that H acts on. So, our aim is to implement H|b\rangle. Let X be the standard Pauli X matrix. If we implement a unitary evolution$$ ...

3

Define the states $$|\psi_t\rangle=\left\{\begin{array}{cc} |t\rangle\otimes(U_{t-1}U_{t-2}\ldots U_1|\psi\rangle) & t=1,2,\ldots T \\ |t\rangle\otimes(U_{T}U_{T-1}\ldots U_1|\psi\rangle) & t=T+1,T+2,\ldots 2T \\ |t\rangle\otimes(U_{3T+1-t}U_{3T-t}\ldots U_1|\psi\rangle) & t=2T+1,2T+2,\ldots 3T \end{array}\right.$$ Now let $$U=\frac{2}{T}\sum_{... 3 Be careful! They don't apply e^{i\pi A} and e^{i\pi A/2}. They apply$$ |0\rangle\langle 0|\otimes I\otimes I+|1\rangle\langle 1| \otimes I\otimes e^{i\pi A} $$and$$ I\otimes |0\rangle\langle 0|\otimes I+I\otimes |1\rangle\langle 1|\otimes e^{i\pi A/2},  i.e. controlled versions of the gates, controlled off two different qubits. So, consider the 4 ...

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