-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-establishing horner with ranges as required by some external projects
- Loading branch information
Showing
11 changed files
with
296 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/detail/overload.hpp> | ||
|
||
namespace eve | ||
{ | ||
|
||
//================================================================================================ | ||
//================================================================================================ | ||
// Function decorators mark-up used in function overloads | ||
struct compensated_ | ||
{ | ||
template<typename D> static constexpr auto combine(D const&) noexcept = delete; | ||
}; | ||
|
||
using compensated_type = decorated<compensated_()>; | ||
//================================================================================================ | ||
//! @addtogroup core_decorators | ||
//! @{ | ||
//! @var compensated | ||
//! | ||
//! @brief Higher-order @callable imbuing more accuracy onto other @callable{s}. | ||
//! | ||
//! #### Synopsis | ||
//! | ||
//! if compensated(eve::fname) is to be called then | ||
//! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} | ||
//! #include <eve/module/core.hpp> | ||
//! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
//! must be included. | ||
//! | ||
//! #### Members Functions | ||
//! | ||
//! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} | ||
//! auto operator()(eve::callable auto const& f ) const noexcept; | ||
//! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
//! @param f | ||
//! An instance of eve::callable | ||
//! | ||
//! @return | ||
//! A @callable performing the same kind of operation but ensuring a higher accuracy. | ||
//! | ||
//! @} | ||
//================================================================================================ | ||
inline constexpr compensated_type const compensated = {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Project Contributors | ||
SPDX-License-Identifier: BSL-1.0 | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/detail/abi.hpp> | ||
#include <eve/detail/overload.hpp> | ||
#include <eve/module/core/constant/one.hpp> | ||
#include <eve/module/core/constant/zero.hpp> | ||
#include <eve/module/core/regular/fma.hpp> | ||
|
||
namespace eve::detail | ||
{ | ||
template<typename T, typename A> | ||
auto | ||
poleval(T x, A const& coefs) | ||
{ | ||
auto p = coefs.begin(); | ||
if( coefs.end() == p ) return zero(as(x)); | ||
auto r = T(*p++); | ||
|
||
while( p != coefs.end() ) { r = fma(r, x, *p++); } | ||
return r; | ||
} | ||
|
||
template<typename T, typename A> | ||
auto | ||
poleval1(T x, A const& coefs) | ||
{ | ||
auto p = coefs.begin(); | ||
if( coefs.end() == p ) return one(as(x)); | ||
auto r = x + T(*p++); | ||
|
||
while( p != coefs.end() ) { r = fma(r, x, *p++); } | ||
return r; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.