Skip to main content

New answers tagged

1 vote
Accepted

General number of classical bits: recycles qubits

You can use the unpacking operator: qc = QuantumCircuit(m, w, *[cl_reg[i] for i in range(M)])
Tristan Nemoz's user avatar
  • 6,692
1 vote

Can non-linear operations be implemented as a circuit on a quantum computer?

If you mean any kind of circuit, or more general quantum operation, that takes as input some $\rho$, and produces output probabilities equal to $\operatorname{tr}(\rho_A^2)$, or more generally a ...
glS's user avatar
  • 25.5k
0 votes

Can non-linear operations be implemented as a circuit on a quantum computer?

If you have two copies of $|\psi\rangle$, you simply perform the swap test on the "A" components.
DaftWullie's user avatar
  • 59.3k
2 votes

Error 400 on Variation Quantum Algorithm

This may be due to the changes that IBM made to sessions on 29 April: https://docs.quantum.ibm.com/announcements/product-updates/2024-04-22-session-changes The Open Plan will execute in job mode with ...
Bart's user avatar
  • 121
0 votes

Optimizing SymPy Implementation of prime factorization in form of QUBO

To make it fast, I would guess a good option is to ditch sympy and simply use a dictionary and strings to create the QUBO, probably something like dic[(x_1,x_2,x_3)] = alpha_(x_1,x_2,x_3) which takes ...
john's user avatar
  • 17
1 vote

IBMBackendValueError: number of circuits exceeds the maximum for this backend, 300

Right, I also see no max explicit parameter capping the number of iterations in qml.AdamOptimizer(). You can always solve it 'manually' by adding a counter of ...
Jan Balewski's user avatar
3 votes

How to implement a quantum multiplier in Qiskit 1.0

I think that the problem is that you are passing a non-transpiled circuit to the job execution. I do not know why transpilation is not part of the run command. If ...
tomergf's user avatar
  • 121
1 vote

How to implement a quantum multiplier in Qiskit 1.0

Similarly to other backends, Aer only supports a limited amount of basis gates. Thus, you have to first transpile your circuit to work with your desired backend. So, simply uncommenting the ...
Tristan Nemoz's user avatar
  • 6,692
2 votes

IBMBackendValueError: number of circuits exceeds the maximum for this backend, 300

I think you need to restrict the maximal number of function call by qml.AdamOptimizer(args.lr_qaoa) to be below 300, make it 290. Executing too many circuits on ...
Jan Balewski's user avatar
1 vote
Accepted

Obtaining and Applying XX and ZZ Parity in Stim for Controlled Paulis

Stim's supported gates documentation includes the gate MXX and the gate MZZ which are exactly the two-qubit parity measurement ...
Craig Gidney's user avatar
  • 38.5k
2 votes
Accepted

For CHSH game, why does the mathematica program gives 75% as the best winning rate when sharing 2 EPR pairs?

I think the problem you're having is with your tensor product structure. If you label the qubits 1 to 4, then your A measurements are on qubits 1 and 2, while your B measurements are on qubits 3 and 4....
DaftWullie's user avatar
  • 59.3k
0 votes

Hamiltonian Simulation: What's the meaning of t in $\exp(iAt)$?

I refer you to the following notebook for a full circuit implementation and simulation of eigenvalue computation of hamiltonian matrix.
or samimi's user avatar
0 votes
Accepted

How can I control multiple gate at once (qiskit)

When you compose a subcircuit you have to specify the qubits of the main circuit to compose onto. In your case, the subcircuit has 16 qubits. Which means its controlled version has 17 qubits. So, you ...
Egretta.Thula's user avatar
3 votes
Accepted

Finding Eigenvectors of a Unitary in a Quantum circuit

You can simply use numpy: ...
Tristan Nemoz's user avatar
  • 6,692
2 votes
Accepted

Hamiltonian Simulation: What's the meaning of t in $\exp(iAt)$?

If your eigenvalues of $A$ are $\lambda_n$, then the eigenvalues of $e^{iAt}$ are $e^{i\lambda_n t}$. These values are periodic in $2\pi$, which could lead to some ambiguity in correspondence between ...
DaftWullie's user avatar
  • 59.3k
2 votes

qiskit_aer.aererror.AerError: 'unknown instruction: ccry'

This is because the Aer simulator does not directly support certain custom or advanced instructions. Make sure to transpile your circuit before running it. ...
ozark's user avatar
  • 31
0 votes

having REPEAT with circuit append

Multiplying a circuit by an integer larger than 1 turns it into a circuit with a loop, so you can do: circuit += loop_body_circuit * repeat_count or, if you ...
Craig Gidney's user avatar
  • 38.5k
1 vote

The result of qiskit calculating T-depth and its calculation method

In the first figure you added barriers which prevents a transpiler from circuit optimization. This means that T-depth can be higher than in case of the circuit without barriers. On first qubit you ...
Martin Vesely's user avatar
2 votes

The result of qiskit calculating T-depth and its calculation method

Looking at the code that implements the .depth() method for a QuantumCircuit, it seems that when using a ...
diemilio's user avatar
  • 472
4 votes

