1#ifndef RANDOM_TENSOR_DEFINED
2#define RANDOM_TENSOR_DEFINED
11template <
typename Distribution,
typename RandomEngine>
13 Distribution &distribution,
14 RandomEngine &randomEngine) {
19 value = distribution(randomEngine);
23template <
typename Distribution,
typename RandomEngine>
25 Distribution &distribution,
26 RandomEngine &randomEngine) {
33 value.real(distribution(randomEngine));
34 value.imag(distribution(randomEngine));
46template <
typename F,
typename Distribution,
typename RandomEngine>
48 Distribution &distribution,
49 RandomEngine &randomEngine) {
50 int64_t indicesCount, *indices;
52 t.read_local(&indicesCount, &indices, &values);
53 for (int64_t i(0); i < indicesCount; ++i) {
54 setRandom(values[i], distribution, randomEngine);
56 t.write(indicesCount, indices, values);
Definition RandomTensor.hpp:38
DefaultRandomEngine()
Definition RandomTensor.hpp:40
static CTF::World * world
Definition Sisi4s.hpp:17
Definition Algorithm.hpp:10
CTF::Tensor< F > Tensor
Definition Tensor.hpp:9
void setRandom(double &value, Distribution &distribution, RandomEngine &randomEngine)
Definition RandomTensor.hpp:12
Complex< real > complex
Definition Complex.hpp:17
void setRandomTensor(Tensor< F > &t, Distribution &distribution, RandomEngine &randomEngine)
Definition RandomTensor.hpp:47