OpenQMC API
Loading...
Searching...
No Matches
permute.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright Contributors to the OpenQMC Project.
3
11
12#pragma once
13
14#include "gpu.h"
15#include "reverse.h"
16
17#include <cstdint>
18
19namespace oqmc
20{
21
33OQMC_HOST_DEVICE constexpr std::uint32_t
34laineKarrasPermutation(std::uint32_t value, std::uint32_t seed)
35{
36 value ^= value * 0x3d20adea;
37 value += seed;
38 value *= (seed >> 16) | 1;
39 value ^= value * 0x05526c56;
40 value ^= value * 0x53a22864;
41
42 return value;
43}
44
54OQMC_HOST_DEVICE constexpr std::uint32_t reverseAndShuffle(std::uint32_t value,
55 std::uint32_t seed)
56{
59
60 return value;
61}
62
73OQMC_HOST_DEVICE constexpr std::uint32_t shuffle(std::uint32_t value,
74 std::uint32_t seed)
75{
78
79 return value;
80}
81
82} // namespace oqmc
#define OQMC_HOST_DEVICE
Definition gpu.h:13
constexpr std::uint32_t reverseAndShuffle(std::uint32_t value, std::uint32_t seed)
Reverse input bits and shuffle order.
Definition permute.h:54
EncodeKey decodeBits16(std::uint16_t value)
Decode a value back into a key.
Definition encode.h:81
constexpr std::uint32_t shuffle(std::uint32_t value, std::uint32_t seed)
Compute a hash based owen scramble.
Definition permute.h:73
constexpr std::uint32_t laineKarrasPermutation(std::uint32_t value, std::uint32_t seed)
Laine and Karras style permutation.
Definition permute.h:34
constexpr std::uint32_t reverseBits32(std::uint32_t value)
Reverse bits of an unsigned 32 bit integer.
Definition reverse.h:25
Definition bntables.h:21