chi_square#

カイ二乗分布のランダム値を生成します。

説明#

chi_square クラス・オブジェクトは、generate 関数で使用され、カイ二乗分布と自由度 ν\(n \in N; n > 0\) を持つ乱数を提供します。

確率密度関数は次のように表されます。

\[\begin{split}F_{v}(x) = \begin{cases} \frac {x^{\frac {n-2}{2}} e^{-\frac{x}{2}}} {2^{n/2} \Gamma (\frac {n}{2})} dy, & x \geq 0 \\ 0, & x < 0 \end{cases}\end{split}\]

累積分布関数のようになります。

\[\begin{split}F_{v}(x) = \begin{cases} \int _{0}^{x} \frac {y^{\frac {n-2}{2}} e^{-\frac{n}{2}}} {2^{n/2} \Gamma (\frac {n}{2})} dy, & x \geq 0 \\ 0, & x < 0 \end{cases}\end{split}\]

API#

構文#

namespace oneapi::mkl::rng { 
  template<typename RealType = float, 
           typename Method = chi_square_method::by_default> 
  class chi_square { 
  public: 
    using method_type = Method; 
    using result_type = RealType; 

    chi_square(): chi_square(5){} 
    explicit chi_square(std::int32_t n); 
    explicit chi_square(const param_type& pt); 

    std::int32_t n() const; 
    param_type param() const; 
    void param(const param_type& pt); 
  }; 
}

サポートされるデバイス: CPU と GPU。

インクルード・ファイル#

  • oneapi/mkl/rng.hpp

テンプレート・パラメーター#

typename RealType = float

生成された値のタイプ。固有の値は次のとおりです:

float

double

typename Method = oneapi::mkl::rng::chi_square_method::by_default

生成メソッド。固有の値は次のとおりです:

oneapi::mkl::rng::chi_square_method::gamma_based

配布テンプレート・パラメーター・メソッドのメソッドの説明を参照してください。

入力パラメーター#

名前

タイプ

説明

n

std::int32_t

自由度。