diff --git a/include/boost/math/algebraic_traits.hpp b/include/boost/math/algebraic_traits.hpp new file mode 100644 index 000000000..9b3578317 --- /dev/null +++ b/include/boost/math/algebraic_traits.hpp @@ -0,0 +1,180 @@ +// (C) Copyright Jeremy William Murphy 2016. + +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_MATH_ALGEBRAIC_TRAITS +#define BOOST_MATH_ALGEBRAIC_TRAITS + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* PURPOSE + * + * A facility to provide convenient access to algebraic traits of types. + * + * For example: + * + * algebraic_traits::zero_element() -> 0 + * algebraic_traits::identity_element() -> 1 + * algebraic_traits::identity_element() -> "" + * + * algebraic_traits::is_associative() -> true + * algebraic_traits::is_associative() -> false + * algebraic_traits::is_associative() -> true + * algebraic_traits::is_commutative() -> true + * algebraic_traits::is_commutative() -> false + * + * Or alternatively: + * + * std::multiplies op1; + * std::multiplies op2; + * std::plus op3; + * algebraic_traits::zero_element(op1) -> 0 + * algebraic_traits::zero_element(op2) -> 0.0 + * algebraic_traits::identity_element(op3) -> "" + * + * + * Properties to consider: + * + * Medial + * Distributive + * Commutative + * Idempotent + * Associative + * Unital + * Cancellative + */ + +namespace boost { +namespace math { +namespace detail { + +struct algebraic_traits_base +{ + BOOST_STATIC_CONSTANT(bool, is_specialized = false); +}; + +} // detail + + +template