OpenKalman
Namespaces | Classes | Typedefs | Functions | Variables
OpenKalman::values Namespace Reference

Definition for values::abs. More...

Namespaces

 internal
 Definition of utilities for atan functions.
 

Classes

struct  constant_coefficient
 The constant associated with T, assuming T is a constant_matrix. More...
 
struct  constant_coefficient< T, std::enable_if_t< indexible< T > and detail::has_static_constant< T > > >
 
struct  constant_coefficient< T, std::enable_if_t<(values::dynamic< typename interface::get_constant_return_type< T >::type > or one_dimensional< T >) and(not detail::has_static_constant< T >)> >
 
struct  constant_diagonal_coefficient
 The constant associated with T, assuming T is a constant_diagonal_matrix. More...
 
struct  constant_diagonal_coefficient< T, std::enable_if_t< indexible< T > and detail::has_static_constant_diagonal< T > > >
 
struct  constant_diagonal_coefficient< T, std::enable_if_t< indexible< T > and(not detail::has_static_constant_diagonal< T >) and(values::dynamic< typename interface::get_constant_diagonal_return_type< T >::type > or one_dimensional< T >)> >
 
struct  Fixed
 
struct  fixed_2pi
 A fixed version of 2*pi. More...
 
struct  fixed_half_pi
 A fixed version of pi/2. More...
 
struct  fixed_minus_half_pi
 A fixed version of -pi/2. More...
 
struct  fixed_minus_pi
 A fixed version of -pi. More...
 
struct  fixed_number_of
 The fixed number associated with a values::fixed. More...
 
struct  fixed_number_of< T, std::enable_if_t< values::fixed< T > > >
 
struct  fixed_pi
 A fixed version of pi. More...
 
struct  operation
 An operation involving some number of values. More...
 

Typedefs

template<typename T , std::enable_if_t< values::value< T >, int > = 0>
using number_type_of_t = std::decay_t< decltype(values::to_number(std::declval< T >()))>
 Obtain the values::number type associated with avalues::value.
 
