Quantum Bayesian Networks

February 15, 2019

Derivative of matrix exponential wrt each element of Matrix

Filed under: Uncategorized — rrtucci @ 1:26 am

In the quantum neural net field, in order to do backpropagation, one often wishes to take the derivative of a unitary matrix with respect to a parameter it depends on. The wonderful software PennyLane by Xanadu evaluates such derivatives using a simple formula which gives an exact answer, albeit only in special cases. Here I will discuss a simple formula that is fully general, albeit only an approximation, although reputedly a very good approximation, probably due to its symmetric nature and the smoothness of exponential functions. The method is a simple symmetric finite difference approximation.

In a StackExchange question with exactly the same title as this post, somebody called Doug suggested what he calls Higham’s “Complex Step Approximation”, to wit:

If A is a Real matrix and E_{rs} is the matrix which is 1 at position r,s and zero elsewhere,

\frac{d}{dA_{rs}}e^{A} \approx  \frac{ e^{A + ihE_{rs}} - e^{A-ihE_{rs}} }{2ih} = \frac{{\rm Im}(e^{A + ihE_{rs}})}{h}

But what if A is a Hermitian matrix and we want the derivative of exp(iA)? Here is a simple adaptation of Higham’s formula to that case.

Let E^\pm_{rs} = E_{rs} \pm E_{sr}. Note that (E^\pm_{rs})^\dagger = \pm E^\pm_{rs}.

Define a matrix M(A) by

M(A) = \left[  \begin{array}{cc} 0 &-e^{-iA}\\ e^{iA} & 0 \end{array}\right]

Then

M(A+ih) = \left[ \begin{array}{cc} 0 &-e^{-iA+h}\\ e^{iA-h} & 0 \end{array}\right]

so

M(A+ih)^\dagger = \left[ \begin{array}{cc} 0 &e^{-iA-h}\\ -e^{iA+h} & 0 \end{array}\right] =-M(A-ih)

From this, one learns the following simple recipe: the effect of the dagger on M(A) is to put a minus sign in front of the M and to take the Hermitian of the argument too.

Therefore,

\frac{d}{d{\rm Re\;}A_{rs}}M(A) \approx \frac{ M(A + ihE^+_{rs}) - M(A-ihE^+_{rs}) }{2ih}= \frac{{\rm Re\;}[M(A + ihE^+_{rs})]}{ih}

and

\frac{d}{d{\rm Im\;}A_{rs}}M(A) \approx \frac{ M(A + hE^-_{rs}) - M(A-hE^-_{rs}) }{2h}= \frac{{\rm Re\;}[M(A + hE^-_{rs})]}{h}.

Since

\frac{d}{dx}M(A) = \left[ \begin{array}{cc} 0 &-\frac{d}{dx}e^{-iA}\\ \frac{d}{dx}e^{iA} & 0 \end{array}\right] ,

it follows that

\frac{d}{dx}e^{iA} = \left[\frac{d}{dx}M(A)\right]_{10}

for x = {\rm Re\;} A_{rs}, {\rm Im\;} A_{rs}

Note:
When A is Hermitian, A_{rs} and A_{sr} = A^*_{rs} are complex conjugates so they are not independent, but the real and imaginary parts of A_{rs} are independent, so one can treat A_{rs} and A^*_{rs} as independent and do a change of variables from (A_{rs}, A^*_{rs}) to ({\rm Re}A_{rs}, {\rm Im}A_{rs}).

For discussion about this topic, in the context of quantum neural networks, see the following thread of the Pennylane discourse website
https://discuss.pennylane.ai/t/when-does-autograd-need-help/82

Advertisements

February 9, 2019

Extra, extra, read all about it! Next Toronto Quantum Computing Meetup event just announced. The speaker will be physicist and tech start-up entrepreneur Wojtek Burko

Filed under: Uncategorized — rrtucci @ 6:13 pm

The Toronto Quantum Computing Meetup is the second largest meetup in the world dedicated to quantum computing, so we claim the silver medal of Quantum Meetup Supremacy, at least for now. (currently we have 1565 Supremos as members. The biggest club is in London with a distinguished 1756 Brexiters members. We used to be the biggest, but, oh well, sic transit gloria mundi).

Those poor Brexiters. We don’t envy them one bit, or one qubit. They are in a though spot. We are so worried for them that we will soon be shipping to them a few “brexit boxes”, just in case. Just like in quantum physics, their predicament can be illustrated very well using cats. The perilous Brexit cat jump

But I digress. The main purpose of this blog post is to cordially invite you to our next meeting on Thursday, February 21, 2019. At the usual outstanding venue, Rotman School, Univ. of Toronto. Our speaker is quite impressive. I will just quote the writeup:

We are delighted to have physicist and tech start-up entrepreneur Wojtek Burko to talk about the challenges to build a venture based on the current state of the art in quantum computing.

Wojtek not only co-funded Beit.tech and succeeded in making it cash-flow positive in less than a year, but also co-launched the Bitspiration Booster VC practice, which invests in and incubates deep tech start-ups.

