include/basix/defaults.hpp File Reference

#include <basix/basix.hpp>

Go to the source code of this file.

Classes

Namespaces

Defines

Typedefs

Functions


Detailed Description

Definition in file defaults.hpp.


Define Documentation

#define ADDITIVE_INT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline T operator + (const T& x, const int& y) {   \
  return x + promote (y, x); }                          \
TMPL inline T operator + (const int& x, const T& y) {   \
  return promote (x, y) + y; }                          \
TMPL inline T operator - (const T& x, const int& y) {   \
  return x - promote (y, x); }                          \
TMPL inline T operator - (const int& x, const T& y) {   \
  return promote (x, y) - y; }

Definition at line 179 of file defaults.hpp.

#define ADDITIVE_SCALAR_INT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline T operator + (const T& x, const int& y) {   \
  return x + promote_scalar (y, x); }                   \
TMPL inline T operator + (const int& x, const T& y) {   \
  return promote_scalar (x, y) + y; }                   \
TMPL inline T operator - (const T& x, const int& y) {   \
  return x - promote_scalar (y, x); }                   \
TMPL inline T operator - (const int& x, const T& y) {   \
  return promote_scalar (x, y) - y; }

Definition at line 189 of file defaults.hpp.

#define ADDITIVE_SCALAR_SUGAR ( TMPL,
T,
 ) 
Value:
TMPL inline T operator + (const T& x, const C& y) { return x + T(y); } \
TMPL inline T operator + (const C& x, const T& y) { return T(x) + y; } \
TMPL inline T operator - (const T& x, const C& y) { return x - T(y); } \
TMPL inline T operator - (const C& x, const T& y) { return T(x) - y; }

Definition at line 199 of file defaults.hpp.

#define ARG_HYPER_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C acosh (const C& x) {                                      \
  return log (x + sqrt (square (x) - promote (1, x))); }                \
TMPL inline C asinh (const C& x) {                                      \
  return log (x + sqrt (square (x) + promote (1, x))); }                \
TMPL inline C atanh (const C& x) {                                      \
  return log ((promote (1, x) + x) / (promote (1, x) - x)) / promote (2, x); }

Definition at line 681 of file defaults.hpp.

#define ARITH_INT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline T operator + (const T& x, const int& y) {   \
  return x + promote (y, x); }                          \
TMPL inline T operator + (const int& x, const T& y) {   \
  return promote (x, y) + y; }                          \
TMPL inline T operator - (const T& x, const int& y) {   \
  return x - promote (y, x); }                          \
TMPL inline T operator - (const int& x, const T& y) {   \
  return promote (x, y) - y; }                          \
TMPL inline T operator * (const T& x, const int& y) {   \
  return x * promote (y, x); }                          \
TMPL inline T operator * (const int& x, const T& y) {   \
  return promote (x, y) * y; }                          \
TMPL inline T operator / (const T& x, const int& y) {   \
  return x / promote (y, x); }                          \
TMPL inline T operator / (const int& x, const T& y) {   \
  return promote (x, y) / y; }

Definition at line 205 of file defaults.hpp.

#define ARITH_SCALAR_INT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline T operator + (const T& x, const int& y) {   \
  return x + promote_scalar (y, x); }                   \
TMPL inline T operator + (const int& x, const T& y) {   \
  return promote_scalar (x, y) + y; }                   \
TMPL inline T operator - (const T& x, const int& y) {   \
  return x - promote_scalar (y, x); }                   \
TMPL inline T operator - (const int& x, const T& y) {   \
  return promote_scalar (x, y) - y; }                   \
TMPL inline T operator * (const T& x, const int& y) {   \
  return x * promote_scalar (y, x); }                   \
TMPL inline T operator * (const int& x, const T& y) {   \
  return promote_scalar (x, y) * y; }                   \
TMPL inline T operator / (const T& x, const int& y) {   \
  return x / promote_scalar (y, x); }                   \
TMPL inline T operator / (const int& x, const T& y) {   \
  return promote_scalar (x, y) / y; }

Definition at line 223 of file defaults.hpp.

#define ARITH_SCALAR_SUGAR ( TMPL,
T,
 ) 
Value:
TMPL inline T operator + (const T& x, const C& y) { return x + T(y); } \
TMPL inline T operator + (const C& x, const T& y) { return T(x) + y; } \
TMPL inline T operator - (const T& x, const C& y) { return x - T(y); } \
TMPL inline T operator - (const C& x, const T& y) { return T(x) - y; } \
TMPL inline T operator * (const T& x, const C& y) { return x * T(y); } \
TMPL inline T operator * (const C& x, const T& y) { return T(x) * y; } \
TMPL inline T operator / (const T& x, const C& y) { return x / T(y); } \
TMPL inline T operator / (const C& x, const T& y) { return T(x) / y; }

Definition at line 241 of file defaults.hpp.

#define ARITH_SWAP_TIMES_SUGAR ( TMPL,
T,
 )     TMPL inline T operator * (const C& x, const T& y) { return y * x; }

Definition at line 257 of file defaults.hpp.

#define ATAN2_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C atan2 (const C& y, const C& x) {                          \
  if (x > promote (0, x))                                               \
    return atan (y/x);                                                  \
  else if (y == promote (0, x))                                         \
    return x == promote (0, x)?                                         \
           promote (0, x): promote (-4, x) * atan (promote (1, x));     \
  else if (x == promote (0, x))                                         \
    return promote (2 * sign (y), x) * atan (promote (1, x));           \
  else                                                                  \
    return promote (sign (y), x) *                                      \
           (promote (4, x) * atan (promote (1, x)) - atan (abs (y/x))); }

Definition at line 644 of file defaults.hpp.

#define COMPARE_INT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline bool operator <  (const T& x, const int& y) {       \
  return x <  promote (y, x); }                                 \
TMPL inline bool operator <= (const T& x, const int& y) {       \
  return x <= promote (y, x); }                                 \
TMPL inline bool operator >  (const T& x, const int& y) {       \
  return x >  promote (y, x); }                                 \
TMPL inline bool operator >= (const T& x, const int& y) {       \
  return x >= promote (y, x); }

Definition at line 498 of file defaults.hpp.

#define COMPARE_SCALAR_SUGAR ( TMPL,
T,
 ) 
Value:
TMPL inline bool operator <  (const T& x, const C& y) { return x <  T(y); }   \
TMPL inline bool operator <= (const T& x, const C& y) { return x <= T(y); }   \
TMPL inline bool operator >  (const T& x, const C& y) { return x >  T(y); }   \
TMPL inline bool operator >= (const T& x, const C& y) { return x >= T(y); }

Definition at line 508 of file defaults.hpp.

#define COMPARE_SCALAR_SUGAR_BIS ( TMPL,
T,
 ) 
Value:
TMPL inline bool operator <  (const C& x, const T& y) { return T(x) <  y; }   \
TMPL inline bool operator <= (const C& x, const T& y) { return T(x) <= y; }   \
TMPL inline bool operator >  (const C& x, const T& y) { return T(x) >  y; }   \
TMPL inline bool operator >= (const C& x, const T& y) { return T(x) >= y; }

Definition at line 514 of file defaults.hpp.

#define COMPARE_SUGAR ( TMPL,
 ) 
Value:
TMPL inline bool operator <  (const T& x, const T& y) { \
  return compare (x,y) <  0; }                          \
TMPL inline bool operator <= (const T& x, const T& y) { \
  return compare (x,y) <= 0; }                          \
TMPL inline bool operator >  (const T& x, const T& y) { \
  return compare (x,y) >  0; }                          \
TMPL inline bool operator >= (const T& x, const T& y) { \
  return compare (x,y) >= 0; }

Definition at line 482 of file defaults.hpp.

#define COPY_OP_SUGAR ( TMPL,
 ) 
Value:
TMPL inline T copy (const T& x) {               \
  return unary_map<id_op> (x); }                \
TMPL inline T duplicate (const T& x) {          \
  return unary_map<duplicate_op> (x); }

Definition at line 169 of file defaults.hpp.

#define EQUAL_INT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline bool operator == (const T& x, const int& y) {       \
  return x == promote (y, x); }                                 \
TMPL inline bool operator != (const T& x, const int& y) {       \
  return x != promote (y, x); }                                 \
TMPL inline bool exact_eq (const T& x, const int& y) {          \
  return exact_eq (x, promote (y, x)); }                        \
TMPL inline bool exact_neq (const T& x, const int& y) {         \
  return exact_neq (x, promote (y, x)); }

Definition at line 111 of file defaults.hpp.

#define EQUAL_SCALAR_SUGAR ( TMPL,
T,
 ) 
Value:
TMPL inline bool operator == (const T& x, const C& y) { \
  return x == T(y); }                                   \
TMPL inline bool operator != (const T& x, const C& y) { \
  return x != T(y); }                                   \
