生成#

説明#

特定の分布の適切な統計を使用して、特定のエンジンから乱数を取得するエントリーポイント。

API#

構文#

バッファー API

namespace oneapi::mkl::rng { 
  template<typename Distr, typename Engine> 
  void generate (const Distr& distr, 
                 Engine& engine, std::int64_t n, 
                 sycl::buffer<typename Distr::result_type, 1>& r) 
}

USM API

namespace oneapi::mkl::rng { 
  template<typename Distr, typename Engine> 
  sycl::event generate (const Distr& distr, 
                        Engine& engine, std::int64_t n, 
                        typename Distr::result_type* r, 
                        const std::vector<sycl::event> & dependencies) 
}

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

  • oneapi/mkl/rng.hpp

入力パラメーター#

名前

タイプ

説明

distr

const Distr&

分散オブジェクト。詳細については、分布を参照してください。

engine

Engine&

エンジン・オブジェクト。詳細は、エンジンを参照してください。

n

std::int64_t

生成されるランダム値の数。

USM API のオプション入力パラメーター

名前

タイプ

説明

dependencies

const std::vector <sycl::event> &

計算を開始する前に待機するイベントのリスト (存在する場合)。

出力パラメーター#

バッファー API

名前

タイプ

説明

r

sycl::buffer<typename Distr::result_type, 1>

sycl::buffer r を出力ベクトルに渡します。

USM API

名前

タイプ

説明

r

typename Distr::result_type

出力ベクトルへのポインター r

event

sycl::event

関数は、エンジンから sycl::queue にタスクを送信した後にイベントを返します。

generate は、エンジンが保持するキューにカーネルを送信し、sycl::buffer<typename sDistr::result_type> ベクトルを n 個の乱数で埋めます。