60 if constexpr (std::is_floating_point_v<T>)
82 return { T{}, input };
91 if constexpr ( std::is_floating_point_v<T> )
92 return std::isnan(
real) || std::isnan(
dual);
99 if constexpr ( std::is_floating_point_v<T> )
100 return std::isinf(
real) || std::isinf(
dual);
102 return real.isInf() ||
dual.isInf();
144 template <std::
floating_po
int OT = T>
145 requires std::is_floating_point_v<T>
148 OT tolerance = OT{0.0002})
180 template <std::
floating_po
int OT =
double>
193 template <std::
floating_po
int OT =
double>
214 template <std::
floating_po
int OT =
double>
228 template <std::
floating_po
int OT =
double>
241 template <std::
floating_po
int OT =
double>
248 template <std::
floating_po
int OT =
double>
261 template <std::
floating_po
int OT =
double>
268 template <std::
floating_po
int OT =
double>
293 template <std::
floating_po
int OT = T>
294 requires std::is_floating_point_v<T>
297 OT tolerance = OT{0.0002})
301 auto diff{ near_to - input };
303 std::cout << std::format(
"input: {} is not equal to near_to: {} within tolerance: {}. Difference is {} .",
322 template <std::
floating_po
int OT = T>
323 requires std::is_floating_point_v<T>
326 OT tolerance = OT{0.0002})
330 auto diff{ near_to - input };
332 std::cout << std::format(
"input: {} is equal to near_to: {} within tolerance: {}. Difference is {} .",
362 template <std::
floating_po
int OT = T>
363 requires std::is_floating_point_v<T>
366 OT tolerance = OT{0.0002})
379 template <std::
floating_po
int OT = T>
380 requires std::is_floating_point_v<T>
383 OT tolerance = OT{0.0002})
395 template <std::
floating_po
int OT = T>
396 requires std::is_floating_point_v<T>
434 T root = std::sqrt(input.
real);
436 return { root, input.
dual / (T{2} * root) };
470 return std::format(
"[real: {}, dual: {}]", input.
real, input.
dual);
constexpr BasicDual()=default
Defaults to (0,0)
constexpr T magnitude() const
friend constexpr T dualscalar_normsquared(const BasicDual< T > &d)
static constexpr BasicDual< T > zero()
friend constexpr BasicDual< T > conjugate(const BasicDual< T > &input)
static constexpr BasicDual< T > identity()
friend constexpr bool approximately_equal_to(const BasicDual< T > &value_to_test, const BasicDual< T > &value_it_should_be, OT tolerance=OT{0.0002})
constexpr BasicDual(const T &r, const T &d)
friend std::string format(const BasicDual< T > &input)
static constexpr BasicDual< T > make_pure(const T &input)
friend constexpr bool operator==(const BasicDual< T > &left, const BasicDual< T > &right)
friend constexpr BasicDual< T > dualscalar_sqrt(const BasicDual< T > &input)
friend constexpr T dot(const BasicDual< T > &left, const BasicDual< T > &right)
constexpr BasicDual< T > conjugate() const
constexpr BasicDual(const T &r)
friend constexpr T accumulate(const BasicDual< T > &input)
T value_type
The underlying implementation type.
friend void CHECK_IF_ZERO(const BasicDual< T > &input, OT tolerance=OT{0.0002})
friend void CHECK_IF_NOT_EQUAL(const BasicDual< T > &input, const BasicDual< T > &near_to, OT tolerance=OT{0.0002})
friend void CHECK_IF_EQUAL(const BasicDual< T > &input, const BasicDual< T > &near_to, OT tolerance=OT{0.0002})
friend bool check_if_equal(const BasicDual< T > &input, const BasicDual< T > &near_to, OT tolerance=OT{0.0002})
friend bool check_if_not_equal(const BasicDual< T > &input, const BasicDual< T > &near_to, OT tolerance=OT{0.0002})
friend constexpr BasicDual< T > operator+(const BasicDual< T > &left, const BasicDual< T > &right)
Defines addition of two Duals.
friend constexpr BasicDual< T > operator/(const BasicDual< T > &left, const BasicDual< T > &right)
Defines division of two Duals.
friend constexpr BasicDual< T > operator*(const BasicDual< T > &left, const BasicDual< T > &right)
Defines multiplication of two Duals.
friend constexpr BasicDual< T > operator-(const BasicDual< T > &left, const BasicDual< T > &right)
Defines subtraction of two Duals.