TayUnitTests.hpp File Reference

#include "adolc/adouble.h"
#include "adolc/interfaces.h"
#include "Sacado.hpp"
#include "Sacado_Random.hpp"
#include <cppunit/extensions/HelperMacros.h>
#include "Sacado_Tay_CacheTaylor.hpp"
Include dependency graph for TayUnitTests.hpp:

Go to the source code of this file.

Classes

class  TaylorOpsUnitTest< TaylorType >
class  CacheTaylorOpsUnitTest

Defines

#define COMPARE_DOUBLES(a, b)   CPPUNIT_ASSERT( fabs(a-b) < tol_a + tol_r*fabs(a) );
#define COMPARE_POLYS(x_dtay, x_adolc)
#define BINARY_OP2_TEST(TESTNAME, OP)
#define BINARY_OPRC_TEST(TESTNAME, OP)
#define BINARY_OPLC_TEST(TESTNAME, OP)
#define BINARY_OP_TEST(TESTNAME, OP)
#define CPPUNIT_BINARY_OP_TEST(TESTNAME)
#define RELOP_OP2_TEST(TESTNAME, OP)
#define RELOP_OPLC_TEST(TESTNAME, OP)
#define RELOP_OPRC_TEST(TESTNAME, OP)
#define RELOP_OP_TEST(TESTNAME, OP)
#define CPPUNIT_RELOP_OP_TEST(TESTNAME)
#define BINARY_FUNC2_TEST(TESTNAME, FUNC)
#define BINARY_FUNCRC_TEST(TESTNAME, FUNC)
#define BINARY_FUNCLC_TEST(TESTNAME, FUNC)
#define BINARY_FUNC_TEST(TESTNAME, FUNC)
#define CPPUNIT_BINARY_FUNC_TEST(TESTNAME)
#define UNARY_OP_TEST(TESTNAME, OP)
#define UNARY_FUNC_TEST(TESTNAME, FUNC)
#define UNARY_ASSIGNOP2_TEST(TESTNAME, OP)
#define UNARY_ASSIGNOPRC_TEST(TESTNAME, OP)
#define UNARY_ASSIGNOPLC_TEST(TESTNAME, OP)
#define UNARY_ASSIGNOP_TEST(TESTNAME, OP)
#define CPPUNIT_UNARY_ASSIGNOP_TEST(TESTNAME)

Functions

adouble max (const adouble &a, const adouble &b)
adouble max (const adouble &a, double v)
adouble max (double v, const adouble &b)
adouble min (const adouble &a, const adouble &b)
adouble min (const adouble &a, double v)
adouble min (double v, const adouble &b)

Define Documentation

#define COMPARE_DOUBLES ( a,
 )     CPPUNIT_ASSERT( fabs(a-b) < tol_a + tol_r*fabs(a) );

Definition at line 53 of file TayUnitTests.hpp.

#define COMPARE_POLYS ( x_dtay,
x_adolc   ) 
Value:
CPPUNIT_ASSERT(x_dtay.degree() == d);       \
  for (unsigned int i=0; i<=d; i++) {       \
    COMPARE_DOUBLES(x_dtay.coeff(i), x_adolc[i]);   \
  }               \
  ;

Definition at line 56 of file TayUnitTests.hpp.

#define BINARY_OP2_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {          \
    c_dtay = a_dtay OP b_dtay;        \
    trace_on(0);          \
    adouble aa, ab, ac;         \
    aa <<= X[0][0];         \
    ab <<= X[1][0];         \
    ac = aa OP ab;          \
    ac >>= Y[0][0];         \
    trace_off();          \
    forward(0,1,2,d,0,X,Y);       \
    COMPARE_POLYS(c_dtay,Y[0]);       \
  }

Definition at line 63 of file TayUnitTests.hpp.

#define BINARY_OPRC_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {          \
    double val = urand.number();      \
    c_dtay = a_dtay OP val;       \
    trace_on(0);          \
    adouble aa, ac;         \
    aa <<= X[0][0];         \
    ac = aa OP val;         \
    ac >>= Y[0][0];         \
    trace_off();          \
    forward(0,1,1,d,0,X,Y);       \
    COMPARE_POLYS(c_dtay,Y[0]);       \
  }

Definition at line 77 of file TayUnitTests.hpp.

#define BINARY_OPLC_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {          \
    double val = urand.number();      \
    c_dtay = val OP a_dtay;       \
    trace_on(0);          \
    adouble aa, ac;         \
    aa <<= X[0][0];         \
    ac = val OP aa;         \
    ac >>= Y[0][0];         \
    trace_off();          \
    forward(0,1,1,d,0,X,Y);       \
    COMPARE_POLYS(c_dtay,Y[0]);       \
  }

Definition at line 91 of file TayUnitTests.hpp.

