Skip to content

Added noise module#5

Open
QuantumRaul wants to merge 3 commits intoMowstyl:masterfrom
QuantumRaul:Added_Noise_Module
Open

Added noise module#5
QuantumRaul wants to merge 3 commits intoMowstyl:masterfrom
QuantumRaul:Added_Noise_Module

Conversation

@QuantumRaul
Copy link

I created the Class QPU in order to make simulations applying noise just as the real QPU (Quantum Procesing Units) have.
I added some data about several QPUs in the market, that can be accessed through the cloud, through an sql script in order to be accessed later from the QPU class.

registry = QPU(type = "superconductor", topology = "heavy_hex", num_qbits = 10)

It calculates the noise parametres and initiates a QRegistry with noise enabled.
Just at the creation of the registry and at measurements it applies the SPAM error (State Preparation And Measurement) as a ratio of preparing (or measuring) the state 1 when it shoud be the state 0 and viceversa.

 def apply_spam_noise(self, when, mess = []):
        spam_error = self.noise_params[0]
        if when == "preparation":
            for qbit in range(self.num_qubits):
                if random() < spam_error:
                    self.apply_gate('X', targets = qbit)

        elif when == "measurement":
            for qbit in range(len(mess)):
                if random() < spam_error:
                    mess[qbit] = not mess[qbit]
                return mess

In order to apply the gate fidelity it checks if it is a 2 qbit gate or a 1 qbit gate in order to apply the right fidelity from the noise parameters. It calculates a noisy gate as seen in parser.py (lines 326-340) to be applied to the registry.

I had to change the usage of the gates to apply in a way that I feel it is more intuitive mostly in the gates like the U gate that need some parameters like an angle. Also targets must be lists even if there is only one target to the gate.
For example:
Before we had to use:

registry = registry.apply_gate("U(th, ph, la)", targets = 1)

Now it is used like:

registry = registry.apply_gate("U", gate_args = (th, ph, la), targets = [1])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant