kyosu v0.1.0
Complex Without Complexes
 
Loading...
Searching...
No Matches

◆ minabs

kyosu::minabs = eve::functor<minabs_t>
inlineconstexpr

Callable object computing the minabs operation.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
//regular call
template<typename ... Ts> auto minabs(Ts ... zs ) const noexcept// 1
template<typename Tup> auto minabs(kumi::tuple Tup ) const noexcept// 2
// Semantic modifyiers
auto minabs[raw](/* any previous overload*/) noexcept; // 3
auto minabs[numeric](/* any previous overload*/) noexcept; // 4
auto minabs[pedantic](/* any previous overload*/) noexcept; // 5
auto minabs[flat](/* any previous overload*/) noexcept; // 6
}
constexpr auto minabs
Callable object computing the minabs operation.
Definition: minabs.hpp:81
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • zi...: cayley_dickson_like values to process.
  • tup: tuple of cayley_dickson_like values to process.

Return value

  1. Returns elementwise the square root minimum of the squared absolute values of the parameters. 2 Same as 1, but the parameters are from the tuple
  2. With the raw option no provision is made to enhance accuracy and avoid overflows
  3. Returns elementwise the numeric minimum of the absolute values of the parameters.
  4. Returns elementwise the pedantic minimum of the absolute values of the parameters.
  5. Returns elementwise the minimum of the absolute values of the elements of each parameters. Generally it's not what you want.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using e_t = float;
using we_t = eve::wide<float, eve::fixed<2>>;
using wc_t = eve::wide<kyosu::complex_t<float>, eve::fixed<2>>;
using wq_t = eve::wide<kyosu::quaternion_t<float>, eve::fixed<2>>;
std::cout << "Real: "<< "\n";
e_t e0(1);
e_t e1(2);
std::cout << e0 << ", " << e1 << " -> " << minabs(e0, e1) << "\n";
we_t we0(e0);
we_t we1(e1);
std::cout << we0 << ", " << we1 << " -> " << minabs(we0, we1) << "\n";
std::cout << "Complex: "<< "\n";
c_t c0(5);
c_t c1(5, 9);
std::cout << c0 << ", " << c1 << " -> " << minabs(c0, c1) << "\n";
wc_t wc0(c0);
wc_t wc1(c1);
std::cout << wc0 << ", " << wc1 << " -> " << minabs(wc0, wc1) << "\n";
std::cout << "Quaternion: "<< "\n";
q_t q0(5, 2, 3);
q_t q1(5, 9, 6, 7);
std::cout << q0 << ", " << q1 << " -> " << minabs(q0, q1) << "\n";
wq_t wq0(q0);
wq_t wq1(q1);
std::cout << wq0 << ", " << wq1 << " -> " << minabs(wq0, wq1) << "\n";
return 0;
}
as_cayley_dickson_n_t< 4, T > quaternion_t
Type alias for quaternion numbers.
Definition: quaternion.hpp:24
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition: complex.hpp:27