#define BINARY_OP_TEST ( TESTNAME,
OP   ) 
Value:
BINARY_OP2_TEST(TESTNAME,OP);       \
  BINARY_OPLC_TEST(TESTNAME ## LeftConstant,OP);  \
  BINARY_OPRC_TEST(TESTNAME ## RightConstant,OP)

Definition at line 105 of file TayUnitTests.hpp.

#define CPPUNIT_BINARY_OP_TEST ( TESTNAME   ) 
Value:
CPPUNIT_TEST(TESTNAME);     \
  CPPUNIT_TEST(TESTNAME ## LeftConstant); \
  CPPUNIT_TEST(TESTNAME ## RightConstant)

Definition at line 110 of file TayUnitTests.hpp.

#define RELOP_OP2_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {                      \
    bool r1 = a_dtay OP b_dtay;                   \
    bool r2 = a_dtay.coeff(0) OP b_dtay.coeff(0); \
    CPPUNIT_ASSERT(r1 == r2);       \
  }

Definition at line 115 of file TayUnitTests.hpp.

#define RELOP_OPLC_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {                      \
    double val = urand.number();                        \
    bool r1 = val OP b_dtay;                    \
    bool r2 = val OP b_dtay.coeff(0);                 \
    CPPUNIT_ASSERT(r1 == r2);       \
  }

Definition at line 122 of file TayUnitTests.hpp.

#define RELOP_OPRC_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {                      \
    double val = urand.number();                        \
    bool r1 = a_dtay OP val;                    \
    bool r2 = a_dtay.coeff(0) OP val;                 \
    CPPUNIT_ASSERT(r1 == r2);       \
  }

Definition at line 130 of file TayUnitTests.hpp.

#define RELOP_OP_TEST ( TESTNAME,
OP   ) 
Value:
RELOP_OP2_TEST(TESTNAME,OP);                          \
  RELOP_OPLC_TEST(TESTNAME ## LeftConstant,OP);         \
  RELOP_OPRC_TEST(TESTNAME ## RightConstant,OP)

Definition at line 138 of file TayUnitTests.hpp.

#define CPPUNIT_RELOP_OP_TEST ( TESTNAME   ) 
Value:
CPPUNIT_TEST(TESTNAME);             \
  CPPUNIT_TEST(TESTNAME ## LeftConstant);         \
  CPPUNIT_TEST(TESTNAME ## RightConstant)

Definition at line 143 of file TayUnitTests.hpp.

#define BINARY_FUNC2_TEST ( TESTNAME,
FUNC   ) 
Value:
void TESTNAME () {          \
    c_dtay = FUNC (a_dtay, b_dtay);     \
    trace_on(0);          \
    adouble aa, ab, ac;         \
    aa <<= X[0][0];         \
    ab <<= X[1][0];         \
    ac = FUNC (aa, ab);         \
    ac >>= Y[0][0];         \
    trace_off();          \
    forward(0,1,2,d,0,X,Y);       \
    COMPARE_POLYS(c_dtay,Y[0]);       \
  }

Definition at line 148 of file TayUnitTests.hpp.

#define BINARY_FUNCRC_TEST ( TESTNAME,
FUNC   ) 
Value:
void TESTNAME () {          \
    double val = urand.number();      \
    c_dtay = FUNC (a_dtay, val);      \
    trace_on(0);          \
    adouble aa, ac;         \
    aa <<= X[0][0];         \
    ac = FUNC (aa, val);        \
    ac >>= Y[0][0];         \
    trace_off();          \
    forward(0,1,1,d,0,X,Y);       \
    COMPARE_POLYS(c_dtay,Y[0]);       \
  }

Definition at line 162 of file TayUnitTests.hpp.

#define BINARY_FUNCLC_TEST ( TESTNAME,
FUNC   ) 
Value:
void TESTNAME () {          \
    double val = urand.number();      \
    c_dtay = FUNC (val, a_dtay);      \
    trace_on(0);          \
    adouble aa, ac;         \
    aa <<= X[0][0];         \
    ac = FUNC (val, aa);        \
    ac >>= Y[0][0];         \
    trace_off();          \
    forward(0,1,1,d,0,X,Y);       \
    COMPARE_POLYS(c_dtay,Y[0]);       \
  }

Definition at line 176 of file TayUnitTests.hpp.

#define BINARY_FUNC_TEST ( TESTNAME,
FUNC   ) 
Value:
BINARY_FUNC2_TEST(TESTNAME,FUNC);       \
  BINARY_FUNCLC_TEST(TESTNAME ## LeftConstant,FUNC);    \
  BINARY_FUNCRC_TEST(TESTNAME ## RightConstant,FUNC)

Definition at line 190 of file TayUnitTests.hpp.

#define CPPUNIT_BINARY_FUNC_TEST ( TESTNAME   ) 
Value:
CPPUNIT_TEST(TESTNAME);     \
  CPPUNIT_TEST(TESTNAME ## LeftConstant); \
  CPPUNIT_TEST(TESTNAME ## RightConstant)

Definition at line 195 of file TayUnitTests.hpp.

#define UNARY_OP_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {            \
    c_dtay = OP a_dtay;           \
    trace_on(0);            \
    adouble aa, ac;           \
    aa <<= X[0][0];           \
    ac = OP aa;             \
    ac >>= Y[0][0];           \
    trace_off();            \
    forward(0,1,1,d,0,X,Y);         \
    COMPARE_POLYS(c_dtay,Y[0]);         \
  }

Definition at line 200 of file TayUnitTests.hpp.

#define UNARY_FUNC_TEST ( TESTNAME,
FUNC   ) 
Value:
void TESTNAME () {            \
    c_dtay = FUNC (a_dtay);         \
    trace_on(0);            \
    adouble aa, ac;           \
    aa <<= X[0][0];           \
    ac = FUNC (aa);           \
    ac >>= Y[0][0];           \
    trace_off();            \
    forward(0,1,1,d,0,X,Y);         \
    COMPARE_POLYS(c_dtay,Y[0]);         \
  }

Definition at line 213 of file TayUnitTests.hpp.

#define UNARY_ASSIGNOP2_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {            \
    c_dtay = a_dtay;            \
    c_dtay OP b_dtay;           \
    trace_on(0);            \
    adouble aa, ab, ac;           \
    aa <<= X[0][0];           \
    ab <<= X[1][0];           \
    ac = aa;              \
    ac OP ab;             \
    ac >>= Y[0][0];           \
    trace_off();            \
    forward(0,1,2,d,0,X,Y);         \
    COMPARE_POLYS(c_dtay,Y[0]);         \
  }

Definition at line 226 of file TayUnitTests.hpp.

#define UNARY_ASSIGNOPRC_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {            \
    double val = urand.number();        \
    c_dtay = a_dtay;            \
    c_dtay OP val;            \
    trace_on(0);            \
    adouble aa, ac;           \
    aa <<= X[0][0];           \
    ac = aa;              \
    ac OP val;              \
    ac >>= Y[0][0];           \
    trace_off();            \
    forward(0,1,1,d,0,X,Y);         \
    COMPARE_POLYS(c_dtay,Y[0]);         \
  }

