最終更新日時:
が更新

履歴 編集

function template
<simd>

std::simd::sph_legendre(C++26)

namespace std::simd {
  template<math-floating-point V>
  deduced-vec-t<V>
    sph_legendre(const rebind_t<unsigned, deduced-vec-t<V>>& l,
                 const rebind_t<unsigned, deduced-vec-t<V>>& m,
                 const V& theta); // C++26
}

概要

浮動小数点要素型のbasic_vec(またはスカラーの浮動小数点数)について、各要素に<cmath>sph_legendreを適用し、各要素について、次数l・位数mの球面調和関数に対応するルジャンドル陪関数のthetaでの値を求める。

制約math-floating-pointは、Vが浮動小数点要素型のbasic_vec、またはスカラーの浮動小数点型であることを表す説明専用のコンセプトである。deduced-vec-t<V>は、Vに対応するデータ並列型(Vがスカラーの場合は既定のABIをもつbasic_vec)である。

rebind_t<unsigned, deduced-vec-t<V>>は、deduced-vec-t<V>と同じ要素数をもつunsigned要素型のbasic_vecである。

戻り値

各要素i0以上deduced-vec-t<V>::size()未満)について、l[i]m[i]theta[i]<cmath>sph_legendreを適用した結果で要素ごとに初期化されたbasic_vecオブジェクトを返す。

ある要素iについて定義域エラー・極エラー・値域エラーが発生する場合、その要素の値は未規定である。

備考

errnoにアクセスするか否かは未規定である。

#include <simd>
#include <print>

namespace simd = std::simd;

int main()
{
  simd::vec<unsigned, 2> l = 0u; // 次数0
  simd::vec<unsigned, 2> m = 0u; // 位数0
  simd::vec<double, 2> theta([](int i) { return i * 0.5 + 0.5; }); // {0.5, 1}

  // 各要素について次数0・位数0の球面調和関数のルジャンドル陪関数の値を求める
  simd::vec<double, 2> r = simd::sph_legendre(l, m, theta);

  for (std::size_t i = 0; i < r.size(); ++i) {
    std::print("{} ", r[i]);
  }
  std::println("");
}

出力例

0.28209479177387814 0.28209479177387814 

バージョン

言語

  • C++26

処理系

関連項目

参照