最終更新日時:
が更新

履歴 編集

function template
<simd>

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

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

概要

浮動小数点要素型のbasic_vec(またはスカラーの浮動小数点数)について、各要素に<cmath>sph_besselを適用し、各要素について、次数nの第一種球ベッセル関数のxでの値を求める。

制約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()未満)について、n[i]x[i]<cmath>sph_besselを適用した結果で要素ごとに初期化されたbasic_vecオブジェクトを返す。

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

備考

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

#include <simd>
#include <print>

namespace simd = std::simd;

int main()
{
  simd::vec<unsigned, 2> n = 0u;                          // 次数0
  simd::vec<double, 2> x([](int i) { return i + 1.0; });  // {1, 2}

  // 各要素について次数0の第一種球ベッセル関数の値を求める
  simd::vec<double, 2> r = simd::sph_bessel(n, x);

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

出力例

0.8414709848078965 0.45464871341284085 

バージョン

言語

  • C++26

処理系

関連項目

参照