Skip to content

Commit

Permalink
Documentation for I functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlap committed Jul 6, 2024
1 parent 19ca0d9 commit 33f81a5
Show file tree
Hide file tree
Showing 61 changed files with 717 additions and 1,268 deletions.
24 changes: 0 additions & 24 deletions benchmarks/module/core/is_not_imag/regular/is_not_imag.hpp

This file was deleted.

24 changes: 0 additions & 24 deletions benchmarks/module/core/is_not_real/regular/is_not_real.hpp

This file was deleted.

2 changes: 0 additions & 2 deletions include/eve/module/core/regular/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,10 @@
#include <eve/module/core/regular/is_not_flint.hpp>
#include <eve/module/core/regular/is_not_greater.hpp>
#include <eve/module/core/regular/is_not_greater_equal.hpp>
#include <eve/module/core/regular/is_not_imag.hpp>
#include <eve/module/core/regular/is_not_infinite.hpp>
#include <eve/module/core/regular/is_not_less.hpp>
#include <eve/module/core/regular/is_not_less_equal.hpp>
#include <eve/module/core/regular/is_not_nan.hpp>
#include <eve/module/core/regular/is_not_real.hpp>
#include <eve/module/core/regular/is_odd.hpp>
#include <eve/module/core/regular/is_ordered.hpp>
#include <eve/module/core/regular/is_positive.hpp>
Expand Down
4 changes: 2 additions & 2 deletions include/eve/module/core/regular/exponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ namespace eve
//! * zero returns zero
//! 2 identical except that results for zero, nan and infinite inputs are unspecified
//!
//! @note
//! * The exponent \f$e\f$ and mantissa \f$m\f$ of a floating point entry \f$x\f$ are related by
//! @note The exponent \f$e\f$ and mantissa \f$m\f$ of a floating point entry \f$x\f$ are related by
//! \f$x = m\times 2^e\f$, with \f$|m| \in \{0\} \cup [1, 2[\f$.
//!
//! @groupheader{Example}
//! @godbolt{doc/core/exponent.cpp}
//! @}
Expand Down
25 changes: 11 additions & 14 deletions include/eve/module/core/regular/if_else.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace eve
//! @var if_else
//! @brief Computes the results of a choice under condition
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand All @@ -29,15 +29,14 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T, eve::value U, eve::value V >
//! auto if_else(T x, U, y, V z ) noexcept;
//! constexpr auto if_else(value auto x, value auto y, value auto z ) noexcept;
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x`: condition
//! * `y`, `z`: choice [arguments](@ref eve::value).
//! * `y`, `z`: choice [value](@ref value).
//!
//! **Return value**
//!
Expand All @@ -49,19 +48,17 @@ namespace eve
//!
//! The following calls where `x`, `y` and `z` are values can be optimized:
//!
//! * `if_else(x, y, allbits< T >()) ` writing: `if_else(x, y, eve::allbits_)`
//! * `if_else(x, y, one< T >() ) ` writing: `if_else(x, y, eve::one_ )`
//! * `if_else(x, y, mone< T >() ) ` writing: `if_else(x, y, eve::mone_ )`
//! * `if_else(x, y, zero< T >() ) ` writing: `if_else(x, y, eve::zero_ )`
//! * `if_else(x, allbits< T >(), z) ` writing: `if_else(x, eve::allbits_, z)`
//! * `if_else(x, one< T >(), z ) ` writing: `if_else(x, eve::one_, z )`
//! * `if_else(x, mone< T >(), z ) ` writing: `if_else(x, eve::mone_, z )`
//! * `if_else(x, zero< T >(), z ) ` writing: `if_else(x, eve::zero_, z )`
//! * `if_else(x, y, allbits< T >())` writing: `if_else(x, y, allbits)`
//! * `if_else(x, y, one< T >() )` writing: `if_else(x, y, one )`
//! * `if_else(x, y, mone< T >() )` writing: `if_else(x, y, mone )`
//! * `if_else(x, y, zero< T >() )` writing: `if_else(x, y, zero )`
//! * `if_else(x, allbits< T >(), z)` writing: `if_else(x, allbits, z)`
//! * `if_else(x, one< T >(), z )` writing: `if_else(x, one, z )`
//! * `if_else(x, mone< T >(), z )` writing: `if_else(x, mone, z )`
//! * `if_else(x, zero< T >(), z )` writing: `if_else(x, zero, z )`
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/if_else.cpp}
//!
//! @}
//================================================================================================
EVE_MAKE_CALLABLE(if_else_, if_else);
Expand Down
2 changes: 1 addition & 1 deletion include/eve/module/core/regular/ifrexp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct ifrexp_t : elementwise_callable<ifrexp_t, Options, pedantic_option, raw_o
//! @brief Computes the [elementwise](@ref glossary_elementwise) ieee
//! pair of mantissa and exponent of the floating value,
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand Down
40 changes: 18 additions & 22 deletions include/eve/module/core/regular/inc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ namespace eve
//! @addtogroup core_arithmetic
//! @{
//! @var inc
//! @brief return the input incremented by one.
//! @brief `elementwise_callable` object returning the input incremented by 1.
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand All @@ -40,37 +40,33 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T >
//! T inc(T x) noexcept;
//! // Regular overload
//! constexpr auto inc(value auto x) noexcept; // 1
//!
//! // Lanes masking
//! constexpr auto inc[conditional_expr auto c](value auto x) noexcept; // 2
//! constexpr auto inc[logical_value auto m](value auto x) noexcept; // 2
//!
//! // Semantic options
//! constexpr auto inc[saturated](value auto x) noexcept; // 3
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x` : [real](@ref eve::value) argument.
//! * `x`: [SIMD or scalar value](@ref value).
//! * `c`: [Conditional expression](@ref conditional_expr) masking the operation.
//! * `m`: [Logical value](@ref logical) masking the operation.
//!
//! **Return value**
//!
//! The value of `x + 1` is returned.
//! 1. The value of `x + 1` is returned.
//! 2. [The operation is performed conditionnaly](@ref conditional).
//! 3. The saturated incrementation of `x`. More specifically, for signed
//! integral, `abs[saturated](valmin(as<T>{}))` returns `eve:valmin(as<T>{}))`
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/inc.cpp}
//!
//! @groupheader{Semantic Modifiers}
//!
//! * Masked Call
//!
//! The call `eve::inc[mask](x, ...)` provides a masked
//! version of `inc` which is
//! equivalent to `if_else(mask, inc(x, ...), x)`
//!
//! * eve::saturated
//!
//! The call `saturated(inc)(x)` computes the saturated increment of `x`.
//! The only interest of this behaviour is that
//! for integral type T the call `saturated(inc)(Valmax<T>())` returns `Valmax<T>()`.
//!
//! @}
//================================================================================================
inline constexpr auto inc = functor<inc_t>;
Expand Down
1 change: 1 addition & 0 deletions include/eve/module/core/regular/interleave.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
#pragma once

