最終更新日時(UTC):
が更新

履歴 編集

function template
<linalg>

std::linalg::setup_givens_rotation(C++26)

namespace std::linalg {
  template<class Real>
  setup_givens_rotation_result<Real> setup_givens_rotation(Real a, Real b) noexcept; // (1)

  template<class Real>
  setup_givens_rotation_result<complex<Real>> setup_givens_rotation(complex<Real> a, complex<Real> b) noexcept; // (2)
}

概要

ギブンス回転を計算する。すなわち、以下の式が成り立つような、Real型の値cs, rを計算する。

$$ \begin{split} \begin{pmatrix} c & s \\ -\overline{s} & c \end{pmatrix} \begin{pmatrix} a \\ b \end{pmatrix} &= \begin{pmatrix} r \\ 0 \end{pmatrix},\\ c^2 + |s|^2 &= 1 \end{split} $$

ただし、srの型はabの型による。

  • (1) abの型がRealの場合、srの型もRealrは$(a, b)^T$のユークリッドノルム、つまり$\sqrt{|a|^2 + |b|^2}$である。
  • (2) abの型がcomplex<Real>の場合、srの型もcomplex<Real>。以下で定義される$sgn$関数を用いると、rは$sgn(a) * \sqrt{|a|^2 + |b|^2}$である。 $$ sgn(x):= \begin{cases} \frac{x}{|x|} & \text{($x \neq 0$)} \\ 1 & \text{($x = 0$)} \end{cases} $$

テンプレートパラメータ制約

  • Realcomplex<Real>が規定できる型であること。

戻り値

csが入力$(a, b)^T$に対するギブンス回転行列の成分で、rを入力$(a, b)^T$のユークリッドノルムとすると、戻り値は{c, s, r}である。

出力

バージョン

言語

  • C++26

処理系

関連項目

参照