TMPL inline bool exact_eq (const T& x, const C& y) {    \
  return exact_eq (x, T(y)); }                          \
TMPL inline bool exact_neq (const T& x, const C& y) {   \
  return exact_neq (x, T(y)); }

Definition at line 121 of file defaults.hpp.

#define EQUAL_SCALAR_SUGAR_BIS ( TMPL,
T,
 ) 
Value:
TMPL inline bool operator == (const C& x, const T& y) { \
  return T(x) == y; }                                   \
TMPL inline bool operator != (const C& x, const T& y) { \
  return T(x) != y; }                                   \
TMPL inline bool exact_eq (const C& x, const T& y) {    \
  return exact_eq (T(x), y); }                          \
TMPL inline bool exact_neq (const C& x, const T& y) {   \
  return exact_neq (T(x), y); }

Definition at line 131 of file defaults.hpp.

#define EXACT_IDENTITY_OP_SUGAR ( TMPL,
 ) 
Value:
TMPL inline nat exact_hash (const T& x) {               \
  return unary_hash<exact_hash_op> (x); }               \
TMPL inline bool exact_eq (const T& x, const T& y) {    \
  return binary_test<exact_eq_op> (x, y); }             \
TMPL inline bool exact_neq (const T& x, const T& y) {   \
  return !binary_test<exact_eq_op> (x, y); }

Definition at line 95 of file defaults.hpp.

#define GCD_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C gcd (const C& x, const C& y) {                            \
  return (x == promote (0, x) && y == promote (0, x))?                  \
         promote (0, x): promote (1, x); }                              \
TMPL inline C lcm (const C& x, const C& y) {                            \
  return (x == promote (0, x) || y == promote (0, x))?                  \
         promote (0, x): x*y; }                                         \
TMPL inline xgcd_matrix<C> xgcd (const C& x, const C& y) {              \
  if (x == 0) {                                                         \
    if (y == 0)                                                         \
      return xgcd_matrix<C> (promote (1, x), promote (0, x),            \
                             promote (0, x), promote (1, x));           \
    else                                                                \
      return xgcd_matrix<C> (promote (0, x), promote (1, x) / y,        \
                             promote (1, x), promote (0, x));           \
  }                                                                     \
  else {                                                                \
    if (y == 0)                                                         \
      return xgcd_matrix<C> (promote (1, x) / x, promote (0, x),        \
                             promote (0, x), promote (1, x));           \
    else                                                                \
      return xgcd_matrix<C> (promote (1, x) / x, promote (0, x),        \
                             -y, x);                                    \
  }                                                                     \
}

Definition at line 360 of file defaults.hpp.

#define HARD_IDENTITY_OP_SUGAR ( TMPL,
 ) 
Value:
TMPL inline nat hard_hash (const T& x) {                \
  return unary_hash<hard_hash_op> (x); }                \
TMPL inline bool hard_eq (const T& x, const T& y) {     \
  return binary_test<hard_eq_op> (x, y); }              \
TMPL inline bool hard_neq (const T& x, const T& y) {    \
  return !binary_test<hard_eq_op> (x, y); }

Definition at line 103 of file defaults.hpp.

#define HARD_TO_EXACT_IDENTITY_SUGAR ( TMPL,
 ) 
Value:
TMPL inline nat exact_hash (const T& x) {               \
  return hard_hash (x); }                               \
TMPL inline bool exact_eq (const T& x, const T& y) {    \
  return hard_eq (x, y); }                              \
TMPL inline bool exact_neq (const T& x, const T& y) {   \
  return hard_neq (x, y); }

Definition at line 71 of file defaults.hpp.

#define HARD_TO_TRUE_IDENTITY_SUGAR ( TMPL,
 ) 
Value:
TMPL inline nat hash (const T& x) {                     \
  return hard_hash (x); }                               \
TMPL inline bool operator == (const T& x, const T& y) { \
  return hard_eq (x, y); }                              \
TMPL inline bool operator != (const T& x, const T& y) { \
  return hard_neq (x, y); }

Definition at line 79 of file defaults.hpp.

#define HYPER_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C cosh (const C& x) {                       \
  return (exp (x) + exp (-x)) / promote (2, x); }       \
TMPL inline C sinh (const C& x) {                       \
  return (exp (x) - exp (-x)) / promote (2, x); }       \
TMPL inline C tanh (const C& x) {                       \
  return (exp (x) - exp (-x)) / (exp (x) + exp (-x)); }

Definition at line 665 of file defaults.hpp.