#include <eve/detail/function/interleave.hpp>
//TODO doc
2 changes: 1 addition & 1 deletion include/eve/module/core/regular/interleave_shuffle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <eve/traits/as_wide.hpp>
#include <eve/traits/cardinal.hpp>


//TODO doc
namespace eve
{
template<typename Options>
Expand Down
40 changes: 17 additions & 23 deletions include/eve/module/core/regular/is_denormal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ namespace eve
//! @addtogroup core_predicates
//! @{
//! @var is_denormal
//! @brief Returns a logical true if and only if the element value is denormal.
//! @brief `elementwise callable` returning a logical true if and only if the element value
//! is [denormal](https://en.wikipedia.org/wiki/Subnormal_number)
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand All @@ -49,38 +50,31 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T >
//! eve::as_logical<T> is_denormal(T x) noexcept;
//! // Regular overloads
//! constexpr auto is_denormal(floating value auto x) noexcept; // 1
//! constexpr auto is_denormal(integral value auto x) noexcept; // 2
//!
//! // Lanes masking
//! constexpr auto is_denormal[conditional_expr auto c](value auto x) noexcept; // 3
//! constexpr auto is_denormal[logical_value auto m](value auto x) noexcept; // 3
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x` : [argument](@ref eve::value).
//! * `x`: [argument](@ref eve::value).
//! * `c`: [Conditional expression](@ref conditional_expr) masking the operation.
//! * `m`: [Logical value](@ref logical) masking the operation.
//!
//! **Return value**
//!
//! The call `is_denormal(x)` is semantically equivalent to:
//!
//! @code
//! if constexpr(floating_value<T>)
//! return (eve::abs(x) < eve::smallestposval(as(x))) && is_nez(x);
//! else constexpr(integral_value<T>)
//! return eve::false_(as(x));
//! @endcode
//! 1. returns [elementwise](@ref glossary_elementwise) true if and only if the element value is
//! [denormal](https://mathworld.wolfram.com/SubnormalNumber.html).
//! 2. always return `false`.
//! 3. [The operation is performed conditionnaly](@ref conditional).
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/is_denormal.cpp}
//!
//! @groupheader{Semantic Modifiers}
//!
//! * Masked Call
//!
//! The call `eve;::is_denormal[mask](x)` provides a masked version
//! of `eve::is_denormal` which is
//! equivalent to `if_else (mask, is_denormal(x), eve::false( eve::as(x)))`.
//!
//! @}
//================================================================================================
inline constexpr auto is_denormal = functor<is_denormal_t>;
Expand Down
66 changes: 30 additions & 36 deletions include/eve/module/core/regular/is_equal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ namespace eve
//! @addtogroup core_predicates
//! @{
//! @var is_equal
//! @brief Returns a logical true if and only if the element values are equal.
//! @brief `elementwise callable` returning a logical true if and only if the element values are equal.
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand All @@ -57,53 +57,47 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T, eve::value U >
//! auto is_equal(T x, U y) noexcept;
//! // Regular overload
//! constexpr auto is_equal(value auto x, value auto y) noexcept; // 1
//!
//! // Lanes masking
//! constexpr auto is_equal[conditional_expr auto c](value auto x, value auto y) noexcept; // 2
//! constexpr auto is_equal[logical_value auto m](value auto x, value auto y) noexcept; // 2
//!
//! // Semantic option
//! constexpr auto is_equal[numeric](/*any of the above overloads*/) noexcept; // 3
//! constexpr auto is_equal[almost](/*any of the above overloads*/) noexcept; // 4
//! constexpr auto is_equal[almost = tol](/*any of the above overloads*/) noexcept; // 4
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x`, `y` : arguments
//! * `x`, `y`: [arguments](@ref eve::value).
//! * `c`: [Conditional expression](@ref conditional_expr) masking the operation.
//! * `m`: [Logical value](@ref logical) masking the operation.
//! * `tol`: [scalar value](@ref value) tolerance.
//!
//! **Return value**
//!
//! Returns the logical value containing the [elementwise](@ref glossary_elementwise) equality
//! test result between `x` and `y`. The infix notation `x == y` can also be used.
//!
//! @note
//! Although the infix notation with `==` is supported, the `==` operator on
//! 1. Returns the logical value containing the [elementwise](@ref glossary_elementwise) equality
//! test result between `x` and `y`. The infix notation `x == y` can also be used.
//! 2. [The operation is performed conditionnaly](@ref conditional).
//! 3. The expression `is_equal[numeric](x,y)` considers that `Nan` values are equal.
//! 4. The expression `is_equal[almost = tol](x, y)` where `x` and `y` must be
//! floating point values, evaluates to true if and only if `x` is almost equal to `y`.
//! This means that:
//! - if `tol` is a floating value then \f$|x - y| \le \mbox{tol}\cdot \max(|x|, |y|)\f$
//! - if `tol` is a positive integral value then there are not more than `tol` values of the type
//! of `x` representable in the interval \f$[x, y[\f$.
//! - if `tol` is omitted then the tolerance `tol` default to `3*eps(as(x))`.
//!
//! @note Although the infix notation with `==` is supported, the `==` operator on
//! standard scalar types is the original one and so returns bool result, not `eve::logical`.
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/is_equal.cpp}
//!
//! @groupheader{Semantic Modifiers}
//!
//! * Masked Call
//!
//! The call `eve::is_equal[mask](x)` provides a masked version of `eve::is_equal` which is
//! equivalent to `if_else (mask, is_equal(x, y), false_)
//!
//! * eve::numeric
//!
//! The expression `is_equal[numeric](x,y)` considers that Nan values are equal.
//!
//! * `tolerance`
//!
//! The expression `is_equal[tolerance = t)(x, y)` where `x` and `y` must be floating point values,
//! evals to true if and only if `x` is almost equal to `y`.
//! This means that:
//!
//! - if `t` is a floating_value then the relative error of confusing is `x` and `y` is less
//! than `t` \f$(|x-y| \le t \max(|x|, |y|))\f$.
//! - if `t` is a positive integral_value then there are not more than `t` values of the type
//! of `x` representable in the interval \f$[x,y[\f$.
//! - the call `is_equal[tolerant](x, y)` takes tol as 3 times
//! the machine \f$\epsilon\f$ in the `x` type (`3*eps(as(x))`).
//! - t must be a scalar value.
//!
//! @}
//================================================================================================
inline constexpr auto is_equal = functor<is_equal_t>;
Expand Down
Loading

0 comments on commit 33f81a5

Please sign in to comment.