Note
இந்த பக்கம் tutorials/circuits_advanced/05_pulse_gates.ipynb இருந்து உருவாக்கப்பட்டது.
பல்ஸ் கேட்கள்¶
சுற்று செயல்பாடுகளுடன் மட்டும் பெரும்பாலான குவாண்டம் வழிமுறைகளை விவரிக்க முடியும். எங்கள் திட்டத்தின் குறைந்த அளவிலான செயல்பாட்டில் எங்களுக்கு கூடுதல் கட்டுப்பாடு தேவைப்படும்போது, pulse gates பயன்படுத்தலாம். துடிப்பு வாயில்கள் அடிப்படை வாயில்களுடன் மட்டுமே சுற்றுகளை இயக்குவதற்கான தடையை நீக்குகின்றன, மேலும் எந்த அடிப்படை வாயிலின் இயல்புநிலை செயல்பாட்டை மேலெழுதவும் உங்களை அனுமதிக்கிறது.
பல்ஸ் கேட்கள் நீங்கள் ஒரு தருக்க சுற்று வாயில் வரைபடத்தை அனுமதிக்கிறது (எ.கா., X
) ஒரு Qiskit பல்ஸ் திட்டம், ஒரு Schedule
என்று. இந்த வரைபடமாக்கல் ஒரு classification என குறிப்பிடப்படுகிறது. உயர் நம்பிக்கை அளவுத்திருத்தம் என்பது அது வரையிணைக்கப்பட்ட தருக்க செயல்பாட்டை உண்மையாக செயல்படுத்தும் ஒன்றாகும் (எ.கா., X
கேட் அளவுத்திருத்தம் \(|0\rangle\) முதல் \(|1\rangle\), முதலியன) இயக்குகிறது.விவரணையாக்கம்.
ஒரு அட்டவணை சாதனத்திற்கு அனைத்து உள்ளீடு channels முழுவதும் உள்ளீடு சிக்னல்களின் சரியான நேர இயக்கவியல் குறிப்பிடுகிறது. பொதுவாக ஒரு க்யூபிட்டின் பல சேனல்கள் உள்ளன, அதாவது இயக்கி மற்றும் அளவிடு. இந்த இடைமுகம் மிகவும் சக்திவாய்ந்தது, மேலும் அடிப்படை சாதன இயற்பியல் ஒரு ஆழமான புரிதல் தேவைப்படுகிறது.
It’s important to note that Pulse programs operate on physical qubits. A drive pulse on qubit \(a\) will not enact the same logical operation on the state of qubit \(b\) – in other words, gate calibrations are not interchangeable across qubits. This is in contrast to the circuit level, where an X
gate is defined independent of its qubit operand.
உங்கள் சுற்றுக்கு ஒரு அளவொப்புமை எவ்வாறு சேர்ப்பது என்பதை இந்தப் பக்கம் காட்டுகிறது.
Note: Not all providers support pulse gates.
உங்கள் சர்கூட் கட்ட¶
Let’s start with a very simple example, a Bell state circuit.
[1]:
from qiskit import QuantumCircuit
circ = QuantumCircuit(2, 2)
circ.h(0)
circ.cx(0, 1)
circ.measure(0, 0)
circ.measure(1, 1)
circ.draw('mpl')
[1]:

உங்கள் அளவொப்புமைகளை உருவாக்கவும்¶
Now that we have our circuit, let’s define a calibration for the Hadamard gate on qubit 0.
நடைமுறை, பழுப்பு வடிவம் மற்றும் அதன் அளபுருக்கள் ரபி ஆய்வுகளின் ஒரு தொடர் மூலம் ஒப்பிடப்படும் (ஒத்திகைக்கு இதைப் பார்க்கவும் Qiskit Textbook). இந்தப் போராட்டத்துக்காக, நமது ஹாம்டர்ட் ஒரு காஸ்சியன் நுழைவு இருப்பது. க்யூபிட் 0 இன் drive சேனலில் எங்கள் பல்ஸ்சை play செய்வோம்.
Don’t worry too much about the details of building the calibration itself; you can learn all about this on the following page: building pulse schedules.
[2]:
from qiskit import pulse
from qiskit.pulse.library import Gaussian
from qiskit.providers.fake_provider import FakeValencia
backend = FakeValencia()
with pulse.build(backend, name='hadamard') as h_q0:
pulse.play(Gaussian(duration=128, amp=0.1, sigma=16), pulse.drive_channel(0))
Let’s draw the new schedule to see what we’ve built.
[3]:
h_q0.draw()
[3]:

உங்கள் அளவொப்புமை உங்கள் சர்கூட் இணைக்க¶
மீதமுள்ள அனைத்து பதிவு முடிக்க உள்ளது. சர்கூட் முறை add_calibration
கேட் பற்றிய தகவல் மற்றும் வரைபடமாக்கலை முடிக்க அட்டவணைபற்றிய குறிப்பு தேவைப்படுகிறது:
QuantumCircuit.add_calibration(gate, qubits, schedule, parameters)
The gate
can either be a circuit.Gate
object or the name of the gate. Usually, you’ll need a different schedule for each unique set of qubits
and parameters
. Since the Hadamard gate doesn’t have any parameters, we don’t have to supply any.
[4]:
circ.add_calibration('h', [0], h_q0)
இறுதியாக, டிரான்ஸ்பைலர் உங்கள் அளவொப்புமைகளை மதிக்கும் என்பதை நினைவில் கொள்ளவும். நீங்கள் வழக்கமாக அதை பயன்படுத்த (எங்கள் உதாரணம் டிரான்ஸ்பைலர் உகந்ததாக மிகவும் எளிது, எனவே வெளியீடு அதே தான்).
[5]:
from qiskit import transpile
from qiskit.providers.fake_provider import FakeHanoi
backend = FakeHanoi()
circ = transpile(circ, backend)
print(backend.configuration().basis_gates)
circ.draw('mpl', idle_wires=False)
['id', 'rz', 'sx', 'x', 'cx', 'reset']
[5]:

h
என்பது போலி பின்தளமான ``FakeHanoi``க்கான அடிப்படை நுழைவாயில் அல்ல என்பதைக் கவனியுங்கள். அதற்கான அளவுத்திருத்தத்தை நாங்கள் சேர்த்திருப்பதால், டிரான்ஸ்பைலர் நமது வாயிலை அடிப்படை வாயிலாகக் கருதும்; ஆனால் அது வரையறுக்கப்பட்ட குவிட்களில் மட்டுமே. வேறொரு குவிட்டில் பயன்படுத்தப்படும் ஒரு ஹடமார்ட் அடிப்படை வாயில்களுக்கு விரிக்கப்படும்.
That’s it!
கஸ்டம் கேட்¶
We’ll briefly show the same process for nonstandard, completely custom gates. This demonstration includes a gate with parameters.
[6]:
from qiskit import QuantumCircuit
from qiskit.circuit import Gate
circ = QuantumCircuit(1, 1)
custom_gate = Gate('my_custom_gate', 1, [3.14, 1])
# 3.14 is an arbitrary parameter for demonstration
circ.append(custom_gate, [0])
circ.measure(0, 0)
circ.draw('mpl')
[6]:

[7]:
with pulse.build(backend, name='custom') as my_schedule:
pulse.play(Gaussian(duration=64, amp=0.2, sigma=8), pulse.drive_channel(0))
circ.add_calibration('my_custom_gate', [0], my_schedule, [3.14, 1])
# Alternatively: circ.add_calibration(custom_gate, [0], my_schedule)
அளவுத்திருத்தம் சேர்க்க Gate
நேர்வு மாறியை custom_gate
பயன்படுத்தினால், அளபுருக்கள் அந்த நேர்விலிருந்து தருவிக்கப்பட்டன. அளவுருக்களின் வரிசை அர்த்தமுள்ளதாக இருப்பதை நினைவில் கொள்ளுங்கள்.
[8]:
circ = transpile(circ, backend)
circ.draw('mpl', idle_wires=False)
[8]:

Normally, if we tried to transpile our circ
, we would get an error. There was no functional definition provided for "my_custom_gate"
, so the transpiler can’t unroll it to the basis gate set of the target device. We can show this by trying to add "my_custom_gate"
to another qubit which hasn’t been calibrated.
[9]:
circ = QuantumCircuit(2, 2)
circ.append(custom_gate, [1])
from qiskit import QiskitError
try:
circ = transpile(circ, backend)
except QiskitError as e:
print(e)
"Cannot unroll the circuit to the given basis, ['id', 'rz', 'sx', 'x', 'cx', 'reset']. Instruction my_custom_gate not found in equivalence library and no rule found to expand."
[10]:
import qiskit.tools.jupyter
%qiskit_version_table
%qiskit_copyright
Version Information
Qiskit Software | Version |
---|---|
qiskit-terra | 0.21.2 |
qiskit-aer | 0.10.4 |
qiskit-ibmq-provider | 0.19.2 |
qiskit | 0.37.2 |
System information | |
Python version | 3.10.7 |
Python compiler | GCC 12.2.0 |
Python build | main, Sep 6 2022 21:22:27 |
OS | Linux |
CPUs | 32 |
Memory (Gb) | 125.64828109741211 |
Mon Sep 12 15:28:25 2022 EDT |
This code is a part of Qiskit
© Copyright IBM 2017, 2022.
This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
Any modifications or derivative works of this code must retain this
copyright notice, and modified files need to carry a notice indicating
that they have been altered from the originals.