Solving quantum equation using qiskit

The paper is about the FABLE block encoding. One way to implement this in qiskit is by first using the classiq SDK package to build the model on the functional level, synthesize to a quantum program, ...
tomergf's user avatar
  • 121
0 votes

Error code 1217, Message: Reduce time between submitting subsequent jobs in a session

You need a premium account to use a session. If you don't have it, your jobs can be spaced by a long time and then the session is automatically closed.
Armand's user avatar
  • 1
1 vote
Accepted

Qiskit error: too many subscripts in einsum when calling DensityMatrix.evolve(Operator)

It seems this is not a Qiskit issue but rather a limitation in the maximum number of indices the numpy.einsum function is capable of handling (max is 26, as ...
diemilio's user avatar
  • 472
1 vote
Accepted

What is TICK layer in stim

In Stim, TICK is an instruction that does nothing except indicate the passage of time. Conceptually, ticks split the circuit up into steps. Ticks have no effect on ...
Craig Gidney's user avatar
  • 38.5k
4 votes

Solving quantum equation using qiskit

Using NumPy is probably the best way compute $\tilde{A}$. However, it is worth noting that the expression for $\tilde{A}$ shown below is just fancy bra-ket/matrix notation for a map that extracts from ...
diemilio's user avatar
  • 472
0 votes

How do I find out which packages of qiskit are compatible with eachother?

I use poetry for managing dependencies, and in my case this issue could be resolved by manually setting the qiskit version with poetry add qiskit@^1.0.0, then poetry add qiskit_ibm_runtime. The ...
didolf ganther's user avatar
2 votes
Accepted

How to apply gates on a subspace of a superposition of qubits?

Assume that, $$U = \left( {\begin{array}{*{20}{c}} u_{00}&u_{01} \\ u_{10}&u_{11} \end{array}} \right)$$ Then, you want to apply the two-level unitary $$\left( {\begin{array}{*{20}{c}} 1&0&...
Egretta.Thula's user avatar
3 votes

Solving quantum equation using qiskit

TLDR Yes, you are basically on the right track to calculate $A$. But there are some adjustments to make on how you model $U$. This is also where qiskit can be of help with the ...
qubitzer's user avatar
  • 439
0 votes

How to understand the matrix representation of the Toffoli produced by qiskit?

This is because Qiskit uses tensor ordering convention different from what is used in most quantum computing textbooks. According to a recent preprint from Qiskit team: When interpreting circuits, a ...
Egretta.Thula's user avatar
1 vote

What is the point of building arithmetic circuits in a quantum computer?

Generally speaking, you're right that you want to do as much of the arithmetic as you can on classical computers. But in a quantum algorithm, many of the values you need to do arithmetic to will be ...
Craig Gidney's user avatar
  • 38.5k
2 votes

What is the point of building arithmetic circuits in a quantum computer?

Yes, it is practical! For Grover algorithm - check the following example For risk analysis in finance - once you want to prepare some variables representing some payoff in the market. Check those ...
Ron Cohen's user avatar
  • 1,482
5 votes

Where do I create my first circuit?

Once you have the .qasm, you can also upload it to the Classiq platform https://platform.classiq.io/circuit, and then run it on a simulator. To create your .qasm file (qiskit version 1.1) you will ...
relsmoler's user avatar
2 votes

Are Quantum Computers Bad at Addition?

Additional operations will indeed be much more relevant to a fault-tolerant computer. Yet, for a fair comparison, you should run your trials with a fair implementation for each computer. For example, ...
Ron Cohen's user avatar
  • 1,482
3 votes

Does subtraction circuit have a class like full or half Carry adder circuit in qiskit? one subtraction circuit code-example in qiskit?

For subtraction as mentioned earlier you have to negate the number, and than use an adder. There are few possible implementations for that (adder can be with QFT or with ripple-carry adder with more ...
Ron Cohen's user avatar
  • 1,482
2 votes

Error while plotting the resulting distribution

Once you have the .qasm, you can also upload it to the Classiq platform https://platform.classiq.io/circuit, and then run it on a simulator. Here's how to do this step by step: Step 1: Create and save ...
Amir Naveh's user avatar
2 votes

How to read QASM files for parametrized circuits (in QISKIT)? both from_qasm_file() and from_qasm_str() fail

You can use qiskit-qasm3-import library Once you have the QASM3 program, use : from qiskit_qasm3_import import parse And than ...
Amir Naveh's user avatar
4 votes
Accepted

Where do I create my first circuit?

Google colab is one good option. You will need to install Qiskit module(s) at the beginning, then you are ready:
Egretta.Thula's user avatar
0 votes

Pauli Strings on the same qubit?

To get a sparse pauli operator for $X \times Y = iZ$ you can use complex coeffecients. Here is how you can do this: ...
Shravan Patel's user avatar
0 votes

How to read QASM files for parametrized circuits (in QISKIT)? both from_qasm_file() and from_qasm_str() fail

You can use https://github.com/Qiskit/qiskit-qasm3-import Once you have the QASM3 string program, use the following: ...
Ron Cohen's user avatar
  • 1,482

Top 50 recent answers are included