Skip to content

Commit

Permalink
to_complex trunc zeta
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlap committed Nov 23, 2024
1 parent 7fb15d3 commit ab42f1f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/kyosu/functions/to_complex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ namespace kyosu
template<eve::floating_value T>
KYOSU_FORCEINLINE constexpr complex_t<T> operator()(T r) const noexcept
{
return as_cayley_dickson_n_t<2,T>(v, R{0});
return as_cayley_dickson_n_t<2,T>(r, T{0});
}

template<eve::floating_value R, eve::floating_value I>
KYOSU_FORCEINLINE constexpr as_cayley_dickson_n_t<2,R,I> operator()(R r,I i) const noexcept
{
return return as_cayley_dickson_n_t<2,R,I>{r, i};
return as_cayley_dickson_n_t<2,R,I>{r, i};
}

KYOSU_CALLABLE_OBJECT(make_complex_t, make_complex_);
Expand Down
11 changes: 1 addition & 10 deletions include/kyosu/functions/trunc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace kyosu
{
template<concepts::cayley_dickson Z>
KYOSU_FORCEINLINE constexpr Z operator()(Z const& z) const noexcept
{ return KYOSU_CALL(z); }
{ return Z{kumi::map([](auto const& e) { return eve::trunc(e); }, z)}; }

template<concepts::real V>
KYOSU_FORCEINLINE constexpr V operator()(V v) const noexcept
Expand Down Expand Up @@ -65,12 +65,3 @@ namespace kyosu
//! @}
//======================================================================================================================
}

namespace kyosu::_
{
template<typename Z, eve::callable_options O>
KYOSU_FORCEINLINE constexpr auto trunc_(KYOSU_DELAY(), O const&, Z c) noexcept
{
return Z{kumi::map([](auto const& e) { return eve::trunc(e); }, c)};
}
}
14 changes: 13 additions & 1 deletion include/kyosu/functions/zeta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,19 @@ namespace kyosu
{
template<concepts::cayley_dickson Z>
KYOSU_FORCEINLINE constexpr Z operator()(Z const& z) const noexcept
{ return KYOSU_CALL(z); }
{
if constexpr(concepts::complex<Z> )
{
auto zz=exp2(z);
auto k = zz/(zz-2);
auto g = if_else(z == Z(1), complex(eve::nan(eve::as(real(z)))), k*eta(z));
return if_else(real(z) == eve::inf(eve::as(real(z))), complex(eve::one(eve::as(real(z)))), g);
}
else
{
return kyosu::_::cayley_extend(*this, z);
}
}

template<concepts::real V>
KYOSU_FORCEINLINE constexpr complex_t<V> operator()(V v) const noexcept
Expand Down

0 comments on commit ab42f1f

Please sign in to comment.