Serac
0.1
Serac is an implicit thermal strucural mechanics simulation code.
|
This file contains the declaration of a dual number class. More...
#include <iostream>
#include <cmath>
#include "serac/infrastructure/accelerator.hpp"
#include "serac/numerics/functional/tuple_tensor_dual_functions.hpp"
Go to the source code of this file.
Classes | |
struct | serac::dual< gradient_type > |
Dual number struct (value plus gradient) More... | |
struct | serac::is_dual_number< T > |
class for checking if a type is a dual number or not More... | |
struct | serac::is_dual_number< dual< T > > |
class for checking if a type is a dual number or not More... | |
Namespaces | |
serac | |
Accelerator functionality. | |
Macros | |
#define | binary_comparator_overload(x) |
Generates const + non-const overloads for a binary comparison operator Comparisons are conducted against the "value" part of the dual number. More... | |
Functions | |
template<typename T > | |
serac::dual (double, T) -> dual< T > | |
class template argument deduction guide for type dual . More... | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator+ (dual< gradient_type > a, double b) |
addition of a dual number and a non-dual number | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator+ (double a, dual< gradient_type > b) |
addition of a dual number and a non-dual number | |
template<typename gradient_type_a , typename gradient_type_b > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator+ (dual< gradient_type_a > a, dual< gradient_type_b > b) |
addition of two dual numbers | |
template<typename gradient_type > | |
constexpr auto | serac::operator- (dual< gradient_type > x) |
unary negation of a dual number | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator- (dual< gradient_type > a, double b) |
subtraction of a non-dual number from a dual number | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator- (double a, dual< gradient_type > b) |
subtraction of a dual number from a non-dual number | |
template<typename gradient_type_a , typename gradient_type_b > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator- (dual< gradient_type_a > a, dual< gradient_type_b > b) |
subtraction of two dual numbers | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator* (const dual< gradient_type > &a, double b) |
multiplication of a dual number and a non-dual number | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator* (double a, const dual< gradient_type > &b) |
multiplication of a dual number and a non-dual number | |
template<typename gradient_type_a , typename gradient_type_b > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator* (dual< gradient_type_a > a, dual< gradient_type_b > b) |
multiplication of two dual numbers | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator/ (const dual< gradient_type > &a, double b) |
division of a dual number by a non-dual number | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator/ (double a, const dual< gradient_type > &b) |
division of a non-dual number by a dual number | |
template<typename gradient_type_a , typename gradient_type_b > | |
constexpr SERAC_HOST_DEVICE auto | serac::operator/ (dual< gradient_type_a > a, dual< gradient_type_b > b) |
division of two dual numbers | |
serac::binary_comparator_overload (<) | |
implement operator< for dual numbers More... | |
serac::binary_comparator_overload (<=) | |
implement operator<= for dual numbers | |
serac::binary_comparator_overload (>=) | |
implement operator>= for dual numbers | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto & | serac::operator+= (dual< gradient_type > &a, const dual< gradient_type > &b) |
compound assignment (+) for dual numbers | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto & | serac::operator-= (dual< gradient_type > &a, const dual< gradient_type > &b) |
compound assignment (-) for dual numbers | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto & | serac::operator+= (dual< gradient_type > &a, double b) |
compound assignment (+) for dual numbers with double righthand side | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto & | serac::operator-= (dual< gradient_type > &a, double b) |
compound assignment (-) for dual numbers with double righthand side | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::abs (dual< gradient_type > x) |
Implementation of absolute value function for dual numbers. More... | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::max (dual< gradient_type > a, double b) |
Implementation of max for dual numbers. More... | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::max (double a, dual< gradient_type > b) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::max (dual< gradient_type > a, dual< gradient_type > b) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::min (dual< gradient_type > a, double b) |
Implementation of min for dual numbers. More... | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::min (double a, dual< gradient_type > b) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::min (dual< gradient_type > a, dual< gradient_type > b) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::sqrt (dual< gradient_type > x) |
implementation of square root for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::cos (dual< gradient_type > a) |
implementation of cosine for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::sin (dual< gradient_type > a) |
implementation of sine for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::atan (dual< gradient_type > a) |
implementation of atan for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::atan2 (dual< gradient_type > y, dual< gradient_type > x) |
implementation of atan2 for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::atan2 (double y, dual< gradient_type > x) |
implementation of atan2 for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::atan2 (dual< gradient_type > y, double x) |
implementation of atan2 for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::asin (dual< gradient_type > a) |
implementation of asin for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::acos (dual< gradient_type > a) |
implementation of acos for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::exp (dual< gradient_type > a) |
implementation of exponential function for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::log (dual< gradient_type > a) |
implementation of the natural logarithm function for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::log1p (dual< gradient_type > a) |
implementation of the natural logarithm of one plus the argument function for dual numbers | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::pow (dual< gradient_type > a, dual< gradient_type > b) |
implementation of a (dual) raised to the b (dual) power | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::pow (double a, dual< gradient_type > b) |
implementation of a (non-dual) raised to the b (dual) power | |
template<typename gradient_type > | |
SERAC_HOST_DEVICE auto | serac::pow (dual< gradient_type > a, double b) |
implementation of a (dual) raised to the b (non-dual) power | |
template<typename T , int... n> | |
auto & | serac::operator<< (std::ostream &out, dual< T > A) |
overload of operator<< for dual to work with std::cout and other std::ostream s | |
constexpr SERAC_HOST_DEVICE auto | serac::make_dual (double x) |
promote a value to a dual number of the appropriate type | |
template<typename T > | |
constexpr SERAC_HOST_DEVICE auto | serac::get_value (const T &arg) |
return the "value" part from a given type. For non-dual types, this is just the identity function | |
template<typename T > | |
constexpr SERAC_HOST_DEVICE auto | serac::get_value (dual< T > arg) |
return the "value" part from a dual number type | |
template<typename gradient_type > | |
constexpr SERAC_HOST_DEVICE auto | serac::get_gradient (dual< gradient_type > arg) |
return the "gradient" part from a dual number type | |
This file contains the declaration of a dual number class.
Definition in file dual.hpp.
#define binary_comparator_overload | ( | x | ) |
Generates const + non-const overloads for a binary comparison operator Comparisons are conducted against the "value" part of the dual number.
[in] | x | The comparison operator to overload |