diff --git a/include/eve/module/math.hpp b/include/eve/module/math.hpp index 1ee0a74d13..3ed1f7ae54 100644 --- a/include/eve/module/math.hpp +++ b/include/eve/module/math.hpp @@ -109,5 +109,3 @@ #include #include #include -#include -#include diff --git a/include/eve/module/math/detail/horner_impl.hpp b/include/eve/module/math/detail/horner_impl.hpp deleted file mode 100644 index 894e3963e3..0000000000 --- a/include/eve/module/math/detail/horner_impl.hpp +++ /dev/null @@ -1,120 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include - -namespace eve::detail -{ -//================================================================================================ -//== Horner variadic -//================================================================================================ - -// This commented implementation will be used later to implement right quaternion or octonion polynomial evaluation -// when multiple decorators will be allowed -// -// template -// EVE_FORCEINLINE constexpr auto -// horner_impl(D const& d, T0 const& xx, Cs... cs) noexcept -// -> common_value_t -// { -// using r_t = common_value_t; -// constexpr size_t N = sizeof...(Cs); -// if constexpr( N == 0 ) return r_t(0); -// else if constexpr( N == 1 ) return (r_t(cs), ...); -// else if constexpr( N == 2 ) return d(fma)(r_t(xx), r_t(cs)...); -// else -// { -// auto x = r_t(xx); -// auto dfma = fma[d]; -// r_t that(zero(as())); -// auto next = [&](auto that, auto arg) { return dfma(x, that, arg); }; -// ((that = next(that, cs)), ...); -// return that; -// } -// } - -// This implementation is used for left-polynomial evaluation (even for quaternion or octonion) -// - - template - EVE_FORCEINLINE constexpr auto - horner_impl(D const& d, T0 const& xx, Cs... cs) noexcept - -> common_value_t - { - using r_t = common_value_t; - constexpr size_t N = sizeof...(Cs); - if constexpr( N == 0 ) return r_t(0); - else if constexpr( N == 1 ) return (r_t(cs), ...); - else - { - auto x = r_t(xx); - r_t that(zero(as())); - auto next = [&](auto that, auto arg) { return fma[d](that, x, arg); }; - ((that = next(that, cs)), ...); - return that; - } - } - - -//================================================================================================ -//== Horner with ranges -//================================================================================================ - template - EVE_FORCEINLINE constexpr auto - horner_impl(D const& d, T0 xx, R const& r) noexcept - -> common_value_t - { - using r_t = common_value_t; - auto x = r_t(xx); - auto cur = std::begin(r); - auto last = std::end(r); - if( last == cur ) return r_t(0); - else if( std::distance(cur, last) == 1 ) return r_t(*cur); - else - { - using std::advance; - auto that = r_t(*cur); - auto step = [&](auto that, auto arg) { return fma[d](x, that, arg); }; - for( advance(cur, 1); cur != last; advance(cur, 1) ) that = step(that, *cur); - return that; - } - } - - template - EVE_FORCEINLINE constexpr auto - horner_impl(compensated_type const&, T0 xx, R const& r) noexcept - -> common_value_t - { - using r_t = common_value_t; - auto x = r_t(xx); - auto cur = std::begin(r); - auto last = std::end(r); - if( last == cur ) return r_t(0); - else if( std::distance(cur, last) == 1 ) return r_t(*cur); - else - { - using std::advance; - auto that {r_t(*cur)}; - auto err {zero(as())}; - auto step = [&x, &that, &err](auto arg) - { - auto [pi, epi] = two_prod(x, that); - auto [th, si] = two_add(pi, arg); - that = th; - err = fma(err, x, epi + si); - }; - for( advance(cur, 1); cur != last; advance(cur, 1) ) step(r_t(*cur)); - return that + err; - } - } - -} diff --git a/include/eve/module/math/detail/newton.hpp b/include/eve/module/math/detail/newton.hpp deleted file mode 100644 index 564ac2b668..0000000000 --- a/include/eve/module/math/detail/newton.hpp +++ /dev/null @@ -1,84 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -#include -#include - -#include - -namespace eve::detail -{ -//================================================================================================ -//== Newton with iterators -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -newton_impl(D const& d, T0 xx, IT1 const& firstc, IT1 const& lastc, IT2 const& firstn) noexcept -{ - using r_t = common_compatible_t::value_type, - typename std::iterator_traits::value_type>; - auto x = r_t(xx); - if( firstc == lastc ) return r_t(0); - if( std::distance(firstc, lastc) == 1 ) return r_t(*firstc); - else - { - using std::advance; - auto curc = firstc; - auto curn = firstn; - advance(curc, 1); - advance(curn, 1); - auto dfma = fma[d]; - r_t that(dfma(*firstc, sub(x, *firstn), *curc)); - auto step = [&](auto that, auto argc, auto argn) { return dfma(that, sub(x, argn), argc); }; - for( advance(curc, 1); curc != lastc; advance(curc, 1), advance(curn, 1) ) - that = step(that, *curc, *curn); - return that; - } -} - -//================================================================================================ -//== Newton with ranges -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -newton_impl(D const& d, T0 xx, R1 const& rc, R2 rn) noexcept -{ - using r_t = decltype(xx+ (typename R1::value_type)(0)+(typename R2::value_type)(0)); - auto x = r_t(xx); - auto firstc = begin(rc); - auto lastc = end(rc); - if( firstc == lastc ) return r_t(0); - else - { - auto siz = std::distance(firstc, lastc); - EVE_ASSERT(siz == inc(std::distance(begin(rn), end(rn))), - "number of nodes must equal to the number of coefficients minus 1"); - if( siz == 1 ) return r_t(*firstc); - else - { - using std::advance; - auto firstn = begin(rn); - auto curn = firstn; - auto curc = firstc; - advance(curc, 1); - advance(curn, 1); - auto dfma = fma[d]; - r_t that(dfma(*firstc, sub(x, *firstn), *curc)); - auto step = [&](auto that, auto argc, auto argn) { return dfma( that, sub(x, argn), argc); }; - for( advance(curc, 1); curc != lastc; advance(curc, 1), advance(curn, 1) ) - that = step(that, *curc, *curn); - return that; - } - } -} -} diff --git a/include/eve/module/math/detail/reverse_horner_impl.hpp b/include/eve/module/math/detail/reverse_horner_impl.hpp deleted file mode 100644 index 535971fe27..0000000000 --- a/include/eve/module/math/detail/reverse_horner_impl.hpp +++ /dev/null @@ -1,71 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -namespace eve::detail -{ - - template - EVE_FORCEINLINE constexpr auto - reverse_horner_impl(D const& d, T0 xx, C0 c0, Cs... cs) noexcept - -> decltype(horner(xx, c0, cs...)) - { - if constexpr((scalar_value && ... && scalar_value)) - { - using e_t = element_type_t; - using t_t = kumi::result::generate_t; - t_t c{e_t(c0), e_t(cs)...}; - return d(reverse_horner)(xx, c); - } - else - { - using r_t = common_value_t; - auto x = r_t(xx); - using t_t = kumi::result::generate_t; - t_t c {r_t{c0}, r_t{cs}...}; - return d(reverse_horner)(x, c); - } - } - - //================================================================================================ - //== Reverse_Horner with ranges - //================================================================================================ - template - EVE_FORCEINLINE constexpr auto - reverse_horner_impl(D const& d, T0 xx, R const& r) noexcept - -> common_value_t - { - using r_t = common_value_t; - auto x = r_t(xx); - auto cur = std::rbegin(r); - auto first = std::rend(r); - if( first == cur ) return r_t(0); - else if( std::distance(cur, first) == 1 ) return r_t(*cur); - else - { - auto dfma = fma[d]; - auto that = r_t(0); - auto step = [&](auto that, auto arg) { return dfma(x, that, arg); }; - for(; cur != first; ++cur ) that = step(that, *cur); - return that; - } - } - -} diff --git a/include/eve/module/math/detail/tchebeval.inactive b/include/eve/module/math/detail/tchebeval.inactive deleted file mode 100644 index 3ba4034ae5..0000000000 --- a/include/eve/module/math/detail/tchebeval.inactive +++ /dev/null @@ -1,37 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include -#include -#include -#include - -namespace eve::detail -{ -template -auto -tchebeval(T x, A const& coefs) -{ - auto p = coefs.begin(); - T b0 = T(*p++); - T b1 = eve::zero(eve::as(b0)); - T b2 = eve::zero(eve::as(b0)); - ; - - while( p != coefs.end() ) - { - b2 = -b1; - b1 = b0; - b0 = eve::fma(x, b1, b2 + *p++); - } - return eve::average(b0, b2); -} - -} diff --git a/include/eve/module/math/numeric/horner.hpp b/include/eve/module/math/numeric/horner.hpp deleted file mode 100644 index 6cbdaa26f1..0000000000 --- a/include/eve/module/math/numeric/horner.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/math/numeric/impl/horner.hpp b/include/eve/module/math/numeric/impl/horner.hpp deleted file mode 100644 index a7f560d829..0000000000 --- a/include/eve/module/math/numeric/impl/horner.hpp +++ /dev/null @@ -1,91 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include - -namespace eve::detail -{ -//================================================================================================ -//== Horner with iterators -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 xx, IT const& first, IT const& last) noexcept --> decltype(detail::horner_impl(pedantic, xx, first, last)) -{ - return detail::horner_impl(pedantic, xx, first, last); -} - -//================================================================================================ -//== Horner with iterators and leading unitary coefficient -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T0 xx, - callable_one_ const&, - IT const& first, - IT const& last) noexcept --> decltype(detail::horner_impl(pedantic, xx, one, first, last)) -{ - return detail::horner_impl(pedantic, xx, one, first, last); -} - -//================================================================================================ -//== Horner with ranges -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 xx, R const& r) noexcept --> decltype(detail::horner_impl(pedantic, xx, r)) -{ - return detail::horner_impl(pedantic, xx, r); -} - -//================================================================================================ -//== Horner with ranges and leading unitary coefficient -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 xx, callable_one_ const&, R const& r) noexcept --> decltype(detail::horner_impl(pedantic, xx, one, r)) -{ - return detail::horner_impl(pedantic, xx, one, r); -} - -//================================================================================================ -//== Horner variadic N parameters (((..(a*x+b)*x+c)*x + ..)..) -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 x, Ts... args) noexcept -{ - return horner_impl(pedantic, x, args...); -} - -//================================================================================================ -//== N parameters with unitary first coefficient (((..(a*x+b)*x+c)*x + ..)..) -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 x, callable_one_ const&, Ts... args) noexcept -{ - return horner_impl(pedantic, x, one, args...); -} - -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), numeric_type const &, T0 x, Ts tup) noexcept -{ - return kumi::apply( [&](auto... m) { return horner_impl(pedantic, x, m...); }, tup); -} -} diff --git a/include/eve/module/math/numeric/impl/reverse_horner.hpp b/include/eve/module/math/numeric/impl/reverse_horner.hpp deleted file mode 100644 index 7989e5af64..0000000000 --- a/include/eve/module/math/numeric/impl/reverse_horner.hpp +++ /dev/null @@ -1,108 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include - -namespace eve::detail -{ -//================================================================================================ -//== Horner with iterators -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T0 xx, - IT const& first, - IT const& last) noexcept --> decltype(detail::reverse_horner_impl(pedantic, xx, first, last)) -{ - return detail::reverse_horner_impl(pedantic, xx, first, last); -} - -//================================================================================================ -//== Horner with iterators and leading unitary coefficient -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T0 xx, - callable_one_ const&, - IT const& first, - IT const& last) noexcept --> decltype(detail::reverse_horner_impl(pedantic, xx, one, first, last)) -{ - return detail::reverse_horner_impl(pedantic, xx, one, first, last); -} - -//================================================================================================ -//== Horner with ranges -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 xx, R const& r) noexcept --> decltype(detail::reverse_horner_impl(pedantic, xx, r)) -{ - return detail::reverse_horner_impl(pedantic, xx, r); -} - -//================================================================================================ -//== Horner with ranges and leading unitary coefficient -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T0 xx, - callable_one_ const&, - R const& r) noexcept --> decltype(detail::reverse_horner_impl(pedantic, xx, one, r)) -{ - return detail::reverse_horner_impl(pedantic, xx, one, r); -} - -//================================================================================================ -//== Horner variadic N parameters (((..(a*x+b)*x+c)*x + ..)..) -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 x, Ts... args) noexcept --> decltype( reverse_horner_impl(pedantic, x, args...)) - { - return reverse_horner_impl(pedantic, x, args...); -} - -//================================================================================================ -//== N parameters with unitary first coefficient (((..(a*x+b)*x+c)*x + ..)..) -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T0 x, - callable_one_ const&, - Ts... args) noexcept --> decltype(reverse_horner_impl(pedantic, x, one, args...)) -{ - return reverse_horner_impl(pedantic, x, one, args...); -} - -//================================================================================================ -//== tuples -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), numeric_type const & , T0 x, kumi::tuple args) noexcept -{ - return numeric(horner)(x, kumi::reverse(args)); -} -} diff --git a/include/eve/module/math/numeric/math.hpp b/include/eve/module/math/numeric/math.hpp deleted file mode 100644 index 2d6a16fc03..0000000000 --- a/include/eve/module/math/numeric/math.hpp +++ /dev/null @@ -1,8 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once diff --git a/include/eve/module/math/numeric/reverse_horner.hpp b/include/eve/module/math/numeric/reverse_horner.hpp deleted file mode 100644 index 9b60d68b6b..0000000000 --- a/include/eve/module/math/numeric/reverse_horner.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/math/pedantic/horner.hpp b/include/eve/module/math/pedantic/horner.hpp deleted file mode 100644 index 80d5acfdce..0000000000 --- a/include/eve/module/math/pedantic/horner.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/math/pedantic/impl/horner.hpp b/include/eve/module/math/pedantic/impl/horner.hpp deleted file mode 100644 index e6f000954d..0000000000 --- a/include/eve/module/math/pedantic/impl/horner.hpp +++ /dev/null @@ -1,97 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -namespace eve::detail -{ -//================================================================================================ -//== Horner with iterators -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 xx, IT const& first, IT const& last) noexcept --> common_value_t::value_type> -{ - return detail::horner_impl(pedantic_type(), xx, first, last); -} - -//================================================================================================ -//== Horner with iterators and leading unitary coefficient -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T0 xx, - callable_one_ const&, - IT const& first, - IT const& last) noexcept --> common_value_t::value_type> -{ - return detail::horner_impl(pedantic_type(), xx, one, first, last); -} - -//================================================================================================ -//== Horner with ranges -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 xx, R const& r) noexcept --> common_value_t -{ - return detail::horner_impl(pedantic_type(), xx, r); -} - -//================================================================================================ -//== Horner with ranges and leading unitary coefficient -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 xx, callable_one_ const&, R const& r) noexcept --> common_value_t -{ - return detail::horner_impl(pedantic_type(), xx, one, r); -} - -//================================================================================================ -//== N parameters (((..(a*x+b)*x+c)*x + ..)..) -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 x, Ts... args) noexcept --> decltype(horner_impl(pedantic_type(), x, args...)) -{ - return horner_impl(pedantic_type(), x, args...); -} - -//================================================================================================ -//== N parameters with unitary leader coefficient (((..(x+b)*x+c)*x + ..)..) -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 x, callable_one_ const&, Ts... args) noexcept --> decltype(horner_impl(pedantic_type(), x, one, args...)) -{ - return horner_impl(pedantic_type(), x, one, args...); -} - -template -EVE_FORCEINLINE constexpr auto -horner_(EVE_SUPPORTS(cpu_), pedantic_type const &, T0 x, Ts tup) noexcept -{ - return kumi::apply( [&](auto... m) { return pedantic(horner)(x, m...); }, tup); -} - -} diff --git a/include/eve/module/math/pedantic/impl/reverse_horner.hpp b/include/eve/module/math/pedantic/impl/reverse_horner.hpp deleted file mode 100644 index 63cb8422e8..0000000000 --- a/include/eve/module/math/pedantic/impl/reverse_horner.hpp +++ /dev/null @@ -1,109 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -namespace eve::detail -{ -//================================================================================================ -//== Horner with iterators -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T0 xx, - IT const& first, - IT const& last) noexcept --> decltype( detail::reverse_horner_impl(pedantic_type(), xx, first, last)) -{ - return detail::reverse_horner_impl(pedantic_type(), xx, first, last); -} - -//================================================================================================ -//== Horner with iterators and leading unitary coefficient -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T0 xx, - callable_one_ const&, - IT const& first, - IT const& last) noexcept --> decltype(detail::reverse_horner_impl(pedantic_type(), xx, one, first, last)) -{ - return detail::reverse_horner_impl(pedantic_type(), xx, one, first, last); -} - -//================================================================================================ -//== Horner with ranges -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 xx, R const& r) noexcept --> decltype(detail::reverse_horner_impl(pedantic_type(), xx, r)) -{ - return detail::reverse_horner_impl(pedantic_type(), xx, r); -} - -//================================================================================================ -//== Horner with ranges and leading unitary coefficient -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T0 xx, - callable_one_ const&, - R const& r) noexcept --> decltype( detail::reverse_horner_impl(pedantic_type(), xx, one, r)) -{ - return detail::reverse_horner_impl(pedantic_type(), xx, one, r); -} - -//================================================================================================ -//== N parameters (((..(a*x+b)*x+c)*x + ..)..) -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 x, Ts... args) noexcept -{ - return reverse_horner_impl(pedantic_type(), x, args...); -} - -//================================================================================================ -//== N parameters with unitary leader coefficient (((..(x+b)*x+c)*x + ..)..) -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T0 x, - callable_one_ const&, - Ts... args) noexcept -{ - return reverse_horner_impl(pedantic_type(), x, one, args...); -} - -//================================================================================================ -//== tuples -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -reverse_horner_(EVE_SUPPORTS(cpu_), pedantic_type const & , T0 x, kumi::tuple args) noexcept -{ - return pedantic(horner)(x, kumi::reverse(args)); -} -} diff --git a/include/eve/module/math/pedantic/math.hpp b/include/eve/module/math/pedantic/math.hpp deleted file mode 100644 index 2d6a16fc03..0000000000 --- a/include/eve/module/math/pedantic/math.hpp +++ /dev/null @@ -1,8 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once diff --git a/include/eve/module/math/pedantic/reverse_horner.hpp b/include/eve/module/math/pedantic/reverse_horner.hpp deleted file mode 100644 index 0e33e0abe3..0000000000 --- a/include/eve/module/math/pedantic/reverse_horner.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/polynomial.hpp b/include/eve/module/polynomial.hpp index b1f5be5d29..84d01e1a0b 100644 --- a/include/eve/module/polynomial.hpp +++ b/include/eve/module/polynomial.hpp @@ -20,5 +20,3 @@ //! @} //================================================================================================== #include -#include -#include diff --git a/include/eve/module/polynomial/detail/newton_impl.hpp b/include/eve/module/polynomial/detail/newton_impl.hpp deleted file mode 100644 index 564ac2b668..0000000000 --- a/include/eve/module/polynomial/detail/newton_impl.hpp +++ /dev/null @@ -1,84 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -#include -#include - -#include - -namespace eve::detail -{ -//================================================================================================ -//== Newton with iterators -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -newton_impl(D const& d, T0 xx, IT1 const& firstc, IT1 const& lastc, IT2 const& firstn) noexcept -{ - using r_t = common_compatible_t::value_type, - typename std::iterator_traits::value_type>; - auto x = r_t(xx); - if( firstc == lastc ) return r_t(0); - if( std::distance(firstc, lastc) == 1 ) return r_t(*firstc); - else - { - using std::advance; - auto curc = firstc; - auto curn = firstn; - advance(curc, 1); - advance(curn, 1); - auto dfma = fma[d]; - r_t that(dfma(*firstc, sub(x, *firstn), *curc)); - auto step = [&](auto that, auto argc, auto argn) { return dfma(that, sub(x, argn), argc); }; - for( advance(curc, 1); curc != lastc; advance(curc, 1), advance(curn, 1) ) - that = step(that, *curc, *curn); - return that; - } -} - -//================================================================================================ -//== Newton with ranges -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -newton_impl(D const& d, T0 xx, R1 const& rc, R2 rn) noexcept -{ - using r_t = decltype(xx+ (typename R1::value_type)(0)+(typename R2::value_type)(0)); - auto x = r_t(xx); - auto firstc = begin(rc); - auto lastc = end(rc); - if( firstc == lastc ) return r_t(0); - else - { - auto siz = std::distance(firstc, lastc); - EVE_ASSERT(siz == inc(std::distance(begin(rn), end(rn))), - "number of nodes must equal to the number of coefficients minus 1"); - if( siz == 1 ) return r_t(*firstc); - else - { - using std::advance; - auto firstn = begin(rn); - auto curn = firstn; - auto curc = firstc; - advance(curc, 1); - advance(curn, 1); - auto dfma = fma[d]; - r_t that(dfma(*firstc, sub(x, *firstn), *curc)); - auto step = [&](auto that, auto argc, auto argn) { return dfma( that, sub(x, argn), argc); }; - for( advance(curc, 1); curc != lastc; advance(curc, 1), advance(curn, 1) ) - that = step(that, *curc, *curn); - return that; - } - } -} -} diff --git a/include/eve/module/polynomial/detail/tchebeval_impl.inactive b/include/eve/module/polynomial/detail/tchebeval_impl.inactive deleted file mode 100644 index 4d7edfc21c..0000000000 --- a/include/eve/module/polynomial/detail/tchebeval_impl.inactive +++ /dev/null @@ -1,156 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include - -#include -#include - -#include - -namespace eve::detail -{ -//================================================================================================ -//== Tchebeval with range -//================================================================================================ -template -EVE_FORCEINLINE constexpr common_compatible_t -tchebeval_impl(D const& d, T0 xx, R const& r) noexcept -{ - using r_t = common_compatible_t; - auto x = r_t(xx); - auto first = std::begin(r); - auto cur = std::end(r); - if( first == cur ) return r_t(0); - if( std::distance(first, cur) == 1 ) return r_t((*first) / 2); - else - { - --cur; - auto dfma = fma[d]; - r_t b2 = zero(as()); - r_t b1 = r_t(*cur--); - for( ; cur != first; --cur ) - { - r_t tmp = dfma(x + x, b1, *cur - b2); - b2 = b1; - b1 = tmp; - } - return dfma(x, b1, fms(*cur, half(as()), b2)); - } -} - -template -EVE_FORCEINLINE constexpr common_compatible_t -tchebeval_impl(D const& d, T0 xx, T1 a, T2 b, R const& r) noexcept -{ - using r_t = common_compatible_t; - auto x = r_t(xx); - auto first = std::begin(r); - auto cur = std::end(r); - auto den = rec(b - a); - if( first == cur ) return r_t(0); - if( std::distance(first, cur) == 1 ) return r_t((*first) / 2); - else - { - auto dfma = fma[d]; - auto up = [&dfma, &r, first](auto, auto t) - { - auto cur = std::end(r); - --cur; - r_t b2(0); - r_t b1(*cur--); - for( ; cur != first; --cur ) - { - r_t tmp = dfma(t + t, b1, *cur - b2); - b2 = b1; - b1 = tmp; - } - return dfma(t, b1, fms(*cur, half(as()), b2)); - }; - - auto downg = [&dfma, &r, first](auto u, auto t) - { - auto cur = std::end(r); - --cur; - r_t b(*cur--); - r_t d(b); - r_t b2(0); - for( ; cur != first; --cur ) - { - d = dfma(u + u, b, *cur + d); - b2 = b; - b = d + b; - } - return dfma(t, b, fms(*cur, half(as()), b2)); - }; - - auto downl = [&dfma, &r, first](auto u, auto t) - { - auto cur = std::end(r); - --cur; - r_t b(*cur--); - r_t d(b); - r_t b2(0); - for( ; cur != first; --cur ) - { - d = dfma(u + u, b, *cur - d); - b2 = b; - b = d - b; - } - return dfma(t, b, fms(*cur, half(as()), b2)); - }; - - auto compute_lesser = [&up, &downl, &den, &a](auto x) - { - auto u = 2 * (x - a) * den; - auto t = dec(u); - auto tc = t > r_t(-0.6); - ; - if( eve::all(tc) ) return up(u, t); - else if( eve::none(tc) ) return downl(u, t); - else return if_else(tc, up(u, t), downl(u, t)); - }; - - auto compute_greater = [&up, &downg, &den, &b](auto x) - { - auto u = -2 * (b - x) * den; - auto t = inc(u); - auto tc = t < r_t(0.6); - ; - if( eve::all(tc) ) return up(u, t); - else if( eve::none(tc) ) return downg(u, t); - else return if_else(tc, up(u, t), downg(u, t)); - }; - auto test = (x - a) < (b - x); - if( eve::all(test) ) return compute_lesser(x); - else if( eve::none(test) ) return compute_greater(x); - else return if_else(test, compute_lesser(x), compute_greater(x)); - } -} - -//================================================================================================ -//== N+1 parameters -//================================================================================================ - -template -EVE_FORCEINLINE constexpr common_compatible_t -tchebeval_impl(D const& d, T0 x, Cs... cs) noexcept -{ - constexpr size_t N = sizeof...(cs); - // copy the coefficients to an array - if constexpr( N == 0 ) return zero(as(x)); - else - { - using r_t = common_compatible_t; - std::array c {r_t(cs)...}; - return tchebeval_impl(d, r_t(x), c); - } -} -} diff --git a/include/eve/module/polynomial/numeric/impl/newton.hpp b/include/eve/module/polynomial/numeric/impl/newton.hpp deleted file mode 100644 index 045dd1e729..0000000000 --- a/include/eve/module/polynomial/numeric/impl/newton.hpp +++ /dev/null @@ -1,41 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include - -namespace eve::detail -{ -//================================================================================================ -//== Newton with iterators -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -newton_(EVE_SUPPORTS(cpu_), - numeric_type const&, - T0 xx, - IT0 const& firstc, - IT0 const& lastc, - IT1 const& firstn) noexcept --> decltype( detail::newton_impl(pedantic, xx, firstc, lastc, firstn)) -{ - return detail::newton_impl(pedantic, xx, firstc, lastc, firstn); -} - -//================================================================================================ -//== Newton with ranges -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -newton_(EVE_SUPPORTS(cpu_), numeric_type const&, T0 xx, R1 const& rc, R2 const& rn) noexcept --> decltype(detail::newton_impl(pedantic, xx, rc, rn)) -{ - return detail::newton_impl(pedantic, xx, rc, rn); -} -} diff --git a/include/eve/module/polynomial/numeric/newton.hpp b/include/eve/module/polynomial/numeric/newton.hpp deleted file mode 100644 index 3799f1eba6..0000000000 --- a/include/eve/module/polynomial/numeric/newton.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/polynomial/numeric/polynomial.hpp b/include/eve/module/polynomial/numeric/polynomial.hpp deleted file mode 100644 index a0c19b47ef..0000000000 --- a/include/eve/module/polynomial/numeric/polynomial.hpp +++ /dev/null @@ -1,10 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include diff --git a/include/eve/module/polynomial/pedantic/impl/newton.hpp b/include/eve/module/polynomial/pedantic/impl/newton.hpp deleted file mode 100644 index 6b0346e642..0000000000 --- a/include/eve/module/polynomial/pedantic/impl/newton.hpp +++ /dev/null @@ -1,42 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once -#include -#include -#include - -namespace eve::detail -{ -//================================================================================================ -//== Newton with iterators -//================================================================================================ - -template -EVE_FORCEINLINE constexpr auto -newton_(EVE_SUPPORTS(cpu_), - pedantic_type const&, - T0 xx, - IT0 const& firstc, - IT0 const& lastc, - IT1 const& firstn) noexcept --> decltype(detail::newton_impl(pedantic_type(), xx, firstc, lastc, firstn)) -{ - return detail::newton_impl(pedantic_type(), xx, firstc, lastc, firstn); -} - -//================================================================================================ -//== Newton with ranges -//================================================================================================ -template -EVE_FORCEINLINE constexpr auto -newton_(EVE_SUPPORTS(cpu_), pedantic_type const&, T0 xx, R1 const& rc, R2 const& rn) noexcept -//-> decltype(detail::newton_impl(pedantic_type(), xx, rc, rn)) -{ - return detail::newton_impl(pedantic_type(), xx, rc, rn); -} -} diff --git a/include/eve/module/polynomial/pedantic/newton.hpp b/include/eve/module/polynomial/pedantic/newton.hpp deleted file mode 100644 index 7b76a3a376..0000000000 --- a/include/eve/module/polynomial/pedantic/newton.hpp +++ /dev/null @@ -1,11 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include -#include diff --git a/include/eve/module/polynomial/pedantic/polynomial.hpp b/include/eve/module/polynomial/pedantic/polynomial.hpp deleted file mode 100644 index a7ca0547e2..0000000000 --- a/include/eve/module/polynomial/pedantic/polynomial.hpp +++ /dev/null @@ -1,10 +0,0 @@ -//================================================================================================== -/* - EVE - Expressive Vector Engine - Copyright : EVE Project Contributors - SPDX-License-Identifier: BSL-1.0 -*/ -//================================================================================================== -#pragma once - -#include