Provide support for the Boost Multiprecision Library

Issue #176 resolved
Klaus Iglberger created an issue

Description

The Blaze library already provides support for custom data types. However, in the general case it might be necessary to adapt Blaze via the manual specialization of type traits. In case of the Boost Multiprecision Library (MPL) it would be convenient if these specializations would be directly provided by Blaze itself.

Tasks

  • implement all necessary type trait specializations for MPL data types to support all possible operations
  • perform tests of all possible operations with MPL data types
  • add new and extend existing test cases as necessary
  • extend the tutorial and wiki about custom data types

Comments (5)

  1. Zhen Zhong

    Here is a temporary solution to use boost multiprecision lib.

    using realx = number<mpfr_float_backend<100>, et_off>;
    
    namespace blaze {
    template <>
    struct AddTrait<realx, realx> {
        using Type = realx;
    };
    
    template <>
    struct SubTrait<realx, realx> {
        using Type = realx;
    };
    
    template <>
    struct MultTrait<realx, realx> {
        using Type = realx;
    };
    
    template <>
    struct DivTrait<realx, realx> {
        using Type = realx;
    };
    
    template <>
    struct IsComplex<realx>
        : public BoolConstant<false> {
    };
    
    template <>
    struct IsComplex<const realx>
        : public BoolConstant<false> {
    };
    
    template <>
    struct IsNumeric<realx>
        : public TrueType {
    };
    
    template <>
    struct IsNumeric<const realx>
        : public TrueType {
    };
    
    template <>
    struct UnderlyingNumeric<realx> {
        using Type = realx;
    };
    
    template <>
    struct UnderlyingElement<realx> {
        using Type = realx;
    };
    
    template <>
    struct UnderlyingBuiltin<realx> {
        using Type = realx;
    };
    
    template<>
    struct UnderlyingBuiltinHelper1<realx, void>
    {
       using Type = realx;
    };
    
    template<>
    struct UnderlyingBuiltinHelper2<realx, void>
    {
       using Type = realx;
    };
    
    template<>
    struct UnderlyingNumericHelper1<realx, void>
    {
       using Type = realx;
    };
    
    template <>
    struct IsCustom<realx>
        : public TrueType {
    };
    
    } // namespace blaze
    
  2. Klaus Iglberger reporter

    Native support for the Boost.Multiprecision library has been implemented and tested as required. It is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.7.

  3. Log in to comment