geometric#

幾何的に分布したランダム値を生成します。

説明#

geometric クラス・オブジェクトは、generate 関数で使用され、1 回の試行が成功する確率が p である幾何学的に分布した乱数を提供します。ここで \(p \in R, 0 < p < 1\) です。

幾何分布の変量は、最初の成功に至る独立したベルヌーイ試行の数を表します。1 回のベルヌーイ試行が成功する確率は p です。

確率分布は次のように表されます。

\(P(X = k) = p(1 - p)^{k}, k\in \left \{ 0, 1, 2, ... \right \}\)

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

\[\begin{split}F_p(x) = \begin{cases} 0, & x < 0 \\ 1 - (1-p)^{\lfloor x + 1 \rfloor}, & x \geq 0 \end{cases}, x \in R\end{split}\]

製品および性能に関する情報

性能は、使用状況、構成、およびその他の要因によって異なります。詳細は、https://www.intel.com/PerformanceIndex (英語) を参照してください。改訂 #20201201

API#

構文#

namespace oneapi::mkl::rng { 
  template<typename IntType = std::int32_t, 
           typename Method = geometric_method::by_default> 
  class geometric { 
  public: 
    using method_type = Method; 
    using result_type = IntType; 

    geometric(): geometric(0.5){} 
    explicit geometric(float p); 
    explicit geometric(const param_type& pt); 

    float p() const; 
    param_type param() const; 
    void param(const param_type& pt); 
  }; 
}

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

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

  • oneapi/mkl/rng.hpp

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

名前

説明

typename IntType = std::int32_t

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

std::int32_t

std::uint32_t

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

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

oneapi::mkl::rng::geometric_method::icdf

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

入力パラメーター#

名前

タイプ

説明

p

float

試行の成功確率 p