Questions tagged [programming]

For questions about writing code to be executed on a quantum computer, or to more generally simulate some aspect of it. For questions about a specific programming language, please also include a more specific tag.

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

Replacement of FermionicOperator from qiskit.chemistry in qiskit_nature

qiskit.chemistry.FermionicOperator here is very useful for converting fermionic operators to qubits operators. qiskit.chemistry ...
0
votes
0answers
28 views

How do you build the modified Toffoli gate using only local unitary and CNOT operations?

How do you build a circuit for a modified Toffoli gate using only local unitary operations and CNOT operations? The two-qubit unitary operation is given by: $\text{diag}\{1, 1, 1, e^{i\phi}\}$.
1
vote
1answer
22 views

How to import circuit libraries into qiskit

Im trying to put the QFT circuit in my qiskit circuit but im having trouble: ...
0
votes
0answers
38 views

How to simplify a circuit with repeated same parts?

If I have a circuit with 3 qubits and repeated gates as follow: ...
1
vote
1answer
55 views

Is there a way I can reduce the code for generating simple circuits with the same structure?

here's the code I'm using to generate 3 quantum circuits with the same structure (They're only differed by the first U3 gate on the qubit): ...
2
votes
1answer
26 views

Performing a generic single-qubit Pauli error channel in stim

I have a Pauli channel with disjoint probabilities $P_I$, $P_X$, $P_Y$, $P_Z$ (meaning $P_I + P_X + P_Y + P_Z = 1$) corresponding to Pauli errors I, X, Y, Z. Is there some way apply this Pauli ...
3
votes
2answers
45 views

Inverse of Statevector.from_label in Qiskit

In Qiskit I can construct a computational basis statevector in the following fashion ...
3
votes
1answer
24 views

How to decide bias in Hamiltonian Ising model?

I am trying to code finance portfolio optimisation problem into a quantum annealer, using the Hamiltonian Ising model. I am using the dwave module ...
2
votes
1answer
55 views

configuration of FakeOpenPulse2Q

Can you help me to configure the FakeOpenPulse2Q() to produce more realistic pulses? The code below instantiates 2 circuits and generates the waveforms for each. ...
2
votes
1answer
52 views

Qiskit: Transpilation and the CircuitSampler

I am using Qiskit's opflow and its CircuitSampler to evaluate matrix elements / expectation values. Now, going beyond ...
2
votes
1answer
43 views

How do you compute the compiled unitary of a quantum circuit comprised of different $n$-input gates?

Given a quantum circuit consisting of two qubits, how is the compiled unitary of the circuit computed when we have different input type gates? (X-gate, H-gate are single-input gates, CNOT is a 2-input ...
2
votes
1answer
48 views

Pulse waveform for 2-qubit circuit

I'm trying to reproduce the Bell-state pulse display as shown in this tutorial. The code is very short: ...
1
vote
1answer
50 views

Is there any way to obtain the number of qubits of a given backend in Qiskit?

I'm testing out a program in different IBMQ mock backends, and I want the program to use the maximum number of qubits in each case. Is there any function/method to extract the number of qubits of a ...
3
votes
1answer
29 views

Is there a way to run “in the background” code sent to the IBM backends?

I use different qiskit backends to run my code. Since the maximum number of shots is $2^{13}$, sometimes I need to send the same code several times with a "different ticket". I am wondering ...
3
votes
2answers
232 views

Drawing the circuit in Qiskit - how to set same style as in Composer?

A quantum circuit can be visualized in Qiskit with circuit.draw. A drawing style can be set with parameter output which can have ...
3
votes
1answer
67 views

Why does running my circuit on Quantum Hardware produce such unexpected resultss?

I am using Jupyter Notebook with Qiskit. I have created a program that can add two 3-bit numbers together. When I simulate this program on a qasm_simulator it works as expected and I can add any two 3-...
2
votes
1answer
38 views

Why `cirq` needs `Qid` class instead of just `Qudit` class?

I am just wondering in what way cirq.Qid class generalizes qudits. From cirq.Qid documentation we read that it Identifies a ...
2
votes
1answer
74 views

Why I am gettting this error when I try to open the Quantum Lab in the IBM Quantum experience?

I am using quantum labs in IBM Quantum Experience to my circuits. But from yesterday onwards (May-03-2021) this error message is being shown on my screen. Does anyone have any idea about this issue?
2
votes
1answer
69 views

Can I use Grover's algorithm on overlapping sets of qubits?

Let's say I have 3 qubits: $q_1,q_2,q_3$. I want to apply Grover's algorithm on q1,q2, such that q1,q2 $\neq$ 10 and do the same for q2,q3, so that q2,q3 $\neq$ 11. The final possible combinations of ...
-1
votes
1answer
26 views

How to get the machine name on the IBM Quantum P.72 [closed]

I am proceeding the book titled ’IBMで学ぶ量子コンピュータ’ but I can not find the machine list on the right side of this book on page 72. Please let me know how to get the name of the machine and set it into ...
5
votes
1answer
71 views

What is the superop simulator in Qiskit for?

I'm trying to understand what the use case of a superop simulator would be. My understanding is that density matrix is generally more resource intensive than state vector, but it has additional ...
2
votes
0answers
19 views

What is the relationship between the (sx) error rate listed in calibration and the angle/amplitude errors calculated using the fitter?

The IBM Quantum services website lists calibration statistics for their devices, including the (sx) error rate per qubit, which is listed as a single number. One can also manually calibrate a device ...
2
votes
2answers
60 views

Qiskit: count the type of gates on the qubit with the largest number of gates in a multi-qubit circuit

I would like to know the number and type of all the gates on the wire/qubit with the largest operations in a quantum circuit with multiple qubits. Is there any inbuilt functionality, or what is the ...
3
votes
1answer
65 views

Why does applying a Hadamard gate three times to $|0\rangle$ result in a tiny imaginary component in the $|1\rangle$ amplitude?

I'm using qiskit with the online IBM Quantum Lab and when I run the following code ...
4
votes
1answer
170 views

Bloch sphere visualization using Cirq, ProjectQ, PyQuil

Is there a way to visualize the Bloch sphere using Cirq, ProjectQ, and/or PyQuil, as it is possible using plot_bloch_vector in Qiskit?
2
votes
0answers
40 views

How to turn a 'term' in a QuantumError into a QuantumError?

A QuantumError class may have many terms, and we can use .error_term(position) to have a look at each term. But it returns a list instead of another QuantumError ...
2
votes
1answer
29 views

Bernstein Vazirani Algorithm widget (bv_widget) in the Qiskit documentation

I'm new to quantum computing and Qiskit, so please be patient with me. I'm going through the info on Bernstein Vazirani. Here is the link to the section: https://qiskit.org/textbook/ch-algorithms/...
2
votes
0answers
54 views

How accurate are Qiskit’s unitary and Statevector simulators for very large circuits?

Background: I wrote a code that takes a Qiskit circuit C as an input and outputs a random circuit C’ such that C and C’ have the same unitaries. I tested my code using Qiskit’s Statevector simulator ...
0
votes
1answer
44 views

Qiskit QFT matrix does not match with DFT matrix

The unitary matrix associated with the QFT circuit in Qiskit does not match the actual DFT matrix. In fact, all the imaginary components have their sign flipped (...
3
votes
1answer
42 views

Measuring second excited state |2> using “calibrations” not Open Pulse

I am tying to measure the second excited state in a system that does not support Open Pulse. Instead I am using calibrations. The method detailed here does not work. I get the error ...
0
votes
1answer
53 views

How to use qiskit transpile with Clifford + T basis? [duplicate]

How can I transpile using universal $Clifford + T$ gates set? I have only seen examples using rotations + $CNOT$. This is what I have tried ...
1
vote
1answer
119 views

In the HHL alghoritm, how can I transform my hermitian matrix into a unitary operator?

I'm studying the HHL algorithm and I'm trying to do an his implementation but, there are some points that I don't understand how I can transform my hermitian Matrix into its unitary operator? In ...
1
vote
0answers
29 views

How to avoid Cirq: State_vector is not normalized error for Feedback-loop in optimizer?

I am doing a VQE in Cirq, but sometimes I get this error while running steps of the classical optimization loop: State_vector is not normalized instead had norm 1.0000000010132789 And therefore the ...
3
votes
1answer
76 views

Calculating the ground states of an Ising Hamiltonian on a real quantum computer

I have followed this tutorial and based on it, I've written the following function in qiskit, which can explicitly calculate the ground states of a transverse-field Ising Hamiltonian. ...
2
votes
2answers
39 views

Error when attempting to visualize controlled hadamard gate state matrix with qiskit

I'm trying to get used to the qiskit module and quantum circuits in general, before tackling a QML project. So I'm going through the tutorial on the documentation page regarding gates. I've gotten as ...
2
votes
0answers
73 views

is it possible to eliminate a certain possibility of an outcome of 3+ qbits

Let's say I have n qbits each in a superposition $\begin{pmatrix} \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} \end{pmatrix}$ so each possible outcome has a probability of $\frac{1}{2^n}$. Is it possible ...
0
votes
1answer
75 views

Cannot Repeat HHL Result [closed]

There is an HHL example in IBM Qiskit https://qiskit.org/textbook/ch-applications/hhl_tutorial.html If I run on that website (click "Try") in Section 4 and set ...
1
vote
1answer
28 views

Recover backend information in working remotely with the IBM-QC

I'm reading the details of qiskit following this paper (I know it's a little bit dated, but some things shown there should be in principle still accessible). For ...
1
vote
1answer
48 views

Openfermion : `get_sparse_operator` issue

I am trying to use operfermion to calculated the eigen values for different molecules. Tried for Hydrogen, LithiumHydride, Water. It works fine. When Itried to calculated the same thing for Ozone, ...
0
votes
0answers
33 views

How to extend Qiskit Quantum Counting with a Truthtable Oracle?

I'm a newbie in Quantum Computing. So please be indulgent with me. I'm trying to adapt the Qiskit Quantum Counting Example, which defines its oracle in a programmed quantum circuit, to use a ...
3
votes
1answer
87 views

Implementing 3-Qubit Grover Algorithm in Qiskit

The Qiskit tutorial on Grover's Algorithm shows an example of finding two marked solutions out of 8 items, produced by 3 qubits. Using the general diffuser code it provides, however, I realize that ...
1
vote
0answers
28 views

How to transform fermionic operators in qiskit

I encountered some problems when using the qiskit pakage to define the 2-electron reduced density matrix (2-RDM), which is a 4-index tensor, $\langle a_i^\dagger a_j^\dagger a_k a_l\rangle$. I need to ...
1
vote
1answer
43 views

How do I work with Gaussian in Qiskit?

I am trying to run this Qiskit Nature tutorial (Vibrational Structure) and it uses the GaussianForceDriver. Every time I run the Gaussian job from Qiskit I get this message: ...
1
vote
2answers
78 views

How to measure a qubit Hamiltonian in qiskit

I am using qiskit to get some measurement results of observables similar to the Hamiltonian. Can someone provide the way how qiskit measures the Hamiltonian (Jordan-Wigner transformed) when using VQE? ...
1
vote
1answer
71 views

PyTorch and Qiskit example from the Qiskit textbook seems broken

After executing the proceeding code blocks, when I try to copy the same code from Qiskit textbook on my jupyter notebook, I get the error as ...
4
votes
1answer
137 views

'Best practices' for making Stim run as fast as possible?

I'm currently testing out an error-correction surface code circuit in Stim. I've tried a 19x19 surface code over 10k rounds of syndrome extraction sampled 256 times, and this takes about 165 seconds. ...
2
votes
1answer
122 views

Symbolic computation with quantum circuits

What are my options for computing symbolic results for quantum circuits? I have identified some possibilities: SymPy (Python library, see also this), unfortunately, the software forces you to encode ...
1
vote
1answer
43 views

Unable to use iSWAP in Qiskit TwoLocal entangling_block

I would like to use a general entangler in the entanglement_block of the TwoLocal function. The function seems to work with 'cz', 'cx', 'swap' gates, but it fails for 'iswap' gate. Below is the error ...
2
votes
2answers
87 views

Re-initializing qubits in a circuit without losing superposition

So recently I was building some circuit made of subcircuits. My subcircuits happen to use auxiliary qubits, that are always initialized in the state $|0\rangle$ and are not used after the calculation. ...
2
votes
1answer
52 views

Is there any way to assign a colour for a single gate in Qiskit?

I'm drawing with Qiskit a big circuit with some predefined and custom gates. I want to colour some of them in non-default colours for a better reading of it. Is it possible to do it for predefined ...

1
2 3 4 5
19