Skip to content

Commit

Permalink
[FEATURE] log familly, circular trigonometrics and co-trigo functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlap committed Aug 31, 2023
1 parent a1d0958 commit 8c700d5
Show file tree
Hide file tree
Showing 45 changed files with 2,660 additions and 7 deletions.
15 changes: 15 additions & 0 deletions include/kyosu/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
#include <kyosu/functions/abs.hpp>
#include <kyosu/functions/ceil.hpp>
#include <kyosu/functions/conj.hpp>
#include <kyosu/functions/cos.hpp>
#include <kyosu/functions/cosh.hpp>
#include <kyosu/functions/cot.hpp>
#include <kyosu/functions/coth.hpp>
#include <kyosu/functions/convert.hpp>
#include <kyosu/functions/csc.hpp>
#include <kyosu/functions/csch.hpp>
#include <kyosu/functions/dec.hpp>
#include <kyosu/functions/dist.hpp>
#include <kyosu/functions/exp.hpp>
Expand Down Expand Up @@ -49,6 +53,10 @@
#include <kyosu/functions/jpart.hpp>
#include <kyosu/functions/kpart.hpp>
#include <kyosu/functions/lerp.hpp>
#include <kyosu/functions/log.hpp>
#include <kyosu/functions/log1p.hpp>
#include <kyosu/functions/log10.hpp>
#include <kyosu/functions/log2.hpp>
#include <kyosu/functions/minus.hpp>
#include <kyosu/functions/nearest.hpp>
#include <kyosu/functions/oneminus.hpp>
Expand All @@ -57,9 +65,16 @@
#include <kyosu/functions/real.hpp>
#include <kyosu/functions/rec.hpp>
#include <kyosu/functions/reldist.hpp>
#include <kyosu/functions/sec.hpp>
#include <kyosu/functions/sech.hpp>
#include <kyosu/functions/sign.hpp>
#include <kyosu/functions/sin.hpp>
#include <kyosu/functions/sincos.hpp>
#include <kyosu/functions/sinh.hpp>
#include <kyosu/functions/sinhcosh.hpp>
#include <kyosu/functions/sqr_abs.hpp>
#include <kyosu/functions/sqr.hpp>
#include <kyosu/functions/sqrt.hpp>
#include <kyosu/functions/tan.hpp>
#include <kyosu/functions/tanh.hpp>
#include <kyosu/functions/trunc.hpp>
74 changes: 74 additions & 0 deletions include/kyosu/functions/cos.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright : KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/math.hpp>

namespace kyosu::tags
{
struct callable_cos : eve::elementwise
{
using callable_tag_type = callable_cos;

KYOSU_DEFERS_CALLABLE(cos_);

template<eve::ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::cos(v); }

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target))
{
return eve::tag_invoke(*this, target);
}

template<typename... T>
eve::unsupported_call<callable_cos(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var cos
//! @brief Computes the cosine of the argument.
//!
//! **Defined in Header**
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<kyosu::concepts::cayley_dickson T> constexpr T cos(T z) noexcept;
//! template<eve::ordered_value T> constexpr T cos(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z` : Value to process.
//!
//! **Return value**
//!
//! Returns the cosine of the argument.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/cos.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_cos cos = {};
}
74 changes: 74 additions & 0 deletions include/kyosu/functions/cot.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright : KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/math.hpp>

namespace kyosu::tags
{
struct callable_cot : eve::elementwise
{
using callable_tag_type = callable_cot;

KYOSU_DEFERS_CALLABLE(cot_);

template<eve::ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::cot(v); }

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target))
{
return eve::tag_invoke(*this, target);
}

template<typename... T>
eve::unsupported_call<callable_cot(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var cot
//! @brief Computes the cotangent of the argument.
//!
//! **Defined in Header**
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<kyosu::concepts::cayley_dickson T> constexpr T cot(T z) noexcept;
//! template<eve::ordered_value T> constexpr T cot(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z` : Value to process.
//!
//! **Return value**
//!
//! Returns the cotangent of the argument.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/cot.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_cot cot = {};
}
74 changes: 74 additions & 0 deletions include/kyosu/functions/csc.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright : KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/math.hpp>

namespace kyosu::tags
{
struct callable_csc : eve::elementwise
{
using callable_tag_type = callable_csc;

KYOSU_DEFERS_CALLABLE(csc_);

template<eve::ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::csc(v); }

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target))
{
return eve::tag_invoke(*this, target);
}

template<typename... T>
eve::unsupported_call<callable_csc(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var csc
//! @brief Computes the cosecant of the argument.
//!
//! **Defined in Header**
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<kyosu::concepts::cayley_dickson T> constexpr T csc(T z) noexcept;
//! template<eve::ordered_value T> constexpr T csc(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z` : Value to process.
//!
//! **Return value**
//!
//! Returns the cosecant of the argument.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/csc.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_csc csc = {};
}
74 changes: 74 additions & 0 deletions include/kyosu/functions/csch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//======================================================================================================================
/*
Kyosu - Complex Without Complexes
Copyright : KYOSU Contributors & Maintainers
SPDX-License-Identifier: BSL-1.0
*/
//======================================================================================================================
#pragma once

#include <kyosu/details/invoke.hpp>
#include <eve/module/math.hpp>

namespace kyosu::tags
{
struct callable_csch : eve::elementwise
{
using callable_tag_type = callable_csch;

KYOSU_DEFERS_CALLABLE(csch_);

template<eve::ordered_value T>
static KYOSU_FORCEINLINE auto deferred_call(auto, T const& v) noexcept { return eve::csch(v); }

template<typename T>
KYOSU_FORCEINLINE auto operator()(T const& target) const noexcept -> decltype(eve::tag_invoke(*this, target))
{
return eve::tag_invoke(*this, target);
}

template<typename... T>
eve::unsupported_call<callable_csch(T&&...)> operator()(T&&... x) const
requires(!requires { eve::tag_invoke(*this, KYOSU_FWD(x)...); }) = delete;
};
}

namespace kyosu
{
//======================================================================================================================
//! @addtogroup functions
//! @{
//! @var csch
//! @brief Computes the hyperbolic cscant of the argument.
//!
//! **Defined in Header**
//!
//! @code
//! #include <kyosu/functions.hpp>
//! @endcode
//!
//! @groupheader{Callable Signatures}
//!
//! @code
//! namespace kyosu
//! {
//! template<kyosu::concepts::cayley_dickson T> constexpr T csch(T z) noexcept;
//! template<eve::ordered_value T> constexpr T csch(T z) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `z` : Value to process.
//!
//! **Return value**
//!
//! Returns the hyperbolic cscant of the argument.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/csch.cpp}
//! @}
//======================================================================================================================
inline constexpr tags::callable_csch csch = {};
}
Loading

0 comments on commit 8c700d5

Please sign in to comment.