# Is there any method of adding two operators in a circuit?

I am trying to reconstruct the time evolution of a Hamiltonian on the quantum computing simulator, quirk. Ideally I would like to generalise this to any simulator. The unitary matrix is

$$U(t)=e^{-iHt}$$

and I've found a way to decompose the Hamiltonian into the following form:

$$U(t)=A+B(t)$$

Both $$A$$ and $$B(t)$$ can be implemented individually. (Although A is a non-unitary diagonal matrix consisting of 0s and 1s) One with a static, custom matrix gate and the other using a series of time dependent and standard gates.

Is there a systematic way to reconstruct $$U(t)$$ generally? There is no limit on the number of ancillary gates

• is it the Hamiltonian or the unitary that is of the form $A+B(t)$? – DaftWullie Jan 30 '19 at 13:30
• @DaftWullie it is the unitary, after taylor expanding – James Jan 30 '19 at 13:32
• Are $A$ and $B(t)$ both unitaries? – DaftWullie Jan 30 '19 at 16:57
• @DaftWullie B is unitary for all t, but A is non unitary. It is a diagonal matrix consisting of just 0s and 1s – James Jan 30 '19 at 20:12
• Decompose A as the sum of two unitaries ($\pm 1$ on the diagonal). Then look at Nelimee's answer – DaftWullie Jan 31 '19 at 12:21

What you are trying to do is called Hamiltonian Simulation.

If your exponential can be split in a sum of unitary matrices, @smapers' answer guide you to a good algorithm: the Linear Combination of Unitary (LCU) algorithm.

In addition to the paper linked by @smapers, here are some other papers/videos explaining LCU:

PS: there are plenty of other algorithms to perform Hamiltonian simulation. If your exponential can be split into known unitary matrices, LCU is probably the best algorithm, but you should know that it is not the only algorithm capable of simulating Hamiltonian. You can find more links in one of my previous answers about Hamiltonian Simulation. If you think you need more links on Hamiltonian Simulation algorithms just let me know.

• my B(t) is unitary for all t, but the A is a constant non-unitary matrix consisting of 0s and 1s along the diagonal only – James Jan 30 '19 at 22:10
• Then you should write this in your question. The sentence Both A and B(t) can be implemented individually. is quite misleading as it implies (at least for me) that $A$ and $B(t)$ are unitary. – Nelimee Jan 31 '19 at 8:35
• sorry about that, I'll update the question. @Daft Wullie pointed out that we can decompose A into two unitary matrices A=A'+A'' and so your answer still holds – James Jan 31 '19 at 14:28

Below is a recent paper by Gilyén et al on doing "quantum matrix arithmetics", allowing to implement linear combinations of unitary operators. They consider the general case where the linear combination in itself might not be unitary. Since the linear combination in your case is unitary, maybe there's a more efficient way.

: Gilyén, András, et al. "Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics." arXiv preprint arXiv:1806.01838 (2018).

It seems that you need oblivious fixed point amplitude amplification. See Theorem 26-28 in the aforementioned paper: arXiv:1806.01838 [quant-ph].

As a first step, you can implement $$\frac{A+B(t)}{2}$$ as a block of a unitary. This is however not a unitary itself, but then you can turn it into a unitary using oblivious fixed point amplitude amplification. If you also happen to know the (spectral) norm of $$A+B(t)$$, then ordinary oblivious amplitude amplification suffices.