Classes | Functions
funcl Namespace Reference

Higher order function objects similar to std::plus, etc. More...

Classes

struct  Abs
 Functional for computing abs on an object. More...
 
struct  Acos
 Functional for computing acos on an object. More...
 
struct  Acosh
 Functional for computing acosh on an object. More...
 
struct  Asin
 Functional for computing asin on an object. More...
 
struct  Asinh
 Functional for computing asinh on an object. More...
 
struct  AssertEqual
 Functional that asserts that the function object C applied to the first and second arguments are equal and returns the function object C applied to the first argument. More...
 
struct  Atan
 Functional for computing atan on an object. More...
 
struct  Atan2
 Functional for computing atan2 from two objects. More...
 
struct  Atanh
 Functional for computing atanh on an object. More...
 
struct  Cbrt
 Functional for computing cbrt on an object. More...
 
struct  Conj
 Functional for computing conj on an object. More...
 
struct  Cos
 Functional for computing cos on an object. More...
 
struct  Cosh
 Functional for computing cosh on an object. More...
 
struct  DivAssign
 Functional for computing /= of two objects. More...
 
struct  Divides
 Functional for computing / of two objects. More...
 
struct  Erf
 Functional for computing erf on an object. More...
 
struct  Exp
 Functional for computing exp on an object. More...
 
struct  Exp2
 Functional for computing exp2 on an object. More...
 
struct  Fabs
 Functional for computing fabs on an object. More...
 
struct  GetArgument
 Functional to retrieve the ArgumentIndexth argument. More...
 
struct  Hypot
 Functional for computing hypot from two objects. More...
 
struct  Identity
 The identity higher order function object. More...
 
struct  Imag
 Functional for computing imag on an object. More...
 
struct  InvCbrt
 Functional for computing invcbrt on an object. More...
 
struct  InvSqrt
 Functional for computing invsqrt on an object. More...
 
struct  Literal
 
struct  Log
 Functional for computing log on an object. More...
 
struct  Log10
 Functional for computing log10 on an object. More...
 
struct  Log2
 Functional for computing log2 on an object. More...
 
struct  Max
 Functional for computing max from two objects. More...
 
struct  Min
 Functional for computing min from two objects. More...
 
struct  Minus
 Functional for computing - of two objects. More...
 
struct  MinusAssign
 Functional for computing -= of two objects. More...
 
struct  MultAssign
 Functional for computing *= of two objects. More...
 
struct  Multiplies
 Functional for computing * of two objects. More...
 
struct  Negate
 Functional for computing - on an object. More...
 
struct  Plus
 Functional for computing + of two objects. More...
 
struct  PlusAssign
 Functional for computing += of two objects. More...
 
struct  Pow
 Functional for computing pow from two objects. More...
 
struct  Real
 Functional for computing real on an object. More...
 
struct  Sin
 Functional for computing sin on an object. More...
 
struct  Sinh
 Functional for computing sinh on an object. More...
 
struct  Sqrt
 Functional for computing sqrt on an object. More...
 
struct  Square
 Function for squaring a quantity. More...
 
struct  StepFunction
 Functional for computing step_function on an object. More...
 
struct  Tan
 Functional for computing tan on an object. More...
 
struct  Tanh
 Functional for computing tanh on an object. More...
 
struct  UnaryPow
 Function for computing an integer power, forwards to template pow<N>() More...
 

Functions

 MAKE_LITERAL_VAL (Pi, M_PI)
 
 MAKE_LITERAL_VAL (E, M_E)
 

Detailed Description

Higher order function objects similar to std::plus, etc.

Details

These chaining function objects can be used to represent highly general mathematical operations

  1. as types, which can be passed around in template arguments, and
  2. such that any time they can be evaluated at compile time, they will be.

As an illustrative example, consider the definition of a general sinusoid function object type :

which then gives a type which when instantiated and evaluated will give the answer \( a\times\sin(b + c \times d)\) from calling Sinusoid{}(a,b,c,d)

As a more creative example, we can take advantage of literals to make, for instance, distributions. Let's make a Gaussian with mean at 5.0 and unity variance

This gives us a function object whose call operator takes one argument that gives the value of the desired Gaussian distribution \( e^{-(x - 5.0)^2} \)