Hello World | Coding with Qiskit 1.x | Programming on Quantum Computers
Ғылым және технология
Welcome back to Coding with Qiskit, where IBM research scientist Dr. Derek Wang will get you up to speed with the latest developments in quantum computers for your own work.
What is Hello World? When installing anything new, whether it’s a language or package, it’s standard practice to include a “Hello World” example. The purpose is twofold: first, we ensure that the installation was done correctly, and second, we want demonstrate what a typical application workflow looks like. Here, we’re going to prepare a two-qubit Bell state and then, to highlight how this approach can scale to utility-scale circuits on over 100-qubit circuits, we’ll generalize our approach.
Qiskit Resources:
GitHub notebook for this episode: github.com/derek-wang-ibm/cod...
Install Qiskit - qisk.it/cwq-install
Hello World Tutorial: docs.quantum.ibm.com/start/he...
Introduction to Primitives: docs.quantum.ibm.com/run/prim...
Error Suppression and Mitigation: docs.quantum.ibm.com/run/conf...
Qiskit Github Notebook: qisk.it/cwq-ep2
Miniconda: docs.anaconda.com/free/minico...
A free IDE: code.visualstudio.com/
Qiskit GitHub: github.com/Qiskit
IBM Quantum: quantum.ibm.com/
#ibmquantum #learnquantum #qiskit
Пікірлер: 64
Some lingo that may be useful! 1. Bell State A Bell state in quantum computing is a special type of entangled state where two qubits are linked such that the state of one qubit instantly influences the state of the other, no matter the distance between them. 2. Superposition The principle that a qubit can exist in multiple states (0 and 1) simultaneously, rather than being in a single state like a classical bit. 3. Hadamard Gate A basic operation that transforms a qubit into an equal superposition of its 0 and 1 states, creating a state where the qubit has a 50% chance of being measured as 0 and a 50% chance of being measured as 1. 4. The CNOT (Controlled NOT) Gate A two-qubit operation where the state of the second qubit (target) is flipped if the first qubit (control) is in the state 1, otherwise, the target qubit remains unchanged. 5. Pauli Operators A set of three basic matrices (Pauli-X, Pauli-Y, and Pauli-Z) used to describe quantum gates that can change the state of a qubit by flipping its state, rotating it, or inverting its phase. In quantum computing, operators like ZZ, XX, and YY perform specific transformations on qubit states, altering their properties such as phase, amplitude, or entanglement.
@DerekWangIBM
20 күн бұрын
Very helpful, thanks!
@qubitevo
23 сағат бұрын
Thank you, I had no prior knowledge
I was expecting the Qubit's to print "Hello World" 😂 Man it looks like I have a lot to learn.
Awesome Derek, a fantastic Qiskit Intro! Well done and keep going compiling the tutorials in the same style... really appreciated the condensed and swift walkthrough the code and step by step instructions... 👍
Thank you so much for the clear explanation, making it easy to follow and working on my end as well. I've now completed my very first job on the IBM quantum platform 🙂! Will definitely continue with this series and enhancing my quantum knowledge.
@DerekWangIBM
14 күн бұрын
This is great to hear!
Hey, is there any detailed class on operators or some other resource? That is one part I cant still wrap my head around.
Nice to see new videos for qiskit 1.0 . Congratulations!!! But, instead of the estimator, how to calculate the count to create the histogram, as was previously done with get_counts?
@DerekWangIBM
Ай бұрын
You can use Sampler instead. I will show how this can be done in a future video dedicated to Primitives.
@oluwapelumiolubayo2043
Ай бұрын
Great video! I am also getting stuck on how to implement get_counts on the new version
@DerekWangIBM
Ай бұрын
@@oluwapelumiolubayo2043 See the next episode on Primitives, where I show how to get counts with SamplerV2
Sir can you please try the bb84 simulation using qiskit ?
Hi Derek, great video and initiative! I attempted to implement a 5-qubit GHZ example on IBM Kyoto, but I received a warning that the task would take more than 10m to execute. Surprisingly, when I tried the same on IBM Brisbane, it completed in nearly 50 seconds. This compels me to ask: How can I determine which system is more suitable for a particular task? Many thanks in anticipation.
@DerekWangIBM
14 күн бұрын
Unfortunately, I don't think there's a feature for estimating resource cost, especially on a device by device basis, until after you submit.
Hi, thanks for these lessons! They are incredibly useful. I have a quick question, when we initialized the two qubits q0 and q1 are they automatically in the |0> state? (are they both in the same state..?)
@DerekWangIBM
Ай бұрын
The convention is to assume that the qubits start in the 0 state. For the two-qubit example, we then apply a Hadamard gate to the 0th qubit, so it would no longer be in the 0 state.
hello, im facing an error in step -2 transpilation at 18.23, the error shows : raise AccountNotFoundError("Unable to find account.")
I am looking for BB84 simulation on Qiskit.
great!!
Is the transpiling section you used specific for the ibm_brisbane backend? Or can it be used for any device
@DerekWangIBM
Ай бұрын
It should work for any backend, as long as you swap out the backend name "ibm_brisbane" with your target backend. Some of the information being sent to the preset pass manager includes the coupling map, native gates, and number of gates, and these properties can of course change from device to device.
@techjunk8467
Ай бұрын
@@DerekWangIBM QiskitError: 'Number of qargs does not match (2 != 100)' I keep having this error from the operators_transpiled_list. What could be the issue?
@DerekWangIBM
Ай бұрын
@@techjunk8467 It appears you did not create operators with 100 qubits. Instead, you are applying a layout for 100 qubits on observables that have 2 qubits, which are likely leftover from the initial 2-qubit example.
Hello, I have an error saying that I am unauthorized with the code 'backend=QiskitRuntimeService().get_backend(backend_name)'. (16:40) Can you help me? Thanks!
@DerekWangIBM
Ай бұрын
It's possible you do not have access to that particular backend that I use in the video. Use a backend that you do have access to.
what extensions did you install for putting colors in the code?
@DerekWangIBM
Ай бұрын
I'm using the default dark color theme in Visual Studio Code.
@user-nj6zi6kh3e
Ай бұрын
@@DerekWangIBM I mean your QiskitRuntumeService is written in nice green color which is readable, but my code is all shown in white🥲
@user-nj6zi6kh3e
Ай бұрын
@@DerekWangIBM I was wondering about the color of the code because I can see nice readable green color from your library code but not in mine.
When I tried to run the estimator part of the code it is showing that qc is not defined, why is it happening, is it because I refreshed the VS Code, because when I again run all of the code from the start it works
@DerekWangIBM
Ай бұрын
Run the block that defines the `qc` before trying to pass it into the Estimator.
@kelleclark4521
Күн бұрын
since I restarted the kernel after doing the pip install qiskit_aer at this point, I had to run all to get the variables back
I did't get why we are intoducing operators and not just running the qc to get 50% |00> and 50 % |11> what are we doing here ?
@DerekWangIBM
Ай бұрын
Sure, one could do that too. In fact, we do exactly what you suggest in an upcoming video :)
@martinbombardelli1324
Ай бұрын
@@DerekWangIBM Can't wait to see it, i'm trying to get a grasp of qiskit but there is son few documentation on version 1.X (except official one of course)
Whenever I type in qc.daw() my circuit is not drawing. Please help
@RenderedUselessness
Күн бұрын
qc.draw()
Sir i have problem with installation process it just shows my name of pc in terminal anad when i try to create another environment for anaconda(like u) it just shows an error. Can you please help me to resolve my issue?
@DerekWangIBM
Ай бұрын
It sounds like `conda` is not active. See if it's installed by typing `conda --version` in your terminal. If conda is indeed there, try activating it: `conda init`. When conda is active, you should see (base) before your username. Once it's active, you should be able to create an environment within conda.
@HrvojeKalic
Ай бұрын
Happened to me also. You have to start your terminal in "MiniConda mode". Go to Start Menu and type 'Anac' and there should be something like "Anaconda Prompt (miniconda3)". Start that command/script/program. Someone smarter than me should know how to do this in the VS Code.
@DerekWangIBM
Ай бұрын
@@HrvojeKalic Thank you! I only showed installation on Mac in the video. Glad that differences with PC could be resolved here.
@Hirdayanshkanojiya
Ай бұрын
@@HrvojeKalic thank you sir i will try and see if the problem is solved or not
@Hirdayanshkanojiya
Ай бұрын
@@DerekWangIBM thanks sir
Hello sir I love this series so knowledgeable and amazing sir can I join ibm quantum as a student
@devanshjaiswal9502
Ай бұрын
You can visit the IBM quantum website, look for a careers page, and you might find something that interests you , you can apply there
Starting to see how I sound to my parents when explaining classical computing 😭
The only thing I've learned in this video is that quantum software is in its infancy.
Sir, When i am to do: from qiskit import IBMQ this is showing error "ImportError Traceback (most recent call last) Cell In[6], line 1 ----> 1 from qiskit import IBMQ ImportError: cannot import name 'IBMQ' from 'qiskit' (C:\Users\sachin.pathak\AppData\Local\anaconda3\Lib\site-packages\qiskit\__init__.py)" even I have upgraded my qiskit to new version. Please suggest.
@DerekWangIBM
Ай бұрын
The module IBMQ does not exist in Qiskit I believe. If you're trying to access providers and backends, you'll need to `pip install qiskit-ibm-runtime`.
@sachinpathak8935
Ай бұрын
@@DerekWangIBM thanks for your reply. I already have installed ibm run time in my system still it is not working.
In Step 3 for the n-qubit GHZ state, I'm getting this error: ValueError: cannot create object arrays from iterator The line causing the error is: job = estimator.run([(qc_transpiled, operators_transpiled_list)])
@DerekWangIBM
20 күн бұрын
The Estimator().run() functions expects `qc_transpiled` and `operators_transpiled_list` to be lists, not iterators. So make sure you've actually instantiated these variables as lists.
@jorgeas
20 күн бұрын
@@DerekWangIBM The thing is, I followed exactly every step. The cell where these variables are defined run well. The other one does not. Not really sure what am I missing here. def get_quantum_circuit(n): qc = QuantumCircuit(n) qc.h(0) for i in range(n-1): qc.cx(i, i+1) return qc n = 100 qc = get_quantum_circuit(n) # qc.draw(output='mpl') from qiskit.quantum_info import SparsePauliOp operator_strings = ['Z' + 'I' * i + 'Z' + 'I' * (n - i - 2) for i in range(n - 1)] print(operator_strings) print(len(operator_strings)) operators = [SparsePauliOp(operator_string) for operator_string in operator_strings] from qiskit_ibm_runtime import QiskitRuntimeService from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager backend_name = "ibm_brisbane" backend = QiskitRuntimeService().get_backend(backend_name) pass_manager = generate_preset_pass_manager(optimization_level=1, backend=backend) qc_transpiled = pass_manager.run(qc) operators_transpiled_list = [op.apply_layout(qc_transpiled.layout) for op in operators] from qiskit_ibm_runtime import EstimatorV2 as Estimator from qiskit_ibm_runtime import EstimatorOptions options = EstimatorOptions() options.resilience_level = 1 options.optimization_level = 0 options.dynamical_decoupling.enable = True options.dynamical_decoupling.sequence_type = "XY4" estimator = Estimator(backend, options=options) job = estimator.run([(qc_transpiled, operators_transpiled_list)]) job_id = job.job_id() print(job_id)
You all would benefit from watching my KZread videos where I trained ChatGPT on my Quantum Language Model.
What is pauli ?
@user-xm5vv4dy3b
Ай бұрын
Pauli is referred to matrices, specif a set of three 2 × 2 complex matrices that are Hermitian, involutory and unitary.
@SiddharthSharma360
Ай бұрын
Rather ask who is pauli
it would be excellent if the folks doing work in the quantum space would stop naming things after themselves and instead give them descriptive names.
bruh