thrust/random/normal_distribution.h
File members: thrust/random/normal_distribution.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/pair.h>
#include <thrust/random/detail/normal_distribution_base.h>
#include <thrust/random/detail/random_core_access.h>
#include <iostream>
THRUST_NAMESPACE_BEGIN
namespace random
{
template <typename RealType = double>
class normal_distribution : public detail::normal_distribution_base<RealType>::type
{
private:
using super_t = typename detail::normal_distribution_base<RealType>::type;
public:
// types
using result_type = RealType;
using param_type = thrust::pair<RealType, RealType>;
// constructors and reset functions
_CCCL_HOST_DEVICE explicit normal_distribution(RealType mean = 0.0, RealType stddev = 1.0);
_CCCL_HOST_DEVICE explicit normal_distribution(const param_type& parm);
_CCCL_HOST_DEVICE void reset();
// generating functions
template <typename UniformRandomNumberGenerator>
_CCCL_HOST_DEVICE result_type operator()(UniformRandomNumberGenerator& urng);
template <typename UniformRandomNumberGenerator>
_CCCL_HOST_DEVICE result_type operator()(UniformRandomNumberGenerator& urng, const param_type& parm);
// property functions
_CCCL_HOST_DEVICE result_type mean() const;
_CCCL_HOST_DEVICE result_type stddev() const;
_CCCL_HOST_DEVICE param_type param() const;
_CCCL_HOST_DEVICE void param(const param_type& parm);
_CCCL_HOST_DEVICE result_type min THRUST_PREVENT_MACRO_SUBSTITUTION() const;
_CCCL_HOST_DEVICE result_type max THRUST_PREVENT_MACRO_SUBSTITUTION() const;
private:
param_type m_param;
friend struct thrust::random::detail::random_core_access;
_CCCL_HOST_DEVICE bool equal(const normal_distribution& 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 normal_distribution
template <typename RealType>
_CCCL_HOST_DEVICE bool operator==(const normal_distribution<RealType>& lhs, const normal_distribution<RealType>& rhs);
template <typename RealType>
_CCCL_HOST_DEVICE bool operator!=(const normal_distribution<RealType>& lhs, const normal_distribution<RealType>& rhs);
template <typename RealType, typename CharT, typename Traits>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const normal_distribution<RealType>& d);
template <typename RealType, typename CharT, typename Traits>
std::basic_istream<CharT, Traits>& operator>>(std::basic_istream<CharT, Traits>& is, normal_distribution<RealType>& d);
} // namespace random
using random::normal_distribution;
THRUST_NAMESPACE_END
#include <thrust/random/detail/normal_distribution.inl>