Avoid statevector copy in `qsim.simulate(qc, initial_state=sv)`

オープン
#617 コメント 12 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
34/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp, python
領域
api, performance

調査の方向性

The copy happens in init_state() in pybind_interface/pybind_main.cpp, near the line the issue links (around line 695-701), when simulate is given an initial_state. Read how that state is passed into the simulator and whether the simulator can reference the caller's buffer without taking ownership. Done means the initial state is no longer copied on this path, and the existing Python tests for initial_state still pass. The thread has been unanswered for about three years, so confirm the approach with maintainers first.

索引モデルが issue の本文から書いたものです。

説明

a: c++ a: performance a: python contributors welcome no QC knowledge needed

I have a use case where I am simulating my circuit piece by piece so using the ability to pass an initial state to qsim is very handy.
However I have noticed this makes a copy of the initial_state here:

Is there a way to avoid the expensive copy?
If there is a little patch that can be applied (I assume couple of lines in void init_state() should do it) I would be happy to apply it locally and re-build qsim.

Thanks!

主要言語
C++
スター
702
フォーク
219
平均マージ
1日 2時間
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quantumlib/qsim のほかの issue

quantumlib/qsim の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。