Hot answers tagged

4 votes

Generating and executing large Pauli rotations in Python

Before going into code technicalities, it is good to look at your problem from a mathematical perspective and realize a few important things which would actually trivialize your problem and technical ...
MonteNero's user avatar
  • 2,339
3 votes

Cannot import tensorflow_quantum module in Colab

I believe Google Colab has been updated to use Python 3.10 as its default. You can check by running !python --version Tensorflow Quantum is only compatible with ...
ryanhill1's user avatar
  • 2,403
3 votes
Accepted

Decoding of quantum non CSS code using Minimum Weight Perfect Matching (MWPM)

Why and how does MWPM work for non-CSS codes? Matchability has nothing to do with CSS-ness. CSS-ness isn't necessary (e.g. you can decode the honeycomb code using matching) and it also isn't ...
Craig Gidney's user avatar
  • 32.4k
3 votes

Qiskit: Can I run real experiments in QPUs with OOP structured code?

Qiskit doesn't enforce any restrictions on how you organize you code. You can use OOP concepts as long as the result circuit is an instance of QuantumCircuit class or a subclass of it.
Egretta.Thula's user avatar
2 votes
Accepted

Why does the runtime of Qiskit's job.result() scale with the number of shots?

backend.run submits the job, but job.result will wait for the outcome. So if you run a more expensive calculations, like ...
Cryoris's user avatar
  • 2,828
2 votes

How to write a 9 qubit correction code using only python, without qiskit library or others

There are several pieces of functionality you have to write, or avoid writing, in order to do this: A decoder. Something that takes the errors that occurred and predicts what corrections are needed. ...
Craig Gidney's user avatar
  • 32.4k
2 votes
Accepted

Cosmetic appearances of multi-controlled Z gate in MCMT Qiskit

I don't think this is possible if you use the MCMT class to create your custom gate. However, if you start from a simple ZGate ...
SimoneGasperini's user avatar
2 votes
Accepted

Generalizing a brick-wall circuit acting on qubits to acting on qudits

Try these changes to your code: ...
ryanhill1's user avatar
  • 2,403
2 votes
Accepted

How to remove gates added in the quantum circuit?

For your case, indeed, rerun the cell in the best solution. Here, a general solution for situation when that is not possible. Say you have the following circuit and you would like to remove the first <...
luciano's user avatar
  • 5,468
2 votes
Accepted

Installing azure-quantum with qiskit dependences

If you're on macOS the default shell zsh treats [ ] as regex instead of a string. To ...
Matthew Treinish's user avatar
2 votes

Cannot import namespace from a Q# file to run it in a python script

I don't think the cause is specific version of Python or .NET because, if you were able to do the appropriate installs like below, then all the requirements should have been met. ...
XField's user avatar
  • 21
2 votes

Decoding of quantum non CSS code using Minimum Weight Perfect Matching (MWPM)

It is possible to use MWPM for non-CSS codes. To do it, you need to find in your code what are the primal and dual syndrome graphs. Namely, each qubit should be a part both of the primal graph to ...
Yaron Jarach's user avatar
2 votes
Accepted

Qiskit: Can I run real experiments in QPUs with OOP structured code?

You can consider Qiskit as a classical interface between QPU and classical computer. You use classical programming language to prepare quantum circuit. Before sending the circuit to QPU you are still ...
Martin Vesely's user avatar
1 vote
Accepted

Create qnode with density matrix on pennylane

My previous answer mistakenly read quantum_fisher instead of classical_fisher. It is actually possible to compute the latter ...
Tristan Nemoz's user avatar
1 vote

Eigenstates differ between Qutip and Quspin

It turns out Quspin throws the eigenstates a different way than Qutip does. Qutip shows each eigenstate such as Hi.eigenstates()[1][0] is the ground, Hi.eigenstates()[1][1] is the first excited state,...
sebastien finor's user avatar
1 vote

Implementing time evolution gate for density matrix in PennyLane circuit

The answer turns out to be quite simple. We have used the fact that conjugation commutes with matrix exponentiation to turn the ostensibly complicated time evolution operator into a composition of <...
Silly Goose's user avatar
1 vote

Do not understand error in if-else section

Your code is always takes the else branch because you are branching on a == 1 where a is 0 (...
luciano's user avatar
  • 5,468
1 vote

Using stim.TableauSimulator with python multiprocessing

It's actually kind of intentional that this doesn't work. You were just saved from potentially making an enormous mistake where you duplicated the entire state of the simulator. To make seeding work ...
Craig Gidney's user avatar
  • 32.4k
1 vote
Accepted

Create circuit from qiskit json format

The format that the IBM Quantum API is currently using is Qobj (or Quantum object) which is documented here: https://arxiv.org/abs/1809.03452 and the current schema definitions for it are located here:...
Matthew Treinish's user avatar
1 vote

Are there open source implementations of quantum error correction decoders?

I've recently released an open-source implementation of the belief-matching decoder, available on GitHub and PyPI.
oscarhiggott's user avatar
1 vote

Are there open source implementations of quantum error correction decoders?

The following packages contain decoders and can be used with Python: PanQEC: Sweepmatch and Belief Propagation with Memory effect QECC: Union-Find decoder BPOSD: Belief propagation + OSD ...
Peter-Jan's user avatar
  • 949
1 vote

Quantum gates supported by qiskit

It may not be everything in Qiskit, but to view the most prominently used gates, and to have quick links to each of their forms, functions, and possible modifications, I like to log into my IBMQ ...
PGibbon's user avatar
  • 452
1 vote

Generating and executing large Pauli rotations in Python

I'm not 100% sure I interpret your Python code correctly. If you are looking to apply individual gates (direct or controlled) to a state vector with linear complexity, this code may help you.
rhundt's user avatar
  • 893
1 vote

Syntax of Importing LogicalExpressionOracle in IBM Quantum Lab

Use PhaseOracle from Qiskit Terra: ...
Egretta.Thula's user avatar
1 vote

ZZFeaureMap, TwoLocal and NLocal in Qiskit

I'm also learning and I'll share the little I know about it: These three variational quantum circuit systems are used in QML. The ZZFeatureMap is generally used in the Data Encoding process (turning ...
Luccas Marim's user avatar
1 vote
Accepted

Using qiskit on mutiple cores

Although max_parallel_threadssets the maximum number of CPU cores used by OpenMP for parallelization during execution of an experiment, there are other factors that ...
Egretta.Thula's user avatar
1 vote

How to encapsulate the set of quantum gates qiskit circuit display? (abstraction)

Inorder to Encapsulate set of gate operations and Measurements we generally use [qiskit.circuit.QuantumCircuit.to_instruction][1] . ...
Mohammed Ansah's user avatar
1 vote
Accepted

I was solving matrix of beam splitter in python but got stuck in understanding the library

A beamsplitter gates takes two parameters, and acts on two modes. The matrix that represents the gate is a 2x2 unitary. In this line you're calculating the unitary for the second 'column' in the ...
Catalina's user avatar
  • 131
1 vote
Accepted

Difference between run, measure, transpile, execute?

So many questions in your question! Not sure I'll be able to answer them all, but I'll hopefully get you started! 1)U gate has a lambda argument. What does it mean by lambda and what effect it have ...
PGibbon's user avatar
  • 452
1 vote

qiskit transpile NameError

I've solved the problem regarding the "transpile" looking at one of the examples from Qiskit in this way: I loaded the package "numpsy" - in the beginning I removed "pip ...
user21686's user avatar

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