thrust/random/discard_block_engine.h
File members: thrust/random/discard_block_engine.h
/*
* Copyright 2008-2013 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <thrust/detail/config.h>
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
# pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
# pragma system_header
#endif // no system header
#include <thrust/random/detail/random_core_access.h>
#include <cstdint>
#include <iostream>
THRUST_NAMESPACE_BEGIN
namespace random
{
template <typename Engine, size_t p, size_t r>
class discard_block_engine
{
public:
// types
using base_type = Engine;
using result_type = typename base_type::result_type;
// engine characteristics
static const size_t block_size = p;
static const size_t used_block = r;
static const result_type min = base_type::min;
static const result_type max = base_type::max;
// constructors and seeding functions
_CCCL_HOST_DEVICE discard_block_engine();
_CCCL_HOST_DEVICE explicit discard_block_engine(const base_type& urng);
_CCCL_HOST_DEVICE explicit discard_block_engine(result_type s);
_CCCL_HOST_DEVICE void seed();
_CCCL_HOST_DEVICE void seed(result_type s);
// generating functions
_CCCL_HOST_DEVICE result_type operator()(void);
_CCCL_HOST_DEVICE void discard(unsigned long long z);
// property functions
_CCCL_HOST_DEVICE const base_type& base() const;
private:
base_type m_e;
unsigned int m_n;
friend struct thrust::random::detail::random_core_access;
_CCCL_HOST_DEVICE bool equal(const discard_block_engine& rhs) const;
template <typename CharT, typename Traits>
std::basic_ostream<CharT, Traits>& stream_out(std::basic_ostream<CharT, Traits>& os) const;
template <typename CharT, typename Traits>
std::basic_istream<CharT, Traits>& stream_in(std::basic_istream<CharT, Traits>& is);
}; // end discard_block_engine
template <typename Engine, size_t p, size_t r>
_CCCL_HOST_DEVICE bool
operator==(const discard_block_engine<Engine, p, r>& lhs, const discard_block_engine<Engine, p, r>& rhs);
template <typename Engine, size_t p, size_t r>
_CCCL_HOST_DEVICE bool
operator!=(const discard_block_engine<Engine, p, r>& lhs, const discard_block_engine<Engine, p, r>& rhs);
template <typename Engine, size_t p, size_t r, typename CharT, typename Traits>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const discard_block_engine<Engine, p, r>& e);
template <typename Engine, size_t p, size_t r, typename CharT, typename Traits>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, discard_block_engine<Engine, p, r>& e);
} // namespace random
// import names into thrust::
using random::discard_block_engine;
THRUST_NAMESPACE_END
#include <thrust/random/detail/discard_block_engine.inl>