template<typename T , std::enable_if_t< value< T >, int > = 0>
using real_type_of_t = std::decay_t< decltype(values::real(std::declval< T >()))>
 Obtain the real type associated with a number (typically a values::complex number. More...
 

Functions

template<typename T >
 constant_coefficient (const T &) -> constant_coefficient< T >
 Deduction guide for constant_coefficient.
 
template<typename T >
 constant_diagonal_coefficient (T &&) -> constant_diagonal_coefficient< std::decay_t< T >>
 Deduction guide for constant_diagonal_coefficient.
 
template<typename T , std::enable_if_t< values::fixed< T >, int > = 0>
 Fixed (const T &) -> Fixed< std::decay_t< T >>
 
template<typename Operation , typename... Args>
 operation (const Operation &, const Args &...) -> operation< Operation, Args... >
 Deduction guide.
 
template<typename T , typename Arg , std::enable_if_t< values::number< T > and values::value< Arg >, int > = 0>
decltype(auto) constexpr cast_to (Arg &&arg)
 
template<typename Arg >
constexpr auto to_number (Arg arg)
 Convert any values::value to a values::number.
 
template<typename Arg , std::enable_if_t< value< Arg >, int > = 0>
constexpr Arg && operator+ (Arg &&arg)
 
template<typename Arg , std::enable_if_t< value< Arg >, int > = 0>
constexpr auto operator- (Arg arg)
 
template<typename Arg1 , typename Arg2 , std::enable_if_t< detail::value_common_with< Arg1, Arg2 > and std::is_invocable< std::plus< detail::binary_common_type_t< Arg1, Arg2 >>, Arg1 &&, Arg2 &&>::value, int > = 0>
constexpr auto operator+ (Arg1 arg1, Arg2 arg2)
 
template<typename Arg1 , typename Arg2 , std::enable_if_t< detail::value_common_with< Arg1, Arg2 > and std::is_invocable< std::minus< detail::binary_common_type_t< Arg1, Arg2 >>, Arg1 &&, Arg2 &&>::value, int > = 0>
constexpr auto operator- (Arg1 arg1, Arg2 arg2)
 
template<typename Arg1 , typename Arg2 , std::enable_if_t< detail::value_common_with< Arg1, Arg2 > and std::is_invocable< std::multiplies< detail::binary_common_type_t< Arg1, Arg2 >>, Arg1 &&, Arg2 &&>::value, int > = 0>
constexpr auto operator* (Arg1 arg1, Arg2 arg2)
 
template<typename Arg1 , typename Arg2 , std::enable_if_t< detail::value_common_with< Arg1, Arg2 > and std::is_invocable< std::divides< detail::binary_common_type_t< Arg1, Arg2 >>, Arg1 &&, Arg2 &&>::value, int > = 0>
constexpr auto operator/ (Arg1 arg1, Arg2 arg2)
 
template<typename A , typename B , std::enable_if_t< detail::value_common_with< A, B > and std::is_invocable< std::equal_to< detail::binary_common_type_t< A, B >>, const A &, const B &>::value, int > = 0>
constexpr bool operator== (const A &a, const B &b)
 
template<typename A , typename B , std::enable_if_t< detail::value_common_with< A, B > and std::is_invocable< std::not_equal_to< detail::binary_common_type_t< A, B >>, const A &, const B &>::value, int > = 0>
constexpr bool operator!= (const A &a, const B &b)
 
template<typename A , typename B , std::enable_if_t< detail::value_common_with< A, B > and std::is_invocable< std::less< detail::binary_common_type_t< A, B >>, const A &, const B &>::value, int > = 0>
constexpr auto operator< (const A &a, const B &b)
 
template<typename A , typename B , std::enable_if_t< detail::value_common_with< A, B > and std::is_invocable< std::greater< detail::binary_common_type_t< A, B >>, const A &, const B &>::value, int > = 0>
constexpr auto operator> (const A &a, const B &b)
 
template<typename A , typename B , std::enable_if_t< detail::value_common_with< A, B > and std::is_invocable< std::less_equal< detail::binary_common_type_t< A, B >>, const A &, const B &>::value, int > = 0>
constexpr auto operator<= (const A &a, const B &b)
 
template<typename A , typename B , std::enable_if_t< detail::value_common_with< A, B > and std::is_invocable< std::greater_equal< detail::binary_common_type_t< A, B >>, const A &, const B &>::value, int > = 0>
constexpr auto operator>= (const A &a, const B &b)
 
template<typename Arg , std::enable_if_t< value< Arg >, int > = 0>
constexpr auto abs (const Arg &arg)
 A constexpr alternative to std::abs.
 
template<typename Arg , std::enable_if_t< value< Arg >, int > = 0>
constexpr auto acos (const Arg &arg)
 Constexpr alternative to the std::acos function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto acosh (const Arg &arg)
 Constexpr alternative to the std::acosh function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto asin (const Arg &arg)
 Constexpr alternative to the std::asin function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto asinh (const Arg &arg)
 Constexpr alternative to the std::asinh function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto atan (const Arg &arg)
 Constexpr alternative to the std::atan function.
 
template<typename Y , typename X , std::enable_if_t< values::value< Y > and values::value< X >, int > = 0>
constexpr auto atan2 (const Y &y_arg, const X &x_arg)
 Constexpr alternative to the std::atan2 function. More...
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto atanh (const Arg &arg)
 Constexpr alternative to the std::atanh function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto conj (const Arg &arg)
 A constexpr function for the complex conjugate of a (complex) number.
 
template<typename Mag , typename Sgn >
constexpr auto copysign (const Mag &mag, const Sgn &sgn)
 A constexpr function for copysign. More...
 
template<typename Arg >
constexpr auto cos (const Arg &arg, std::enable_if_t< values::value< Arg >, int >=0)
 Constexpr alternative to the std::cos function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto cosh (const Arg &arg)
 Constexpr alternative to the std::cosh function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto exp (const Arg &arg)
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto expm1 (const Arg &arg)
 Constexpr alternative to the std::expm1 function (exponential function minus 1). More...
 
template<typename... Args, std::enable_if_t<(... and values::value< Args >) and(sizeof...(Args) > 0>
constexpr auto hypot (const Args &...args)
 A constexpr alternative to std::hypot. More...
 
template<typename Arg , std::enable_if_t< value< Arg >, int > = 0>
constexpr auto imag (Arg arg)
 A constexpr function to obtain the imaginary part of a (complex) number. More...
 
template<typename Arg >
constexpr bool isinf (const Arg &arg)
 Constexpr alternative to std::isinf. More...
 
template<typename Arg >
constexpr bool isnan (const Arg &arg)
 Constexpr alternative to std::isnan. More...
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto log (const Arg &arg)
 Constexpr alternative to the std::log function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto log1p (const Arg &arg)
 Constexpr alternative to the std::log1p function, where log1p(x) = log(x+1). More...
 
template<typename Arg , typename Exponent >
constexpr auto pow (const Arg &arg, const Exponent &exponent)
 
template<typename Arg , std::enable_if_t< value< Arg >, int > = 0>
constexpr auto real (Arg arg)
 A constexpr function to obtain the real part of a (complex) number. More...
 
template<typename Arg , std::enable_if_t< values::value< Arg > and not values::complex< values::number_type_of_t< Arg >>, int > = 0>
constexpr bool signbit (const Arg &arg)
 A constexpr function analogous to std::signbit. More...
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto sin (const Arg &arg)
 Constexpr alternative to the std::sin function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto sinh (const Arg &arg)
 Constexpr alternative to the std::sinh function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto sqrt (const Arg &arg)
 A constexpr alternative to std::sqrt. More...
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto tan (const Arg &arg)
 Constexpr alternative to the std::tan function.
 
template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto tanh (const Arg &arg)
 

Variables

template<typename T >
constexpr auto constant_coefficient_v = constant_coefficient<T>::value
 Helper template for constant_coefficient.
 
template<typename T >
constexpr auto constant_diagonal_coefficient_v = constant_diagonal_coefficient<T>::value
 Helper template for constant_diagonal_coefficient.
 
template<typename T >
constexpr bool complex = detail::complex_impl<std::decay_t<T>>::value
 T is a values::value that reduces to std::complex or a custom complex type.
 
template<typename T >
constexpr bool dynamic
 T is a values::value that is not determinable at compile time. More...
 
template<typename T >
constexpr bool fixed
 T is a values::value that is determinable at compile time. More...
 
template<typename T >
constexpr bool floating
 T is a floating-point values::value. More...
 
template<typename T >
constexpr bool index = values::integral<T> and (detail::number_type_is_unsigned<T>::value or detail::fixed_integral_gt_0<T>::value)
 T is an index value.
 
template<typename T >
constexpr bool integral = values::value<T> and detail::reduces_to_integral<T>::value
 T is an index value.
 
template<typename T >
constexpr bool not_complex
 T is a values::value in which either its type is not a values::complex or its imaginary component is 0. More...
 
template<typename T >
constexpr bool number
 T is a numerical type. More...
 
template<typename T >
constexpr bool size = index<T> or std::is_same_v<std::decay_t<T>, unreachable_sentinel_t>
 T is either an index representing a size, or void which represents that there is no size.
 
template<typename T >
constexpr bool value
 T is numerical value or is reducible to a numerical value. More...
 
template<typename T >
constexpr auto fixed_number_of_v = fixed_number_of<T>::value
 Helper template for fixed_number_of.
 

Detailed Description

Definition for values::abs.

Definition for values::tanh.

Definition for values::tan.

Definition for values::sqrt.

Definition for values::sinh.

Definition for values::sin.

Definition for values::signbit.

Definition for values::pow.

Definition for values::log1p.

Definition for values::log.

Definition for values::isnan.

Definition for values::isinf.

Definition for values::hypot.

Definition for values::expm1.

Definition for values::exp.

Definition for values::cosh.

Definition for values::cos.

Definition for values::copysign.

Definition for values::atanh.

Definition for values::atan2.

Definition for values::atan.

Definition for values::asinh.

Definition for values::asin.

Definition for values::acosh.

Definition for values::acos.

Typedef Documentation

◆ real_type_of_t

template<typename T , std::enable_if_t< value< T >, int > = 0>
using OpenKalman::values::real_type_of_t = typedef std::decay_t<decltype(values::real(std::declval<T>()))>

Obtain the real type associated with a number (typically a values::complex number.

This will be the type of the result of values::real(...).

Function Documentation

◆ atan2()

template<typename Y , typename X , std::enable_if_t< values::value< Y > and values::value< X >, int > = 0>
constexpr auto OpenKalman::values::atan2 ( const Y &  y_arg,
const X &  x_arg 
)

Constexpr alternative to the std::atan2 function.

Unlike the standard function, this one accepts complex arguments.

◆ copysign()

template<typename Mag , typename Sgn >
constexpr auto OpenKalman::values::copysign ( const Mag &  mag,
const Sgn &  sgn 
)

A constexpr function for copysign.

If the compiler offers a constexpr version of std::copysign, it will be called. Otherwise, this function determines the sign of sgn and potentially negates mag.

Note
In most pre-c++23 compilations, this function will be inaccurate if the sgn argument is either -NaN or -0.0. This is because prior to the c++23 standard library, there was no way to determine, at compile time, the sign of either ±NaN or ±0.0.
Parameters
magThe magnitude of the result.
sgnA value reflecting the sign of the result.

◆ expm1()

template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto OpenKalman::values::expm1 ( const Arg &  arg)

Constexpr alternative to the std::expm1 function (exponential function minus 1).

Thus uses a Maclaurin series expansion For floating-point values, or multiplication for integral values.

Note
This function allows a complex argument, even though the C++ standard does not as of at least C++23.

◆ hypot()

template<typename... Args, std::enable_if_t<(... and values::value< Args >) and(sizeof...(Args) > 0>
constexpr auto OpenKalman::values::hypot ( const Args &...  args)

A constexpr alternative to std::hypot.

This version can take one or more parameters (not limited to 2 or 3 as std::hypot is).

◆ imag()

template<typename Arg , std::enable_if_t< value< Arg >, int > = 0>
constexpr auto OpenKalman::values::imag ( Arg  arg)

A constexpr function to obtain the imaginary part of a (complex) number.

If arg is complex, arg must either match std::imag(values::to_number(arg)) or some defined function imag(values::to_number(arg)). If arg is not complex and no imag function is defined, the result will be

  • static_cast<double>(0) if Arg is integral or
  • static_cast<std::decay_t<Arg>>(0) otherwise.

◆ isinf()

template<typename Arg >
constexpr bool OpenKalman::values::isinf ( const Arg &  arg)

Constexpr alternative to std::isinf.

Checks whether the input is positive or negative infinity.

◆ isnan()

template<typename Arg >
constexpr bool OpenKalman::values::isnan ( const Arg &  arg)

Constexpr alternative to std::isnan.

Checks whether the input is not a number (NaN).

◆ log1p()

template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto OpenKalman::values::log1p ( const Arg &  arg)

Constexpr alternative to the std::log1p function, where log1p(x) = log(x+1).

Unlike the standard function, this one accepts complex arguments.

◆ real()

template<typename Arg , std::enable_if_t< value< Arg >, int > = 0>
constexpr auto OpenKalman::values::real ( Arg  arg)

A constexpr function to obtain the real part of a (complex) number.

If arg is complex, arg must either match std::real(values::to_number(arg)) or some defined function real(values::to_number(arg)). If arg is not complex and no real function is defined, the result will be

  • static_cast<double>(std::forward<Arg>(arg)) if Arg is integral or
  • static_cast<std::decay_t<Arg>>(std::forward<Arg>(arg)) otherwise.

◆ signbit()

template<typename Arg , std::enable_if_t< values::value< Arg > and not values::complex< values::number_type_of_t< Arg >>, int > = 0>
constexpr bool OpenKalman::values::signbit ( const Arg &  arg)

A constexpr function analogous to std::signbit.

If the compiler offers a constexpr version of std::signbit, it will be called. Otherwise, the argument will be compared with zero.

Note
In most pre-c++23 compilations, this function will be inaccurate if the argument is either -NaN or -0.0. This is because prior to the c++23 standard library, there was no way to determine, at compile time, the sign of either ±NaN or ±0.0.

◆ sqrt()

template<typename Arg , std::enable_if_t< values::value< Arg >, int > = 0>
constexpr auto OpenKalman::values::sqrt ( const Arg &  arg)

A constexpr alternative to std::sqrt.

Uses the Newton-Raphson method

// Code for a purely integral version: T lo = 0 , hi = x / 2 + 1; while (lo != hi) { const T mid = (lo + hi + 1) / 2; if (x / mid < mid) hi = mid - 1; else lo = mid; } return lo;

Variable Documentation

◆ dynamic

template<typename T >
constexpr bool OpenKalman::values::dynamic
Initial value:
=
(not values::fixed<T>) and (values::number<T> or internal::is_dynamic<std::decay_t<T>>::value)
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31

T is a values::value that is not determinable at compile time.

◆ fixed

template<typename T >
constexpr bool OpenKalman::values::fixed
Initial value:
= std::is_default_constructible_v<std::decay_t<T>> and
(internal::has_value_member<std::decay_t<T>>::value or internal::call_result_is_fixed<std::decay_t<T>>::value)
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31

T is a values::value that is determinable at compile time.

◆ floating

template<typename T >
constexpr bool OpenKalman::values::floating
Initial value:
=
values::value<T> and (not integral<T>) and (not values::complex<T>)

T is a floating-point values::value.

◆ not_complex

template<typename T >
constexpr bool OpenKalman::values::not_complex
Initial value:
=
values::value<T> and (not complex<T> or detail::imaginary_part_is_zero<std::decay_t<T>>())

T is a values::value in which either its type is not a values::complex or its imaginary component is 0.

◆ number

template<typename T >
constexpr bool OpenKalman::values::number
Initial value:
=
interface::number_traits<std::decay_t<T>>::is_specialized

T is a numerical type.

T can be any arithmetic, complex, or custom number type in which certain traits in interface::number_traits are defined and typical math operations (+, -, *, /, and ==) are also defined.

◆ value

template<typename T >
constexpr bool OpenKalman::values::value
Initial value:
=
values::fixed<T> or dynamic<T>

T is numerical value or is reducible to a numerical value.