Questions tagged [programming]

For any questions whose answer is expected to require code or programming notions. For questions about a specific framework (e.g. qiskit or cirq) please also include a more specific tag. If your question is about installation or any specific framework error, consider posting it in https://stackoverflow.com/ instead.

Filter by
Sorted by
Tagged with
2 votes
1 answer
31 views

How to apply QFT to the last two qubits of a Qiskit quantum circuit?

I'm pretty new in Qiskit and quantum circuits. I'm using Qiskit to implement a quantum circuit and I followed this tutorial to implement a QFT. The way this QFT was built, it applies QFT in the first $...
3 votes
1 answer
26 views

Is it possible to brute force the Salsa-20 algorithm with quantum computing in a reasonable amount of time?

I was recently attacked by the LockBit 3.0 ransomware. I researched it and found this article: LockBit 3.0 Ransomware Unlocked. It said that "files are encrypted using the Salsa-20 algorithm.&...
1 vote
2 answers
49 views

Sorting two numbers using quantum computing

To better understand how quantum computing works, I am trying to sort two numbers using unitary matrix. Based on this definition, I understand a quantum Turing machine to have the automorphism (...
  • 111
0 votes
0 answers
11 views

How to check the jmat operators on Qutip?

I'm trying to reproduce this Qobject form Qutip https://qutip.org/docs/latest/guide/guide-tensor.html#a-two-level-system-coupled-to-a-cavity-the-jaynes-cummings-model but, I'm using the Jmat ...
  • 1
0 votes
0 answers
50 views

Do I need a lab in order to test new ideas in designing quantum circuits

I would like to know how to test new ideas certainly on a circuit level. Do I require a lab? if so where can I find one I live in Houston. Does nt quantum eliminate the necessity of a lab and can I ...
1 vote
1 answer
90 views

A quantum circuit to find if 4 given sides can form a rectangle

I wrote this code that uses a swap test to find if 2 pairs of sides are equal. First, amplitude encoding the 4 sides on 3 qubits then performing the swap test. I'm not sure where my logic went faulty, ...
1 vote
1 answer
94 views

Deustch-Jozsa algorithm for a specific problem, doesn't make sense?

I am trying to implement Deustch-Jozsa Algorithm where function f(x) = 0 for even and f(x) = 1 for odd, for a four-bit number. After writing the numbers out I found a pattern as described below ...
5 votes
1 answer
83 views

Did Feyman cite Yuri Manin in his paper "Simulating Physics with Computers"?

In Feyman’s paper "Simulating Physics with Computers", did he cite Yuri Manin as the idea of a quantum automaton that used superposition and entanglement was mentioned in his book a year ...
0 votes
2 answers
120 views

Is it possible to automatically rename a job at submission time?

I would like to find out if there is some way to rename a job automatically, either when the job is first sent to the queue, or later after the fact. I've tried searching through the forum and the ...
0 votes
1 answer
71 views

I can't load account on IBM's qiskit

I do this but it still gives an error for load account IBMQ.delete_account() IBMQ.active_account() IBMQ.save_account('myAPI toke ') IBMQ.save_account('my API toke') IBMQ.load_account() entire error ...
  • 13
0 votes
1 answer
34 views

Error while installing Qiskit version 0.22.0

I am getting following error while I write: pip3 install qiskit==0.22.0 in the terminal. ...
7 votes
1 answer
114 views

Generating random, but non-uniform state

I would like an algorithm that generates a random state, sampled according to some probability distribution which is not uniform in Hilbert space. Assume though that I have at my disposal a uniform (...
  • 490
0 votes
0 answers
34 views

How to install qiskit-research in IBM quantum lab?

When I study ‘Dynamic decoupling’, one method is add_dynamical_decoupling. Firstly I should install qiskit_research in my ...
2 votes
0 answers
43 views

Custom Mixer for QAOA for Graph Coloring, where to start?

I am trying to implement QAOA for graph coloring with hard constraints. In this paper, eq. 9 a custom mixer is proposed, is looks like this: $B_{ui} = \frac{1}{2^{l + 1}}(X_{u0}X_{u1} + Y_{u0}Y_{u1}) \...
4 votes
2 answers
88 views

How to check a given unitary evolution is correct in a real quantum computer in Qiskit?

For a given unitary, I want to know whether this unitary gate is correctly evolved in the circuit. In the simulator, I can use "statevector" to get the state vector to check the correctness ...
3 votes
1 answer
61 views

how to flatten a cirq.Circuit with CircuitOperation

I have a cirq.Circuit that uses a CircuitOperation, something like: ...
  • 325
1 vote
1 answer
25 views

Creating a gate which have multiple register as an input

I'm trying to create a new gate in qiskit which the input is multiple register but the program output an error that says: ...
0 votes
2 answers
79 views

Qiskit state_fidelity not accepting my Density Matrices

I'm attempting to use qiskit's state_fidelity(state1, state2, validate=True) but keep getting the following error: QiskitError: 'Input quantum state is not a valid' ...
  • 440
1 vote
1 answer
78 views

Using Qiskit State Tomography on Subsystems

I have a version of the following circuit set up. ...
  • 440
0 votes
0 answers
27 views

Qiskit execution of if_else with "true_body" parameter

Does anyone have experience putting a circuit in true_body parameter of if_else in Qiskit? How does it work? I’m trying to ...
1 vote
2 answers
84 views

Generating and executing large Pauli rotations in Python

I am interested in generating collective Pauli X, Y and Z spin operators for the purpose of rotating $2^N$ dimensional state vectors $|\psi\rangle$ (in the computational basis) for a quantum protocol. ...
  • 747
1 vote
2 answers
159 views

Is there any library that can convert a circuit drawn as text to a qiskit QuantumCircuit?

Does anyone know of a library to convert a parametrized qiskit circuit drawn as 'text' back to a QuantumCircuit or similar? I have see [this] 1 question, but ...
0 votes
1 answer
56 views

How to set different Backend Layouts in TKet and pyQuil (Quil compiler)?

In Qiskit it is possible to describe a CouplingMap on which a circuit get executed. This helps with testing different Layouts. There are many possibilities in Qiskit on how to do this. Firstly you can ...
  • 117
0 votes
1 answer
33 views

ctrl_state 'order' of control( )

I am qurious about the order of ctrl_state The Quantum Circuit what I expected is this. q1 is controled when '0' and q2 and a3 is controled when '1' So I wirte code that is ctrl_state='011' But ...
1 vote
1 answer
71 views

Implementing a Gaussian elimination solver for Simon's algorithm's outcome of linear equations

I'm trying to implement a gaussian elimination solver for the linear equations that are the outcome from simon's algorithm. I implemented two solutions, first: https://stackoverflow.com/a/45527097 ...
  • 37
1 vote
2 answers
130 views

Why Circuit error when I use append(U)

I am new of this field. I want to make custom Unitary transform. I make a test matrix with Identity matrix. If I use UnitaryGate and append it to main circuit, it would not work. Here is my code. I ...
1 vote
1 answer
31 views

Which method does pyQuil use to compile a Program?

I want to find out which method different compilers use to decompose a matrix into smaller gates. I went through the pyQuil code on github but could not find the answer there. Maybe i lost track of ...
  • 117
0 votes
0 answers
31 views

How can i describe Custome Gate Sets in Cirq?

i try to create a Custome GateSet with the CompilationTargetGateset class but it does not work. ...
  • 117
3 votes
1 answer
66 views

Entangling two non-physically adjacent qubits

Entanglement can be performed just between two ** adjacent qubits** (e.g. 1 and 2) or even non-physically adjacent qubits on the processor architecture can be entangled (e.g. 2 and 6). How entangled ...
1 vote
0 answers
33 views

Is there a method in pyQuil to create logical boolean gates

is there another way to represent a boolean gate. The straight forward way would be to define a gate my a matrix and then apply this gate to the circuit. What i mean by that? For Example an AND-Gate ...
  • 117
1 vote
1 answer
56 views

How many elements could a 64 qubit quantum computer hold hypothetically compared to a 32 qubit computer?

I understand that for standard bits the difference between a 64 bit memory and a 32 bit memory is 2^64 divided by 2^32. This means that with 64 bits we can access approximately 4294967296 or about ...
4 votes
1 answer
171 views

How to define a custom gate from a matrix in TKET

I'm currently learning all about different quantum tools such as qiskit, tket, cirq, Forest SDK and so on. I just want to create a circuit that gets executed given a matrix, because a circuit can be ...
  • 117
1 vote
0 answers
40 views

Error in Implementing Quantum SVM

I am getting Type error of invalid parameter in base sampler module. From what I know sampler is constructor and doesn't take any parameter values, on the qisit.org tutorial of svm they have even said ...
0 votes
1 answer
84 views

Apply Hadamard on a qubit in a register

I want to implement a Hadamard gate on a single qubit in a register. Given two qubits q0 := $|0\rangle$ and q1 := $|+\rangle$ I would like to use a Hadamard gate on the first qubit (q0). My intuition ...
  • 37
0 votes
1 answer
64 views

Implement muti-qubit controlled gate with 2 Z/X gates

This paper simulates duality mode to solve sudoku puzzles. The last diagram in the paper (shown below) illustrates multi-qubit controlled gates with two Z/X gates. I wonder if Qiskit can directly ...
  • 25
1 vote
0 answers
18 views

How representative are Pauli errors of the complete set of errors that can occur on a quantum computer?

We know that Pauli errors (=channels?) can be simulated efficiently on a classical computer. How representative are Pauli errors of the complete set of errors that can occur on a quantum computer? Is ...
  • 167
2 votes
2 answers
103 views

In what state is this 3-qubit state?

So, I have a state of three qubits that is in one of the states below, with $\omega=e^{i\frac{2\pi}{3}}$: $$|\psi_0\rangle=\frac{1}{\sqrt 3}(|100\rangle+\omega^2|010\rangle+\omega|001\rangle),$$ $$|\...
  • 21
1 vote
0 answers
76 views

How to rewrite this Cirq problem into Qiskit?

I have a following example problem in Cirq, representing a very simple operator given by $$ \hat{H} = a^\dagger_0a_2 + a_0a^\dagger_1 + 0.9\, a^\dagger_0a_1a^\dagger_2a^\dagger_3 + a^\...
  • 211
1 vote
1 answer
25 views

Syntax of Importing LogicalExpressionOracle in IBM Quantum Lab

This article provides a sample code to use Grover's algorithm to solve SAT problems. It requires importing a method called LogicalExpressionOracle. However, when I copied the code into IBM quantum lab,...
  • 25
1 vote
0 answers
37 views

How are $\theta, \phi$ and $\lambda$ for the U3 gate derived in Abhijith et al. 2018?

I am looking to implement Quantum PCA from this paper (page 62). They have their code on Github. I have gone through the paper multiple times but failing to understand how they got numbers (for theta, ...
  • 135
1 vote
1 answer
135 views

Solve sudoku using Grover's algorithm

The Qiskit tutorial shows the application of Grover's Algorithm to solve a 2x2 sudoku. However, I don't understand how why its diffuser works as intended. Precisely, why the control bit is on a "...
  • 25
1 vote
1 answer
27 views

How can I conceptualize virtual indices used in the time evolving block decimation (TEBD) algorithm?

I am trying to work with the Heisenberg $XX$ model which the Hamiltonien is given by $\hat{H} = -J \sum_i \left(\hat{X}_i\hat{X}_{i+1} + \hat{Y}_i\hat{Y}_{i+1}\right), \quad J > 0.$ Using $s^+ = |{...
2 votes
1 answer
81 views

Merge two Y**0.5 gate into a single Y gate

How can I merge two consecutive cirq.Y**0.5 gates into a single cirq.Y gate with a transformer? I can use ...
  • 349
0 votes
1 answer
55 views

Check_matrix in Pymatching and Understanding the Plot

In the simplest case, let's assume we have distance 2 surface code. The X stabilizers will be: X1X2X3 and X3X4X5 which is shown by the red lines. So the parity check matrix will be: $$ \begin{bmatrix}...
  • 560
0 votes
1 answer
24 views

Aray_to_latex not outputting anything in Jupyter Notebook

Here is my basic code ...
0 votes
0 answers
21 views

Writing a qiskit code for a encryption problem

Bob wants to send his friend Alice a message in the form of a string of bits, s. In order to make it harder for an eavesdropper to read s, Bob does the following: Defines a function $ f: \{0,1\}^n → \...
  • 1
1 vote
2 answers
154 views

what quantum computing simulator can achieve drag-and-drop programing fuction without internet like IBM web composer?

I reallt need some kind of simulator can work like this.Quirk is similar but also require internet.can anyone know how to achieve this?It is very important for some eaducational lesson to students.
2 votes
1 answer
152 views

Pennylane: take qml.state of one function and use it as the initialization for another

In Pennylane, I created a function to set the initial parameters of my qubit, and then called qml.state() to return the output. I now want to feed this initialization into another circuit, but I'm not ...
0 votes
2 answers
68 views

Link between binary program output and observable eigenvalue

A quantum cloud server like from IBM typically returns a string of 0's and 1's such as 0010. An observable such as $Z_1 \otimes Z_2 ... \otimes Z_{n}$ has two eigenvalues +1 or -1. How do I relate ...
  • 167
3 votes
1 answer
69 views

Symbolic library for qubit states

Is there any symbolic package (in Python or Julia, for example) that can represent qubit state coefficients symbolically? For example, let's assume we have an initial two-qubit state: $$ | \psi \...
  • 31

1
2 3 4 5
29