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

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.


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

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

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/...


3

I think this is enough $e^{iAt}= e^{i(1.5I)t} e^{i(0.5X)t}$ for constructing the circuit. From rx and u3: $$R_x(-t) = e^{i(0.5X)t} \qquad R_x(\theta) = u3(\theta, -\pi/2, \pi/2)$$ The $e^{i(1.5I)t}$ is a global phase gate that can be implemented via the following circuit for q[0] qubit. Here is the whole circuit for the $e^{iAt}$: # Rx part circuit.u3(-t, -...


3

You don't know the eigenvalues a priori, but you have performed phase estimation, and have (at least a good approximation to) your eigenvalues recorded on a register. If you control off that register, you can use it to decide the angle of the rotation for each eigenvector.


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 ...


3

I have implemented via qiskit two algorithms and posted in github that need only 1-2 qubits. First is Iterative Quantum Phase Estimation (IQPE) that works on two qubits, the second one is Variational Quantum Eigensolver (VQE) that works on only one qubit (one can do also for 2 qubits) in my implementations. Actually they are jupyter notebook tutorials, so I ...


3

Probably only two qubits constrain set of algorithm you can run on your device, for example HHL algorithm (linear equation solver) seems to impossible work there. You can however implement algorithms based on uniformly controlled rotation used for preparing arbitrary quantum state. See details in the paper Transformation of quantum states using uniformly ...


2

Given that the QFT is exponentially faster than the FFT, The problem with quantum computing is that they are not actually parallel computers: One is tweaking the qubits in such a way that when reading out the result, the desired result gets a high probability. The power of quantum computing comes from the vast phase-space that grows exponentially with ...


2

QFT is used for phase and amplitude estimation and hence it can be found in many application of quantum computing in finance, for example portfolio construction using HHL in its core, Monte Carlo simulation and quantum principal component analysis. There is also application in travelling salesman problem. See list of articles on these applications here: ...


2

Finding the eigenvalues of $A$ is an intermediate part of the HHL algorithm (although it will not output them). It is a quantum routine known as phase estimation, for which you need to be able to implement a controlled-unitary evolution where the unitary is determined by $U=e^{iAt}$ for some $t$. You do not need to find them by any classical routine. However,...


2

In the HHL algorithm, they are solving a linear system $Ax=b$. This is achieved by embedding $A$ into a Hermitian matrix such as $$ H=\left(\begin{array}{cc} 0 & A \\ A^\dagger & 0 \end{array}\right). $$ If $A$ has singular values $\lambda$, then $H$ has eigenvalues $\pm\lambda$. So to all intents and purposes, they are the same thing in this context....


2

The credit for this answer goes to met927 in the previous post. So please upvote that answer instead of this one. met927's response answered my question. Not setting up some of the parameters to make system draw faster was my error. So thank you met927 for responding quickly and answering my question! Below is a snippet that one can run quite quickly (...


2

A Hermitian matrix $A$ is implemented as series of controlled gates $\mathrm{e}^{iAt}$ for some $t$. This gate can be then implementend with controlled $\mathrm{U3}$ gate on IBM Q. Note that original paper on HHL algorithm (see link below) provides a "trick" how to convert any matrix to Hermitian one and apply HHL algrithm. For example, for Hermitian ...


2

Note that the ancilla qubit in your example has dimension 2, not 1, because it goes into a superposition of 2 basis states, $|0\rangle$ and $|1\rangle$. For the HHL algorithm, you need an ancilla capable of recording the three options "nothing", "well" and "ill". As such, you need a Hilbert space of dimension 3 (also called a qutrit). Now, it is true that ...


1

It is incorrect to say that the time of simulation is $T O(\log N s^2t)$ (it's also better written as $O(T\log N s^2t)$). Conceptually, the simulation time ends at $O(\log N s^2t)$. If you want to consider the phase estimation, that's another (more complex) unitary, which includes hamiltonian simulation. If you were to think this in terms of function ...


1

This is quite a broad question. In fact it seems that you have 2 questions: How can a smaller (in term of size) matrix result in a longer quantum circuit? What is the maximum depth current quantum computer can execute (reliably)? About question 1, the number of quantum gates and depth of the quantum circuit generated depends a lot on the matrix $A$ of your ...


1

I think you are misunderstanding what HHL is doing here. Let's recall the problem definition earlier in §3.1: We are given a system of $N$ linear equations with $N$ unknowns which can be expressed as $Ax=b$, where $x$ is a vector of unknowns, $A$ is the matrix of coefficients and $b$ is the vector of solutions. If $A$ is an invertible matrix, then we can ...


1

This is not an full answer to your question. But I am very interested in how did you build your own 2-qubit device, as I am thinking about such a project for some months now. Would you mind to get in touch with me and exchange our thoughts on this? I would really love to get into discussions with you, maybe you could support me to build my own device? ...


1

Stephan Jordan maintains a very comprehensive list of quantum algorithms on https://quantumalgorithmzoo.org/. Now that you have worked on some famous ones, you can consider veering off a bit. Take a look at the "Algorithm: Machine Learning" consolidation section. There are for instance single-qubit and two-qubit classifiers that could be interesting. In ...


1

You can find details about the algorithm optimality and complexity in the original paper by Harrow, Hassidim and Lloyd: Quantum algorithm for solving linear systems of equations, mainly in parts III and appendix 5. An article Quantum Circuit Design for Solving Linear Systems of Equations may be interesting for you as well. It contains a "practical" example ...


1

I tend to find the bit about the geometric random variable a bit misleading. What they're trying to say is that if you apply $A^{-1}$ to $|1\rangle|\psi\rangle$ and you measure the first register, you'll get the answer $t$ with a probability that goes like $e^{-t/T}$ (approximately, assuming large $T$), and that's a geometric distribution. Now, I think the ...


1

Disclaimer: I am learning it right now, so I can only give a partially satisfying answer. Nobody answered so far, so I'll give you the best I know waiting for somebody to give a more detailed answer. I suggest you have a look at the qiskit book, which has a simple tutorial that I found super useful. They literally say that you don't have to compute the ...


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