Skip to content

Commit

Permalink
Documentation for N functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlap committed Jul 7, 2024
1 parent 33f81a5 commit adee0d7
Show file tree
Hide file tree
Showing 16 changed files with 295 additions and 299 deletions.
2 changes: 1 addition & 1 deletion include/eve/module/core/regular/ceil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace eve
//! @addtogroup core_arithmetic
//! @{
//! @var ceil
//! @brief `elementwise_callable` object computing the smallest integer not less than the input.
//! @brief `strict_elementwise_callable` object computing the smallest integer not less than the input.
//!
//! **Defined in Header**
//!
Expand Down
18 changes: 12 additions & 6 deletions include/eve/module/core/regular/nb_values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace eve
//! @addtogroup core_internal
//! @{
//! @var nb_values
//! @brief Computes the number of values representable in the type between the
//! @brief `elementwise_callable` object computing the number of values representable in the type between the
//! [arguments](@ref eve::value).
//!
//! **Defined in Header**
Expand All @@ -47,21 +47,27 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T, eve::value U >
//! as_integer_t<common_value_t<T, U>, unsigned> nb_values(T x, T y) noexcept;
//! // Regular overloads
//! constexpr auto nb_values(eve::value auto x, eve::value auto y) noexcept; // 1
//!
//! // Lanes masking
//! constexpr auto nb_values[conditional_expr auto c](eve::value auto x, eve::value auto y) noexcept; // 2
//! constexpr auto nb_values[logical_value auto m](eve::value auto x, eve::value auto y) noexcept; // 2
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x`, `y`: [arguments](@ref eve::value).
//! * `x`, `y`: [values](@ref value).
//! * `c`: [Conditional expression](@ref conditional_expr) masking the operation.
//! * `m`: [Logical value](@ref logical) masking the operation.
//!
//! **Return value**
//!
//! Returns the number of values representable in the type in the interval `[x, y[`
//! 1. Returns the number of values representable in the type in the interval `[x, y[`
//! 2. [The operation is performed conditionnaly](@ref conditional).
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/nb_values.cpp}
//================================================================================================
inline constexpr auto nb_values = functor<nb_values_t>;
Expand Down
43 changes: 20 additions & 23 deletions include/eve/module/core/regular/nearest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ namespace eve
//! @addtogroup core_arithmetic
//! @{
//! @var nearest
//! @brief Computes the nearest integer to the input.
//! @brief `strict_elementwise_callable` object computing the nearest integer to the input.
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand All @@ -48,36 +48,33 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T >
//! T nearest(T x) noexcept;
//! // Regular overload
//! constexpr auto nearest(value auto x) noexcept; // 1
//!
//! // Lanes masking
//! constexpr auto nearest[conditional_expr auto c](value auto x) noexcept; // 2
//! constexpr auto nearest[logical_value auto m](value auto x) noexcept; // 2
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x` : [real](@ref eve::value) argument.
//!
//! **Return value**
//! * `x` :[value](@ref value) argument.
//! * `c`: [Conditional expression](@ref conditional_expr) masking the operation.
//! * `m`: [Logical value](@ref logical) masking the operation.
//! * `tol' [scalar_value](@ref value) tolerance.
//!
//! Computes [elementwise](@ref glossary_elementwise) the integer nearest to `x`.
//! **Return value**
//!
//! If `x` is an exact half-integer the rounding is made to the nearest even integer.
//!
//! The standard proposes 4 rounding modes namely: `FE_TONEAREST`, `FE_DOWNWARD`, `FE_UPWARD`,
//! `FE_TOWARDZERO`. This function object implements the `FE_TONEAREST` version.
//! 1. the integer nearest to `x`. If `x` is an exact half-integer the rounding is made to the
//! nearest even integer.The smallest integer not less than `x`.
//! The standard proposes 4 rounding modes namely: `FE_TONEAREST`, `FE_DOWNWARD`, `FE_UPWARD`,
//! `FE_TOWARDZERO`. This function object implements the `FE_TONEAREST` version.
//! 2. [The operation is performed conditionnaly](@ref conditional).
//!
//! @groupheader{External references}
//! * [C++ standard reference](https://en.cppreference.com/w/cpp/numeric/math/round)
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/nearest.cpp}
//!
//! @groupheader{Semantic Modifiers}
//!
//! * Masked Call
//!
//! The call `eve;::nearest[mask](x)` provides a masked version of `eve::nearest` which is
//! equivalent to `if_else (mask, nearest(x), x)`.
//!
//! @}
//================================================================================================
inline constexpr auto nearest = functor<nearest_t>;
Expand Down
58 changes: 30 additions & 28 deletions include/eve/module/core/regular/negabsmax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ namespace eve
EVE_CALLABLE_OBJECT(negabsmax_t, negabsmax_);
};


//================================================================================================
//! @addtogroup core_arithmetic
//! @{
//! @var negabsmax
//! @brief Computes the negated absolute value of the maximal element
//!
//! This is equivalent to -eve::abs ( eve::max(...) ). but can be subject to optimizations.
//! @brief `tuple_callable` computing the absolute value of the maximal element.
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand All @@ -52,43 +51,46 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T, eve::value... Ts>
//! eve::common_value_t<T, Ts ...> negabsmax( T x, Ts ... xs ) noexcept;
//! // Regular overloads
//! constexpr auto negabsmax(eve::value auto x, eve::value auto ... xs) noexcept; // 1
//! constexpr auto negabsmax(kumi::non_empty_product_type auto const& tup) noexcept; // 2
//!
//! // Lanes masking
//! constexpr auto negabsmax[conditional_expr auto c](/* any of the above overloads */) noexcept; // 3
//! constexpr auto negabsmax[logical_value auto m](/* any of the above overloads */) noexcept; // 3
//!
//! // Semantic option
//! constexpr auto negabsmax[saturated](/* any of the above overloads */) noexcept; // 4
//!
//! // Exclusive Semantic options - Only one of those can be set at once
//! constexpr auto negabsmax[pedantic](/* any of the above overloads */) noexcept; // 5.1
//! constexpr auto negabsmax[numeric ](/* any of the above overloads */) noexcept; // 5.2
//! }
//! @endcode
//!
//!
//! **Parameters**
//!
//! * `x`, `...xs`: [arguments](@ref eve::value).
//! * `x`, `...xs`: [real](@ref value) arguments.
//! * `tup`: [non empty tuple](@ref kumi::non_empty_product_type) of arguments.
//! * `c`: [Conditional expression](@ref conditional_expr) masking the operation.
//! * `m`: [Logical value](@ref logical) masking the operation.
//!
//! **Return value**
//!
//! The negated absolute value of the maximal element
//! is returned.
//!
//! @note
//! If any element of the inputs is a NaN,
//! the corresponding output element is system-dependent.
//! The negated absolute value of the maximal element is returned.
//! 1. If any element of the inputs is a NaN the corresponding output element is system-dependent
//! 2. equivalent to the call on the elements of the tuple.
//! 3. [The operation is performed conditionnaly](@ref conditional)
//! 4. computation internally uses `abs[saturated]` instead of `abs`
//! 5. with `numeric` (resp. `pedantic`) `max[numeric]` (5.1) (resp. `max[pedantic]` (5.2))
//! is used internally
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/negabsmax.cpp}
//!
//! @groupheader{Semantic Modifiers}
//!
//! * Masked Call
//!
//! The call `eve::negabsmax[mask](x, ...)` provides a masked version of `eve::negabsmax` which
//! is equivalent to `eve::if_else (mask, negabsmax(x, ...), x)`
//!
//! * eve::pedantic, eve::numeric
//!
//! The call `d(eve::negabsmax)(...)`, where d is one of these two decorators, is equivalent to
//! `-eve::abs (d( eve::max )(...))`.
//!
//! @}
//================================================================================================
inline constexpr auto negabsmax = functor<negabsmax_t>;
inline constexpr auto negabsmax = functor<negabsmax_t>;
}