Before that he served as Engineering Director at Google until 2014, Chief Technology Officer at Allegro until 2015, entrepreneur, mentor, advisor, angel investor; member of the Board in several start-ups incl. EGZOTech, JAM Vehicles, Airly; chairman of the Board at ASPIRE – representing the multinational corporate scene in Poland.

Microsoft reacquires ProjectQ

Filed under: Uncategorized — rrtucci @ 9:03 am

Huawei is a major Chinese company that produces smart phones, telecommunications equipment used in 5G, etc. This company has been much in the news recently because the founder’s daughter, Meng Wanzhou, who is also the CFO of the company, was arrested at the airport in Vancouver, Canada, at the request of the US government.

As far as the subject of quantum computing is concerned, on Oct 12, 2018, Huawei promised in a conference and accompanying press release, that it would soon provide a quantum computing cloud service named HiQ. As far as I know, HiQ hasn’t been opened yet to the general public. I have searched in vain for it on the internet. According to the press release, “Huawei also showcased its quantum programming framework for the first time, which is compatible with the ProjectQ.” As you can see by the two linkedin screenshots below (slightly cropped to omit my personal info), Huawei was employing, at the time of the press release, the two authors of projectQ, Haner and Steiger, whose thesis advisor at ETH Zurich was Matthias Troyer, a Microsoft star employee.

Seems like Haner and Steiger duped Huawei, they only stayed with Huawei for 3 months, while they were secretly looking for a job at Microsoft. They were hired in the last 1-2 months as Senior Quantum Computing Researchers by Microsoft. So ProjectQ was owned by Huawei for just 3 months and is now back in the hands of the evil empire Microsoft.

Huawei and China must feel “slightly” disrespected by Microsoft for hiring those two. What if the Chinese government bans Azure from China for this slight and for the arrest of Huawei’s founder’s daughter? And what about ProjectQ versus Q#? Does this mean, if we read the tea leaves, that ProjectQ/Troyer is back again in the ascendancy at Microsoft and Q#/Krysta is in the decline? It’s like a power struggle inside the Third Reich of Microsoft

February 8, 2019

Quantum Complexity Theory for Fish

Filed under: Uncategorized — rrtucci @ 6:29 am


(This graphic was inspired by a slide in a talk by John Preskill. His version makes no allusion to sea or fish. It just uses Venn diagrams)

February 4, 2019

Translating Between Quantum Programming Languages, The Importance of Being Qubiter

Filed under: Uncategorized — rrtucci @ 7:05 am

The United Nations has 6 official languages: English, French, Spanish, Chinese, Russian and Arabic. I think the more languages you learn, the smarter you become. Don’t you?

Qubiter, a computer program/quantum programming language that I wrote, can translate from itself to the 3 most popular quantum languages that currently have a hardware backend: IBM Qiskit, Rigetti Pyquil, and Google Cirq. Here is a Jupyter notebook illustrating this feature of Qubiter.

https://github.com/artiste-qb-net/qubiter/blob/master/jupyter-notebooks/translating-qubiter-english-file-to-AnyQasm.ipynb

I’ve recently noticed that others, both in Academia and in Industry, are attempting to write their own translators between quantum languages, so there seems to be a lot of interest out there for this sort of thing. Many quantum computerists are interested in running the same quantum program side by side on the 3 hardware devices just mentioned (and others soon to come) to compare performance and final results, a worthy scientific goal.

I want to argue briefly here that Qubiter does it better 😎

Qubiter has ALL the features that each of the big 3 quantum programming languages has and then some. This makes it the most expressive tool in town. You get a more succinct, efficient translation if you using a more expressive computer language to express a command in a less expressive one. For example, if you

use more expressive to express less expressive,
less expressive -> more expressive
you might find
10 lines of code -> 10 lines of code,

whereas if you go in the opposite direction,

use less expressive to express more expressive,
more expressive -> less expressive
you might find
10 lines of code -> 30 lines of code,

because you are “trying to reinvent the wheel” in the second case.

So if Qubiter is to maintain its edge as a translator of quantum programming languages, it must always try to surpass all the other languages in expressiveness. This is what I have done so far and will try to do in the future. (For example, I recently added to Qubiter, placeholders and loops at the English file level. And take a look at the feature comparison table that I gave in a previous, recent blog post).

February 3, 2019

My Mini-Talk in absentia for FOSDEM 2019 Feb 2-3 (this weekend)

Filed under: Uncategorized — rrtucci @ 1:19 am

As I mentioned in the previous blog post, Henning Dekant, CEO of our startup Artiste-qb.net, will be speaking for our company at FOSDEM 2019 this weekend. I can’t be there so I prepared a mini-talk to be delivered long distance, via the old fashioned internet, as opposed to that new fangled technique that some are calling tête à tête. Henning is speaking mainly about Quantum Fog and Bayesian networks so I made my mini talk about a different topic; it’s a progress report on Qubiter, about the fact that Qubiter now supports Placeholders and loops at the English file level. Here is my mini-talk:

http://www.ar-tiste.com/jan2019QubiterPlaceholderAndLoops.pdf

its front page:
jan2019QubiterPlaceholderAndLoops-page1

Create a free website or blog at WordPress.com.

%d bloggers like this: