Sampler によるノイズ管理の設定
Package versions
このページのコードは、以下の要件を使用して開発されました。 これらのバージョン以上を使用することを推奨します。
qiskit-ibm-runtime~=0.47.0
ノイズを管理する方法はいくつかあり、通常はさまざまなエラー緩和およびエラー抑制技術を使用して、エラーが発生する前に回避します。これらの技術は通常、前処理のオーバーヘッドを引き起こします。そのため、結果を完璧なものにすることと、ジョブが妥当な時間内に完了するようにすることの間でバランスを取ることが重要です。
Sampler は以下のノイズ管理技術をサポートしています。各技術の説明については、エラー緩和と抑制の技術を参照してください。
備考
すべてのオプションがすべての種類の回路で連携して機能するわけではありません。詳細については、機能互換性テーブルガイドを参照してください。
例
# Added by doQumentation — installs the packages this notebook needs if they are missing
import importlib.util
_needed = {"qiskit_ibm_runtime": "qiskit-ibm-runtime"}
_missing = [pip for module, pip in _needed.items()
if importlib.util.find_spec(module) is None]
# One at a time, so a package that fails to install does not block the others
for _pip in _missing:
%pip install -q {_pip}
if not _missing:
print("\u2713 All required packages are installed")
from qiskit_ibm_runtime import QiskitRuntimeService
# Legacy server-side primitive before qiskit-ibm-runtime 0.50.0
# from qiskit_ibm_runtime import Sampler
# Client-side primitive introduced in qiskit-ibm-runtime 0.50.0
from qiskit_ibm_runtime.executor_sampler import Sampler
service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)
sampler = Sampler(backend)
# Turn on dynamical decoupling with sequence XpXm.
sampler.options.dynamical_decoupling.enable = True
sampler.options.dynamical_decoupling.sequence_type = "XpXm"
# Turn on gate twirling. Requires qiskit_ibm_runtime 0.23.0 or later.
sampler.options.twirling.enable_gates = True
print(
f">>> dynamical decoupling sequence to use: "
f"{sampler.options.dynamical_decoupling.sequence_type}"
)
print(
f">>> gate twirling is turned on: {sampler.options.twirling.enable_gates}"
)
>>> dynamical decoupling sequence to use: XpXm
>>> gate twirling is turned on: True
次のステップ
おすすめ
- エラー緩和とエラー抑制の技術について詳しく学びましょう。
- Sampler のオプションを探索しましょう。
- ジョブを実行する実行モードを決定しましょう。