Number of Givens rotations does not decrease monotonically with increased tolerance

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
backend

調査の方向性

まず、提供されたスクリプトを再現し、レポートで示されているエントリポイントである ffsim.linalg.givens_decomposition の実装を調べます。tol が保持される回転にどのように影響するかを追跡し、その後、報告されたケースで許容値の増加に伴って回転数が増加しないことを確認できるよう、カバレッジを追加または更新します。

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

説明

Courtesy of @jrm874

import numpy as np
import scipy.linalg

import ffsim


def siam_diag_bath_h1e(n_bath: int) -> np.ndarray:
    hopping = -np.diag(np.ones(n_bath - 1), 1) - np.diag(np.ones(n_bath - 1), -1)
    _, eigvecs = np.linalg.eigh(hopping)
    norb = n_bath + 1
    rot = np.eye(norb)
    rot[1:, 1:] = eigvecs
    h1e = np.zeros((norb, norb))
    h1e[0, 1] = h1e[1, 0] = -1.0  # impurity-bath coupling
    for i in range(1, norb - 1):  # bath chain hopping
        h1e[i, i + 1] = h1e[i + 1, i] = -1.0
    return rot.T @ h1e @ rot


h1e = siam_diag_bath_h1e(n_bath=13)
mat = scipy.linalg.expm(-1j * 0.1 * h1e)

tols = [1e-12, 1e-10, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1]

prev = None
monotonic = True
for tol in tols:
    givens_rotations, _ = ffsim.linalg.givens_decomposition(mat, tol=tol)
    count = len(givens_rotations)
    flag = ""
    if prev is not None and count > prev:
        flag = "  <-- INCREASED (non-monotonic!)"
        monotonic = False
    print(f"tol={tol:<8g} num Givens rotations: {count}{flag}")
    prev = count

print(f"\nMonotonic (non-increasing)? {monotonic}")
tol=1e-12    num Givens rotations: 63
tol=1e-10    num Givens rotations: 73  <-- INCREASED (non-monotonic!)
tol=1e-08    num Givens rotations: 46
tol=1e-07    num Givens rotations: 46
tol=1e-06    num Givens rotations: 55  <-- INCREASED (non-monotonic!)
tol=1e-05    num Givens rotations: 38
tol=0.0001   num Givens rotations: 42  <-- INCREASED (non-monotonic!)
tol=0.001    num Givens rotations: 25
tol=0.01     num Givens rotations: 23
tol=0.1      num Givens rotations: 0

Monotonic (non-increasing)? False
主要言語
Python
スター
116
フォーク
50
平均マージ
2時間 1分
マージ済み PR(30日)
8

環境構築

はじめの一歩

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

Qiskit/ffsim のほかの issue

Qiskit/ffsim の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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