Definition at line 242 of file TayUnitTests.hpp.

#define UNARY_ASSIGNOPLC_TEST ( TESTNAME,
OP   ) 
Value:
void TESTNAME () {            \
    double val = urand.number();        \
    c_dtay = val;           \
    c_dtay OP a_dtay;           \
    trace_on(0);            \
    adouble aa, ac;           \
    aa <<= X[0][0];           \
    ac = val;             \
    ac OP aa;             \
    ac >>= Y[0][0];           \
    trace_off();            \
    forward(0,1,1,d,0,X,Y);         \
    COMPARE_POLYS(c_dtay,Y[0]);         \
  }

Definition at line 258 of file TayUnitTests.hpp.

#define UNARY_ASSIGNOP_TEST ( TESTNAME,
OP   ) 
Value:
UNARY_ASSIGNOP2_TEST(TESTNAME,OP);      \
  UNARY_ASSIGNOPLC_TEST(TESTNAME ## LeftConstant,OP); \
  UNARY_ASSIGNOPRC_TEST(TESTNAME ## RightConstant,OP)

Definition at line 274 of file TayUnitTests.hpp.

#define CPPUNIT_UNARY_ASSIGNOP_TEST ( TESTNAME   ) 
Value:
CPPUNIT_TEST(TESTNAME);     \
  CPPUNIT_TEST(TESTNAME ## LeftConstant); \
  CPPUNIT_TEST(TESTNAME ## RightConstant)

Definition at line 279 of file TayUnitTests.hpp.


Function Documentation

adouble max ( const adouble &  a,
const adouble &  b 
) [inline]

Definition at line 43 of file TayUnitTests.hpp.

adouble max ( const adouble &  a,
double  v 
) [inline]

Definition at line 44 of file TayUnitTests.hpp.

adouble max ( double  v,
const adouble &  b 
) [inline]

Definition at line 45 of file TayUnitTests.hpp.

adouble min ( const adouble &  a,
const adouble &  b 
) [inline]

Definition at line 46 of file TayUnitTests.hpp.

adouble min ( const adouble &  a,
double  v 
) [inline]

Definition at line 47 of file TayUnitTests.hpp.

adouble min ( double  v,
const adouble &  b 
) [inline]

Definition at line 48 of file TayUnitTests.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:19:41 2011 for Sacado Package Browser (Single Doxygen Collection) by  doxygen 1.6.3