Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Von Mises Distribution
  • Loading branch information
mborland committed Aug 15, 2022
commit 18a871853a513ac236912b7c6d92d0c1fb4d981c
22 changes: 22 additions & 0 deletions include/boost/math/distributions/detail/common_error_handling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include <boost/math/policies/error_handling.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/constants/constants.hpp>

// using boost::math::isfinite;
// using boost::math::isnan;

Expand Down Expand Up @@ -96,6 +98,26 @@ inline bool check_location(
return true;
}


template <class RealType, class Policy>
inline bool check_angle(
const char* function,
RealType angle,
RealType* result,
const Policy& pol)
{
if(!(boost::math::isfinite)(angle)
|| angle < -boost::math::constants::pi<RealType>()
|| angle > +boost::math::constants::pi<RealType>())
{
*result = policies::raise_domain_error<RealType>(
function,
"Angle parameter is %1%, but must be between -pi and +pi!", angle, pol);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the CDF is periodic, is it sensible to restrict the angle like this?

return false;
}
return true;
}

template <class RealType, class Policy>
inline bool check_x(
const char* function,
Expand Down
6 changes: 5 additions & 1 deletion include/boost/math/distributions/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ class uniform_distribution;
template <class RealType, class Policy>
class weibull_distribution;

template <class RealType, class Policy>
class von_mises_distribution;

}} // namespaces

#define BOOST_MATH_DECLARE_DISTRIBUTIONS(Type, Policy)\
Expand Down Expand Up @@ -152,6 +155,7 @@ class weibull_distribution;
typedef boost::math::students_t_distribution<Type, Policy> students_t;\
typedef boost::math::triangular_distribution<Type, Policy> triangular;\
typedef boost::math::uniform_distribution<Type, Policy> uniform;\
typedef boost::math::weibull_distribution<Type, Policy> weibull;
typedef boost::math::weibull_distribution<Type, Policy> weibull; \
typedef boost::math::von_mises_distribution<Type, Policy> von_mises;

#endif // BOOST_MATH_DISTRIBUTIONS_FWD_HPP
Loading