E.V.E
v2023.02.15
Loading...
Searching...
No Matches

Detailed Description

These functions allows performing hyperbolic computations

Variables

constexpr auto eve::cosh = functor<cosh_t>
 elementwise_callable object computing the hyperbolic cosine: \(\frac{e^x+e^{-x}}2\).
constexpr auto eve::coth = functor<coth_t>
 elementwise_callable object computing the hyperbolic cotangent: \(\frac{e^x+e^{-x}}{e^x-e^{-x}}\).
constexpr auto eve::csch = functor<csch_t>
 elementwise_callable object computing \(\frac2{e^x+e^{-x}}\).
constexpr auto eve::gd = functor<gd_t>
 elementwise_callable object computing the gudermanian gd: \(\int_0^\infty 1/\cosh x dx\).
constexpr auto eve::sech = functor<sech_t>
 elementwise_callable object computing \(\frac2{e^x-e^{-x}}\).
constexpr auto eve::sinh = functor<sinh_t>
 elementwise_callable object computing \(\frac{e^x-e^{-x}}2\).
constexpr auto eve::sinhc = functor<sinhc_t>
 elementwise_callable object computing \(\frac{e^x-e^{-x}}{2x}\).
constexpr auto eve::sinhcosh = functor<sinhcosh_t>
 Callable object performing the simultaneous computations of the hyperbolic sine and cosine.
constexpr auto eve::tanh = functor<tanh_t>
 elementwise_callable object computing \(\frac{e^x-e^{-x}}{e^x+e^{-x}}\).

Variable Documentation

◆ cosh

auto eve::cosh = functor<cosh_t>
inlineconstexpr