#define HYPOT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C hypot (const C& x, const C& y) {  \
  return sqrt (square (x) + square (y)); }

Definition at line 636 of file defaults.hpp.

#define INV_HYPER_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C sech (const C& x) {                       \
  return promote (2, x) / (exp (x) + exp (-x)); }       \
TMPL inline C csch (const C& x) {                       \
  return promote (2, x) / (exp (x) - exp (-x)); }       \
TMPL inline C coth (const C& x) {                       \
  return (exp (x) + exp (-x)) / (exp (x) - exp (-x)); }

Definition at line 673 of file defaults.hpp.

#define INV_TRIGO_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C sec (const C& x) {                \
  return promote (1, x) / cos (x); }            \
TMPL inline C csc (const C& x) {                \
  return promote (1, x) / sin (x); }            \
TMPL inline C cot (const C& x) {                \
  return cos (x) / sin (x); }

Definition at line 657 of file defaults.hpp.

#define POOR_MAN_ELEMENTARY_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C exp (const C& x) {                        \
  ASSERT (x == (promote (0, x)), "zero expected");      \
  return promote (1, x); }                              \
TMPL inline C log (const C& x) {                        \
  ASSERT (x == (promote (1, x)), "one expected");       \
  return promote (0, x); }                              \
TMPL inline C cos (const C& x) {                        \
  ASSERT (x == (promote (0, x)), "zero expected");      \
  return promote (1, x); }                              \
TMPL inline C sin (const C& x) {                        \
  ASSERT (x == (promote (0, x)), "zero expected");      \
  return promote (0, x); }                              \
TMPL inline C tan (const C& x) {                        \
  ASSERT (x == (promote (0, x)), "zero expected");      \
  return promote (0, x); }                              \
TMPL inline C acos (const C& x) {                       \
  ASSERT (x == (promote (1, x)), "one expected");       \
  return promote (0, x); }                              \
TMPL inline C asin (const C& x) {                       \
  ASSERT (x == (promote (0, x)), "zero expected");      \
  return promote (0, x); }                              \
TMPL inline C atan (const C& x) {                       \
  ASSERT (x == (promote (0, x)), "zero expected");      \
  return promote (0, x); }

Definition at line 610 of file defaults.hpp.

#define POOR_MAN_SQRT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C sqrt (const C& x) {                                       \
  ASSERT (x == (C)(0) || x == (C)(1), "zero or one expected"); return x; }

Definition at line 606 of file defaults.hpp.

#define POW_SUGAR ( TMPL,
 ) 
Value:
TMPL inline C pow (const C& x, const C& y) {    \
  return exp (y * log (x)); }

Definition at line 640 of file defaults.hpp.

#define SHIFT_INT_SUGAR ( TMPL,
 ) 
Value:
TMPL inline T& operator <<= (T& x, const int& y) { return x= x << y; }      \
TMPL inline T& operator >>= (T& x, const int& y) { return x= x >> y; }      \
TMPL inline T& operator <<= (T& x, const long int& y) { return x= x << y; } \
TMPL inline T& operator >>= (T& x, const long int& y) { return x= x >> y; }

Definition at line 251 of file defaults.hpp.

#define STRICT_COMPARE_SUGAR ( TMPL,
 ) 
Value:
TMPL inline bool operator <  (const T& x, const T& y) { \
  return x<=y && !(x==y); }                             \
TMPL inline bool operator >  (const T& x, const T& y) { \
  return x>=y && !(x==y); }

Definition at line 492 of file defaults.hpp.

#define TRUE_IDENTITY_OP_SUGAR ( TMPL,
 ) 
Value:
TMPL inline nat hash (const T& x) {                     \
  return unary_hash<hash_op> (x); }                     \
TMPL inline bool operator == (const T& x, const T& y) { \
  return binary_test<equal_op> (x, y); }                \
TMPL inline bool operator != (const T& x, const T& y) { \
  return !binary_test<equal_op> (x, y); }

Definition at line 87 of file defaults.hpp.

#define TRUE_TO_EXACT_IDENTITY_SUGAR ( TMPL,
 ) 
Value:
TMPL inline nat exact_hash (const T& x) {               \
  return hash (x); }                                    \
TMPL inline bool exact_eq (const T& x, const T& y) {    \
  return x == y; }                                      \
TMPL inline bool exact_neq (const T& x, const T& y) {   \
  return x != y; }

Definition at line 63 of file defaults.hpp.


Generated on 6 Dec 2012 for basix by  doxygen 1.6.1