Real quantum device/noisy simulations

Hello everyone!
I’ve recently learned about YaoQuantum, and I began to use it to solve differential equations via quantum algorithms. Although the results were quite interesting, I would like to perform the same simulations in a real quantum device (or to perform a noisy simulation, at least).

What are the best options to achieve this goal? I’ve considered YaoQASM and QuantumInformation.jl so far.

What do you think? Would you suggest a different approach?

1 Like

What exactly do you want to do in the program side? Converting some existing QASM program to Julia or just write a simulation? Can you elaborate more details about the task?

On the other hand what kind of noise are you thinking?

Actually, I want to implement the same algorithm in different frameworks, and then compare their relative errors. It would be something similar to that benchmark analysis from Yao’s whitepaper, but comparing the relative errors of each framework.

As for the kind of noise, it would be nice to have an environment like Qiskit Aer - not sure if that’s possible though.

Why would you compare the error? If the simulation is full amplitude simulation there’s no system error. If you are looking for approximate simulation you should just estimate the error via the error bound provided by the corresponding algorithm paper.

Yes, I’m looking for approximate simulations.

The error comparison idea came from the fact that I’m trying to implement those simulations on real quantum devices. Therefore, I would like to know which algorithm+framework combination would provide smaller errors if we used actual quantum devices.

I think PastaQ is the only approximate simulator at the moment in Julia via tensor network. Yao currently only has exact simulation, which means it only has sampling error if you do measurements.

QuantumInformation simulates the quantum channels. Which I believe is also exact simulation

There’s QuDiffEq also provides some quantum solvers implemented using Yao. We recently integrated PastaQ as a new backend for Yao in YaoPastaQ

If you are looking for QASM conversion consider YaoBlocksQASM which convert things to openQASM.

If you want the error to be as small as possible in your simulation you should consider exact simulation

Interesting! I’ll have a look at PastaQ.
Thanks, @Roger-luo!

Follow-up: I’m exploring exact simulations, like the QuLDE codes, and I want to access the circuit that solves the linear differential equation. Is there an easy way to do that?
I’m trying to get (and plot) the output of the function quldecircuit, but I’m not very familiar with Julia, so this is kind of a challenge at this moment.

Any thoughts?

just call this function?

then plot using YaoPlots?

1 Like

Yes, that worked perfectly. But now, when I try to convert my circuit to QASM, I’m getting the following error: Inverse Control used in Control gate context (I used that Github example).

Then I rewrote the circuit by expressing the inverse control gates in terms of control gates - just added a couple of X gates.

But I’m still wondering whether there is a faster way to fix this. Rewriting all of the inverse control gates might not be that simple if you have a larger circuit. Is there another approach?

no there’s no other way, the QASM specification simply can’t represent this algorithm natively, so you will have to do it yourself.

In the future, we may have some compilation implemented in YaoCompiler to make this simpler, but not at the moment.

1 Like

Got it. Thanks again, @Roger-luo!