elementwise_callable object computing the hyperbolic cosine: \(\frac{e^x+e^{-x}}2\).

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto cosh(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto cosh[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto cosh[logical_value auto m](floating_value auto x) noexcept; // 2
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:134
constexpr auto cosh
elementwise_callable object computing the hyperbolic cosine: .
Definition cosh.hpp:78
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  1. Returns the elementwise hyperbolic cosine of the input. In particular:
    • If the element is \(\pm0\), \(1\) is returned.
    • If the element is \(\pm\infty\), \(+\infty\) is returned.
    • If the element is a NaN, NaN is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0, 0.25, 0.5, 2.0, -0.0, -0.25,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> cosh(wf) = " << eve::cosh(wf) << "\n";
std::cout << "-> cosh[ignore_last(2)](wf)= " << eve::cosh[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> cosh[wf > 0.0](wf) = " << eve::cosh[wf > 0.0](wf) << "\n";
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition nan.hpp:67
constexpr auto minf
Computes the -infinity ieee value.
Definition minf.hpp:67
Lightweight type-wrapper.
Definition as.hpp:29
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:361
Wrapper for SIMD registers.
Definition wide.hpp:94

◆ coth

auto eve::coth = functor<coth_t>
inlineconstexpr

elementwise_callable object computing the hyperbolic cotangent: \(\frac{e^x+e^{-x}}{e^x-e^{-x}}\).

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto coth(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto coth[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto coth[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto coth
elementwise_callable object computing the hyperbolic cotangent: .
Definition coth.hpp:75

Parameters

Return value

  1. Returns the elementwise hyperbolic cotangent of the input. In particular:
    • If the element is \(\pm0\), \(\pm\infty\) is returned.
    • If the element is \(\pm\infty\), \(\pm1\) is returned.
    • If the element is a NaN, NaN is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0, 1.0, 2.0, -0.0, -1.0, -2.0,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> coth(wf) = " << eve::coth(wf) << "\n";
std::cout << "-> coth[ignore_last(2)](wf)= " << eve::coth[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> coth[wf != -2.0f](wf) = " << eve::coth[wf != -2.0f](wf) << "\n";
}
constexpr auto inf
Computes the infinity ieee value.
Definition inf.hpp:67

◆ csch

auto eve::csch = functor<csch_t>
inlineconstexpr

elementwise_callable object computing \(\frac2{e^x+e^{-x}}\).

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto csch(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto csch[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto csch[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto csch
elementwise_callable object computing .
Definition csch.hpp:76

Parameters

Return value

  1. Returns the elementwise hyperbolic cosecant of the input. In particular:
    • If the element is \(\pm0\), \(\pm\infty\) is returned.
    • If the element is \(\pm\infty\), \(\pm0\) is returned.
    • If the element is a NaN, NaN is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0, 0.25, 0.5, 2.0, -0.0, -0.25,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> csch(wf) = " << eve::csch(wf) << "\n";
std::cout << "-> csch[ignore_last(2)](wf)= " << eve::csch[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> csch[wf > 0.0](wf) = " << eve::csch[wf > 0.0](wf) << "\n";
}

◆ gd

auto eve::gd = functor<gd_t>
inlineconstexpr

elementwise_callable object computing the gudermanian gd: \(\int_0^\infty 1/\cosh x dx\).

  1. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide<float> wf = [](auto i, auto c) { return 2.f*(i-c/2);};
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> gd(wf) = " << eve::gd(wf) << "\n";
std::cout << "-> gd[ignore_last(2)](wf)= " << eve::gd[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> gd[wf != -2.0](wf) = " << eve::gd[wf != -2.0](wf) << "\n";
}
constexpr auto gd
elementwise_callable object computing the gudermanian gd: .
Definition gd.hpp:83

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto gd(floating_value auto x) noexcept; // 1
// Semantic option
constexpr auto gd[raw](floating_value auto x) noexcept; // 2
constexpr auto gd[fast] (floating_value auto x) noexcept; // 2
// Lanes masking
constexpr auto gd[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto gd[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto raw
Performs the operation minimally, trading accuracy for speed.
Definition core.hpp:95
constexpr auto fast
Performs the operation faster than the regular call while keeping more accuracy than raw.
Definition core.hpp:79

Parameters

Return value

  1. Returns the elementwise gudermanian of the input. In particular:
    • If the element is \(\pm0\), \(0\) is returned.
    • If the element is \(\pm\infty\), \(\pm\pi/2\) is returned.
    • If the element is a NaN, NaN is returned.
  2. The raw and fast options use internally less accuate but faster versions.

◆ sech

auto eve::sech = functor<sech_t>
inlineconstexpr

elementwise_callable object computing \(\frac2{e^x-e^{-x}}\).

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto sech(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto sech[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto sech[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto sech
elementwise_callable object computing .
Definition sech.hpp:78

Parameters

 * `x`: [floating value](@ref eve::floating_value).
 * `c`: [Conditional expression](@ref eve::conditional_expr) masking the operation.
 * `m`: [Logical value](@ref eve::logical_value) masking the operation.

Return value

  1. Returns the elementwise hyperbolic secant of the input. In particular:
    • If the element is \(\pm0\), 1 is returned.
    • If the element is \(\pm\infty\), \(+0\) is returned.
    • If the element is a NaN, NaN is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0, 0.25, 0.5, 2.0, -0.0, -0.25,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> sech(wf) = " << eve::sech(wf) << "\n";
std::cout << "-> sech[ignore_last(2)](wf)= " << eve::sech[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> sech[wf > 0.0](wf) = " << eve::sech[wf > 0.0](wf) << "\n";
}

◆ sinh

auto eve::sinh = functor<sinh_t>
inlineconstexpr

elementwise_callable object computing \(\frac{e^x-e^{-x}}2\).

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto sinh(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto sinh[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto sinh[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto sinh
elementwise_callable object computing .
Definition sinh.hpp:79

Parameters

 * `x`: [floating value](@ref eve::floating_value).
 * `c`: [Conditional expression](@ref eve::conditional_expr) masking the operation.
 * `m`: [Logical value](@ref eve::logical_value) masking the operation.

Return value

  1. Returns the elementwise hyperbolic sine of the input. In particular:
    • If the element is \(\pm0\), \(\pm0\) is returned.
    • If the element is \(\pm\infty\), \(\pm\infty\) returned.
    • If the element is a NaN, NaN is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0, 0.25, 0.5, 2.0, -0.0, -0.25,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> sinh(wf) = " << eve::sinh(wf) << "\n";
std::cout << "-> sinh[ignore_last(2)](wf)= " << eve::sinh[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> sinh[wf != -2.0f](wf) = " << eve::sinh[wf != -2.0f](wf) << "\n";
{
float const nan = std::numeric_limits<float>::quiet_NaN();
float buf[8] = {10.f, 0.f, -0.f, nan, 0.5f, 0.5f, 0.5f, 0.5f};
eve::wide<float> a{&buf[0]};
std::cout<<a<<std::endl;
auto r = eve::sinh(a);
std::cout << r << "\n";
}
{
float buf[8] = {10.f, 0.f, -0.f, 0.f, 0.5f, 0.5f, 0.5f, 0.5f};
eve::wide<float> a{&buf[0]};
std::cout<<a<<std::endl;
auto r = eve::sinh(a);
std::cout << r << "\n";
}
}

◆ sinhc

auto eve::sinhc = functor<sinhc_t>
inlineconstexpr

elementwise_callable object computing \(\frac{e^x-e^{-x}}{2x}\).

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto sinhc(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto sinhc[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto sinhc[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto sinhc
elementwise_callable object computing .
Definition sinhc.hpp:76

Parameters

x: floating value.

Return value

  1. Returns the elementwise hyperbolic sine of the input divided by the input. In particular:
    • If the element is \(\pm0\), \(1\) is returned.
    • If the element is \(\pm\infty\), \(\pm\infty\) is returned.
    • If the element is a Nan, NaN is returned.
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0, 1.5, 2.0, 20.25, -10.0, -2.0,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> sinhc(wf) = " << eve::sinhc(wf) << "\n";
std::cout << "-> sinhc[ignore_last(2)](wf)= " << eve::sinhc[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> sinhc[wf != -2.0f](wf) = " << eve::sinhc[wf != -2.0f](wf) << "\n";
}

◆ sinhcosh

auto eve::sinhcosh = functor<sinhcosh_t>
inlineconstexpr

Callable object performing the simultaneous computations of the hyperbolic sine and cosine.

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto sinhcosh(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto sinhcosh[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto sinhcosh[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto sinhcosh
Callable object performing the simultaneous computations of the hyperbolic sine and cosine.
Definition sinhcosh.hpp:81

Parameters

 * `x`: [floating value](@ref eve::floating_value).
 * `c`: [Conditional expression](@ref eve::conditional_expr) masking the operation.
 * `m`: [Logical value](@ref eve::logical_value) masking the operation.

}

Return value

1 .The computation returns a tuple-like whose elements are sinh(x) and cosh(x)

  1. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0, 0.25, 0.5, 2.0, -0.0, -0.25,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> sinhcosh(wf) = " << eve::sinhcosh(wf) << "\n";
}

◆ tanh

auto eve::tanh = functor<tanh_t>
inlineconstexpr

elementwise_callable object computing \(\frac{e^x-e^{-x}}{e^x+e^{-x}}\).

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto tanh(floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto tanh[conditional_expr auto c](floating_value auto x) noexcept; // 2
constexpr auto tanh[logical_value auto m](floating_value auto x) noexcept; // 2
}
constexpr auto tanh
elementwise_callable object computing .
Definition tanh.hpp:76

Parameters

Return value

  1. Returns the elementwise hyperbolic tangent of the input. In particular:
    • If the element is \(\pm0\), \(\pm0\) is returned.
    • If the element is \(\pm\infty\), \(\pm1\) returned.
    • If the element is a NaN, NaN is returned.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = {0.0, 0.25, 0.5, 2.0, -0.0, -0.25,
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> tanh(wf) = " << eve::tanh(wf) << "\n";
std::cout << "-> tanh[ignore_last(2)](wf)= " << eve::tanh[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> tanh[wf != -2.0f](wf) = " << eve::tanh[wf != -2.0f](wf) << "\n";
}