MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::functor::scalar::signum< T > Struct Template Reference

#include <signum.hpp>

Public Types

using result_type = T

Public Member Functions

constexpr result_type operator() (const T &v) const

Static Public Member Functions

static constexpr result_type apply (const T &v)
 1, -1 or 0.

Member Typedef Documentation

◆ result_type

template<typename T>
using mtl::functor::scalar::signum< T >::result_type = T

Member Function Documentation

◆ apply()

template<typename T>
constexpr result_type mtl::functor::scalar::signum< T >::apply ( const T & v)
inlinestaticconstexpr

1, -1 or 0.

An unsigned value is never negative, and T{-1} would not even compile for it. A NaN is returned as is, as NumPy's sign does, rather than reported as 0 (#838).

◆ operator()()

template<typename T>
result_type mtl::functor::scalar::signum< T >::operator() ( const T & v) const
inlineconstexpr

The documentation for this struct was generated from the following file:
  • /home/runner/work/mtl5/mtl5/include/mtl/functor/scalar/signum.hpp