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
0
votes
0answers
23 views

How to use qiskit transpile with Clifford + T basis?

How can I transpile using universal $Clifford + T$ gates set? I have only seen examples using rotations + $CNOT$. This is what I have tried ...
0
votes
0answers
20 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
59 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. ...
1
vote
2answers
27 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
57 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
69 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
27 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
47 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
29 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
74 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
27 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
38 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
70 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
60 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
114 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
118 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
38 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
85 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
50 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 ...
0
votes
1answer
22 views

How can I compose the Ising XXPOW,YYPOW and ZZPOW gate in single qubit gates and CNOT,…?

I am a bit stuck in decomposing these gates in single qubit gates, in the Cirq documentation it is written, for example that XX is for example the tensor product of Rx gates. But when I calculate ...
1
vote
1answer
49 views

Expectation value of an arbitrary observable. My own definition and `cirq` limitations

In my previous question I was struggling with the definition of expectation value of an observable for a circuit. Here is what I have derived after some support (I simplify the definition to 2-qubit ...
0
votes
1answer
35 views

Getting the current variational parameters in Qiskit

I am right now using variational quantum eigensolver (VQE) to calculate the ground state of some molecules, like H2, by qiskit. The quesiton is that how to get the current parameters of the varaional ...
0
votes
0answers
36 views

Question on qiskit.circuit.library.PiecewiseChebyshev Qiskit circuit library

This question follows the post https://quantumcomputing.stackexchange.com/posts/15070/edit. I am working on an implementation of HHL algorithm, to do so, I need to map $|\lambda\rangle\mapsto |\arcsin(...
0
votes
1answer
29 views

Quantum Katas - Tutorials - SingleQubitGates - Exercise 7 - Preparing an arbitrary state

Exercise 7 "Preparing an arbitrary state" from the Quantum Katas - Tutorials - SingleQubitGates asks to prepare a state $\alpha|0\rangle + e^{i\theta}\beta|1\rangle$, using parameters $\...
-1
votes
1answer
46 views

Optimising Angle Code in Qiskit - Using the QAOAVarForm

I’ve got a bit of an elongated plea for aid here! I’ve got some code that finds the optimum angles for QAOA on the Maximum Independent Set Problem. It does however seem about ~10x slower than related ...
1
vote
0answers
47 views

How to solve TSP problem with more than 3 nodes in the tutorial of Max-Cut and Traveling Salesman Problem?

I had to try the example of qiskit’s Traveling Salesman Problem with 3 nodes and executing it at IBM backend called simulator_statevector.Can execute and get the result normally. But when trying to ...
2
votes
1answer
35 views

How to get eigenvectors of Hamiltonian in OpenFermion

In OpenFermion you can create a Hamiltonian in terms of creation and annihilation pretty easily: ...
0
votes
1answer
58 views

Calculating the expected value of a weighted Pauli Operator in Qiskit

Following UT course on Quantum Machine Learning, they have a notebook on QAOA. As part of their lecture, they perform QAOA using Qiskit. Unfortunately, it seems the new versions of Qiskit have changed ...
1
vote
2answers
62 views

How do I get the Unitary matrix of this circuit without using 'unitary_simulator'? [duplicate]

I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator. i.e.:...
4
votes
1answer
70 views

I don't understand unitary of ${e^{iAt}}$ from HHL algorithm

I tried to implement the following circuit in the image below but with the red circled gates replaced with a unitary controlled ${e^{iAt/2}}$ and controlled ${e^{iAt/4}}$ The image came from this ...
0
votes
1answer
27 views

Why is my unitary matrix using linear algebra not matching the 'get_unitary' simulation?

I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator. i.e.:...
3
votes
1answer
70 views

Multiplying quantum circuits in cirq using * and computing “expectation values”

I am reading cirq guide about Simulation and there is an example in "Expectation values" paragraph that I don't understand. Everything boils down to the following snippet: ...
2
votes
4answers
115 views

How do I get the Unitary matrix of a circuit without using the 'unitary_simulator'?

I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator. i.e.:...
0
votes
1answer
17 views

Writing the Jaynes-Cumming model in QuTip

I want to write the Jaynes-Cumming Hamiltonian in QuTip. $$H = \hbar \omega_{C} a^\dagger a + \frac12 \hbar \omega_{a} \sigma_{z} + \hbar \lambda (\sigma_{+} a + \sigma_{-} a^\dagger)$$ I assume $\...
0
votes
1answer
37 views

I can't see the results of my of my jobs

New user here. I tried to run a test circuit which I submitted to ibmq_santiago to run, but now I cannot see my results. No histogram, no circuit, only the status timeline. I believe the problem is ...
4
votes
1answer
94 views

Qiskit - Circuit drawing esthatics - can i force the measurements in my circuit show at the end?

I'm studying an introduction course to quantum computation at my uni and we got homework to draw a certain circuit using qiskit. I managed to understand how to do what is asked from me, and this is ...
1
vote
1answer
59 views

How to upload our dataset using pytorch when it is not present in torchvision?

I am trying to upload my dataset(SWELL-KW) instead of MNIST in "Hybrid quantum-classical Neural Networks with PyTorch and Qiskit" provided by IBM qiskit but it says ...
0
votes
2answers
42 views

Issue in running the qiskit tutorial for QSVM

I am trying to run this QSVM tutorial using qiskit from my Python environment using Jupyter Notebook Firstly it gives me an error that I have to install ...
0
votes
1answer
51 views

How to get_statevector() with defined gates in Qiskit?

I'm learning Qiskit for my QC lectures and I'm not able to run the following code: ...
1
vote
1answer
36 views

How to use pass_operation_over with cirq.Operation?

Lately I saw a pull request in the Cirq GiHub repo where some dev said a test should be defined, with these constraints: You need to find a case where a ...
0
votes
1answer
48 views

Error “too many subscripts in einsum”, UnitaryGate()

I'd like to build a multi qubit controlled gate in the following way. The circuit has $n+1$ qubits, the first qubit is the control qubit, and the operation on the rest $n$ qubits is the tensor product ...
1
vote
1answer
46 views

Quantum SVM with large feature set

I am trying to practice QSVM from the following tutorial Introduction into Quantum Support Vector Machines The author has used 2 feature_dimension with 2 component PCA ...
3
votes
1answer
80 views

Bloch Sphere of Qiskit logo

Trying to plot the Bloch Sphere of the IBM Qiskit logo ...
0
votes
1answer
21 views

What's the difference between open-source QRNG and Quantis Device?

qRNG is an open-source quantum random number generator written in python and Quantis RNG is a physical quantum random number generator. Both are capable of generating quantum random numbers, but how ...
1
vote
0answers
12 views

Need Help in QGAN function to load higher dimentional data

I have a query that I am using qiskit.aqua.algorithms.QGAN library and using the qgan function and I am having difficulty in loading data of dimension 1000 rows x 10 columns. I am following qiskit's ...
1
vote
1answer
48 views

How fast is qiskit to_gate() method, which is used to convert circuit to gate?

I have prepared a quantum circuit, which is using 13 qubits. Now, I am converting this circuit to gate but it is taking around avg. 35s for conversion. It would have have been fine, if I require only ...
0
votes
1answer
37 views

Please help interpret the IBM Quantum error code: “Instruction bfunc is not supported [7001]”

I have already run the circuit on the IBM Quantum simulators successfully. But, when I ran the same circuit on the real quantum device ibmq_16_melbourne, I got the error. The IBM website does have the ...
1
vote
3answers
147 views

Incorrect rendering of a circuit by draw method

Executing from qiskit import * circuit = qiskit.QuantumCircuit(3, 3) circuit.draw(output="mpl") in ipython notebook gives the following image Which ...
0
votes
1answer
49 views

How the arguments of $U_3$ gate are converted when they're not lying in the expected range?

From the qiskit documentation (here), a general form of a single qubit unitary is defined as $$ U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{i\lambda} \sin\...
1
vote
1answer
45 views

In the job tab, no histogram appears

(Newbie here) Accessing IBM Q Experience on a Windows 7 operating system and using the Google Chorme browser. I can completely assemble my circuit, using the IBM Quantum Composer and when executing it ...

1
2 3 4 5
19