What does a statevector with 3 elements (in Qiskit) represent?
Quantum Computing SEArchived Mar 16, 2026✓ Full text saved
I wasn't quite sure where to post this as I don't know if this is a Qiskit specific thing or not, but I'm not sure how to interpret this result I got from running a simulation. from result.data(): {'counts': {'0x0': 371, '0x1': 653}, 'statevector': [[0.6095190950364658, 0.00167238253077826], [0.6389605613454776, 0.46926856185163585], [0.0002864410240029574, -0.00010852146395313456]]} From result.get_statevector(): array([6.09519095e-01+1.67238253e-03j, 6.38960561e-01+4.69268562e-01j, 2.86441024e
Full text archived locally
✦ AI Summary· Claude Sonnet
What does a statevector with 3 elements (in Qiskit) represent?
Ask Question
Asked 4 years, 2 months ago
Modified yesterday
Viewed 412 times
1
I wasn't quite sure where to post this as I don't know if this is a Qiskit specific thing or not, but I'm not sure how to interpret this result I got from running a simulation.
from result.data():
{'counts': {'0x0': 371, '0x1': 653},
'statevector': [[0.6095190950364658, 0.00167238253077826],
[0.6389605613454776, 0.46926856185163585],
[0.0002864410240029574, -0.00010852146395313456]]}
From result.get_statevector():
array([6.09519095e-01+1.67238253e-03j, 6.38960561e-01+4.69268562e-01j,
2.86441024e-04-1.08521464e-04j])
This is a 1-qubit system btw
Also, I'm pretty new to QC, so pls be nice
Here's the code I'm using to simulate the system:
backend_sim = FakeArmonk()
custom_gate = Gate('custom_gate', 1, [])
qc1 = QuantumCircuit(1, 1)
qc1.initialize([np.cos(a[0]/2), np.exp(a[1]*1.j)*np.sin(a[0]/2)], 0)
qc1.append(custom_gate, [0])
qc1.measure(0, 0)
with pulse.build(backend_sim, name='custom_gate') as my_schedule:
pulse.play(Gaussian(duration=256+64, amp=.36, sigma=80), pulse.drive_channel(0))
qc1.add_calibration(custom_gate, [0], my_schedule)
qc1 = transpile(qc1, backend_sim)
pulse_sched = schedule(qc1, backend_sim)
pulse_sched.draw()
job1 = execute(pulse_sched, backend_sim, shots=1024)
result1 = job1.result()
result1.data()
The initialize state doesn't matter, it is a random pure state, and the parameters of the Gaussian pulse are also arbitrary
qiskitprogrammingsimulation
Share
Improve this question
Follow
edited Dec 20, 2021 at 0:43
3yakuya
6823
3 silver badges
10
10 bronze badges
asked Dec 19, 2021 at 20:47
soravoid
814
4 bronze badges
Add a comment
1 Answer
Sorted by:
Highest score (default)
Date modified (newest first)
Date created (oldest first)
0
From Qiskit docs:
Statevector backends return a dictionary with key ‘statevector’ and values being a list[list[complex components]] list of 2^num_qubits complex amplitudes. Where each complex number is represented as a 2 entry list for each component. For example, a list of [0.5+1j, 0-1j] would be represented as [[0.5, 1], [0, -1]].
which gets perhaps a bit clearer in your result from get_statevector(), where you just got an array of 3 complex values. As for why 3 and not 2, docs on Statevector dimensions can be helpful:
the length of the input vector specifies the total dimension of the density matrix. If it is a power of two the state will be initialized as an N-qubit state. If it is not a power of two the state will have a single d-dimensional subsystem.
In other words, the resulting state is a mixed state (not pure.)
Possibly helpful post on mixed states
Share
Improve this answer
Follow
answered Dec 19, 2021 at 21:51
3yakuya
6823
3 silver badges
10
10 bronze badges
That's good to know! Tbh I didn't think a single qubit system could be mixed, but my perception of mixed and pure states are probably still off. Do you know of a way to get the density matrix out of the simulator (FakeArmonk)? Trying to get a density matrix from that statevector gives a 3x3 matrix. My ultimate goal is to check the fidelity of the final state with a pure state. –
soravoid
Commented
Dec 20, 2021 at 0:22
1
A single qubit state can be mixed, but even then the density matrix would be 2x2. I suspect that in this case, the statevector contains not only the amplitudes for the |0> and |1> state, but also for the |2> state. On a real system, the higher energy levels are also populated a bit and since you're working with pulses it might return also higher excited states? –
Cryoris
Commented
Dec 20, 2021 at 15:13
I think you're right, the numbers seem to be matching up, though the question now is whether I calculate the fidelity by excluding the probabilities in the |2> state or by making the coefficient 0 for |2> in the pure state –
soravoid
Commented
Dec 20, 2021 at 18:14
Add a comment
Your Answer
Sign up or log in
Sign up using Google
Sign up using Email and Password
Post as a guest
Name
Email
Required, but never shown
Post Your Answer
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Ask question
Explore related questions
qiskitprogrammingsimulation
See similar questions with these tags.
The Overflow Blog
Open source for awkward robots
Domain expertise still wanted: the latest trends in AI-assisted knowledge for...
Featured on Meta
Logo updates to Stack Overflow's visual identity
Linked
22
Density matrices for pure states and mixed states
Related
1
Print data() with statevector and qasm simulator - Qiskit
3
Qiskit get qubits from statevector
3
Get the gates after fusion optimization in Qiskit statevector simulator
4
Does Qiskit Statevector has actual speed up for Grover Search?
3
Does the effect of a pulse gate using a custom gate reflect the effect of the pulse on the qubit?
4
TranspilerError: 'The input circuit None is not scheduled'
4
How to represent a statevector in Dirac notation form using Qiskit?
2
get_statevector() not working with Qiskit Aer's statevector simulator
2
Problem with Qiskit statevector simulator
1
Using GPUs with Statevector Simulator in Qiskit 1.0
Hot Network Questions
Why were two different Hebrew words used for "first" in Genesis 8:13?
Is compound assignment on atomic variables guaranteed to be atomic prior to C23?
Montesquieu on the Civil laws
For Pi Day, which expression is larger?
PI on medical leave: ethics and etiquette
Use the main font in math mode (Roboto serif)
Add two rational numbers... esoterically
disk encryption passphrase to unlock disk - removal of passphrase?
Six-Variable Logic Puzzle - How to solve with a forced logical path
About claims and evidence
The assumptions for causal inference seem obvious - why state them?
How do I set a static IP on startup?
wiring transformer to drive 240vac well pump from 120vac circuit
Typical length and structure of “selection criteria responses” in Australian academic job applications (math/statistics)
How many degrees is the sum of the marked angles?
Boot manager that can load a kernel file on PC with a 8086 CPU
Verifying Wood's Theorem on Homotopy Groups
apt-key is removed in Debian 13. How to list keys?
When is a theory effective?
Suing the federal postal service for regularly failing to deliver mail to a customer
How should (0,-1) -- +([turn]45:2) be interpreted?
ATTiny816 - How are these two code fragments different?
The interaction of Bloodrager Rage with the Hungry Goblin feat seems powerful. Is it really?
The essence of ZFC
Question feed
By continuing to use this website, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. By exiting this window, default cookies will be accepted. To reject cookies, select an option from below.
Customize settings
Cookie Consent Preference Center
When you visit any of our websites, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences, or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and manage your preferences. Please note, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
Cookie Policy
Accept all cookies
Manage Consent Preferences
Strictly Necessary Cookies
Always Active
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
Targeting Cookies
Targeting Cookies
These cookies are used to make advertising messages more relevant to you and may be set through our site by us or by our advertising partners. They may be used to build a profile of your interests and show you relevant advertising on our site or on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device.
Performance Cookies
Performance Cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
Functional Cookies
Functional Cookies
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
Cookie List
Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label
Necessary cookies only Confirm My Choices