#include <eve/module/core/regular/impl/negabsmax.hpp>
Expand Down
54 changes: 28 additions & 26 deletions include/eve/module/core/regular/negabsmin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ namespace eve
//! @addtogroup core_arithmetic
//! @{
//! @var negabsmin
//! @brief Computes the negated absolute value of the minimal element
//! @brief `tuple_callable` computing the absolute value of the minimal element.
//!
//! This is equivalent to -eve::abs ( eve::min(...) ). but can be subject to optimizations.
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand All @@ -52,43 +50,47 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T, eve::value... Ts>
//! eve::common_value_t<T, Ts ...> negabsmin( T x, Ts ... xs ) noexcept;
//! // Regular overloads
//! constexpr auto negabsmin(eve::value auto x, eve::value auto ... xs) noexcept; // 1
//! constexpr auto negabsmin(kumi::non_empty_product_type auto const& tup) noexcept; // 2
//!
//! // Lanes masking
//! constexpr auto negabsmin[conditional_expr auto c](/* any of the above overloads */) noexcept; // 3
//! constexpr auto negabsmin[logical_value auto m](/* any of the above overloads */) noexcept; // 3
//!
//! // Semantic options
//! constexpr auto negabsmin[saturated](/* any of the above overloads */) noexcept; // 4
//!
//! // Exclusive Semantic options - Only one of those can be set at once
//! constexpr auto negabsmin[pedantic](/* any of the above overloads */) noexcept; // 5.1
//! constexpr auto negabsmin[numeric ](/* any of the above overloads */) noexcept; // 5.2
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x`, `...xs`: [arguments](@ref eve::value).
//! * `x`, `...xs`: [real](@ref value) arguments.
//! * `tup`: [non empty tuple](@ref kumi::non_empty_product_type) of arguments.
//! * `c`: [Conditional expression](@ref conditional_expr) masking the operation.
//! * `m`: [Logical value](@ref logical) masking the operation.
//!
//! **Return value**
//!
//! The negated absolute value of the minimal element
//! is returned.
//!
//! @note
//! If any element of the inputs is a NaN,
//! the corresponding output element is system-dependent.
//! The negated absolute value of the minimal element is returned.
//! 1. If any element of the inputs is a NaN the corresponding output element is system-dependent
//! 2. equivalent to the call on the elements of the tuple.
//! 3. [The operation is performed conditionnaly](@ref conditional)
//! 4. computation internally uses `abs[saturated]` instead of `abs`
//! 5. with `numeric` (resp. `pedantic`) `min[numeric]` (5.1) (resp. `min[pedantic]` (5.2))
//! is used internally
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/negabsmin.cpp}
//!
//! @groupheader{Semantic Modifiers}
//!
//! * Masked Call
//!
//! The call `eve::negabsmin[mask](x, ...)` provides a masked version of `eve::negabsmin` which
//! is equivalent to `eve::if_else (mask, negabsmin(x, ...), x)`
//!
//! * eve::pedantic, eve::numeric
//!
//! The call `d(eve::negabsmin)(...)`, where d is one of these two decorators, is equivalent to
//! `-eve::abs (d( eve::min )(...))`.
//!
//! @}
//================================================================================================
inline constexpr auto negabsmin = functor<negabsmin_t>;
inline constexpr auto negabsmin = functor<negabsmin_t>;
}

#include <eve/module/core/regular/impl/negabsmin.hpp>
Expand Down
31 changes: 15 additions & 16 deletions include/eve/module/core/regular/negate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace eve
{
template<typename Options>
struct negate_t : elementwise_callable<negate_t, Options, raw_option>
struct negate_t : elementwise_callable<negate_t, Options>
{
template<value T, value U>
requires(eve::same_lanes_or_scalar<T, U>)
Expand All @@ -28,10 +28,10 @@ namespace eve
//! @addtogroup core_arithmetic
//! @{
//! @var negate
//! @brief Computes the [elementwise](@ref glossary_elementwise) product of the first parameter
//! @brief `elementwise_callable` object computing the product of the first parameter
//! by the sign of the second.
//!
//! **Defined in Header**
//! @groupheader{Header file}
//!
//! @code
//! #include <eve/module/core.hpp>
Expand All @@ -42,31 +42,30 @@ namespace eve
//! @code
//! namespace eve
//! {
//! template< eve::value T, eve::value U >
//! eve::common_value_t<T, U> negate(T x, U y) noexcept;
//! // Regular overload
//! constexpr auto negate(value auto x, value auto y) noexcept; // 1
//!
//! // Lanes masking
//! constexpr auto negate[conditional_expr auto c](value auto x, value auto y) noexcept; // 2
//! constexpr auto negate[logical_value auto m](value auto , value auto yx) noexcept; // 2
//! }
//! @endcode
//!
//! **Parameters**
//!
//! * `x`, `y`: [arguments](@ref eve::value).
//! * `tup`: [non empty tuple](@ref kumi::non_empty_product_type) of arguments.
//! * `c`: [Conditional expression](@ref conditional_expr) masking the operation.
//! * `m`: [Logical value](@ref logical) masking the operation.
//!
//! **Return value**
//!
//! The [elementwise](@ref glossary_elementwise) product of the first parameter
//! by the sign of the second is returned.
//! 1. The [elementwise](@ref glossary_elementwise) product of the first parameter
//! by the sign of the second is returned.
//! 2. [The operation is performed conditionnaly](@ref conditional)
//!
//! @groupheader{Example}
//!
//! @godbolt{doc/core/negate.cpp}
//!
//! @groupheader{Semantic Modifiers}
//!
//! * Masked Call
//!
//! The call `eve::negate[mask](x, ...)` provides a masked
//! version of `negate` which is equivalent to `if_else(mask, negate(x, ...), x)`
//!
//! @}
//================================================================================================
inline constexpr auto negate = functor<negate_t>;
Expand Down
Loading

0 comments on commit adee0d7

Please sign in to comment.