Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions
TayUnitTests.hpp File Reference
#include "adolc/adouble.h"
#include "adolc/interfaces.h"
#include "Sacado_No_Kokkos.hpp"
#include "Sacado_Random.hpp"
#include <cppunit/extensions/HelperMacros.h>
#include "Sacado_Tay_CacheTaylor.hpp"
Include dependency graph for TayUnitTests.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TaylorOpsUnitTest< TaylorType >
 
class  CacheTaylorOpsUnitTest
 

Macros

#define COMPARE_DOUBLES(a, b)   CPPUNIT_ASSERT( fabs(a-b) < tol_a + tol_r*fabs(a) );
 
#define COMPARE_POLYS(x_dtay, x_adolc)
 
#define COMPARE_TAYS(x_dtay, y_dtay)
 
#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)
 

Macro Definition Documentation

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

Definition at line 51 of file TayUnitTests.hpp.

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

Definition at line 54 of file TayUnitTests.hpp.

#define COMPARE_TAYS (   x_dtay,
  y_dtay 
)
Value:
CPPUNIT_ASSERT(x_dtay.degree() == y_dtay.degree()); \
for (int i=0; i<=x_dtay.degree(); i++) { \
COMPARE_DOUBLES(x_dtay.coeff(i), y_dtay.coeff(i)); \
} \
;
#define COMPARE_DOUBLES(a, b)

Definition at line 61 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]); \
}
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 68 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]); \
}
expr val()
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 82 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]); \
}
expr val()
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 96 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)
#define BINARY_OP2_TEST(TESTNAME, OP)
#define BINARY_OPRC_TEST(TESTNAME, OP)
#define BINARY_OPLC_TEST(TESTNAME, OP)

Definition at line 110 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 115 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 120 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); \
}
expr val()

Definition at line 127 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); \
}
expr val()

Definition at line 135 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)
#define RELOP_OPRC_TEST(TESTNAME, OP)
#define RELOP_OPLC_TEST(TESTNAME, OP)
#define RELOP_OP2_TEST(TESTNAME, OP)

Definition at line 143 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 148 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]); \
}
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 153 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]); \
}
expr val()
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 167 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]); \
}
expr val()
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 181 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)
#define BINARY_FUNC2_TEST(TESTNAME, FUNC)
#define BINARY_FUNCLC_TEST(TESTNAME, FUNC)
#define BINARY_FUNCRC_TEST(TESTNAME, FUNC)

Definition at line 195 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 200 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]); \
}
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 205 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]); \
}
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 218 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]); \
}
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 231 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]); \
}
expr val()
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 247 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]); \
}
expr val()
#define COMPARE_POLYS(x_dtay, x_adolc)

Definition at line 263 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)
#define UNARY_ASSIGNOPLC_TEST(TESTNAME, OP)
#define UNARY_ASSIGNOPRC_TEST(TESTNAME, OP)
#define UNARY_ASSIGNOP2_TEST(TESTNAME, OP)

Definition at line 279 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 284 of file TayUnitTests.hpp.

Function Documentation

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

Definition at line 41 of file TayUnitTests.hpp.

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

Definition at line 42 of file TayUnitTests.hpp.

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

Definition at line 43 of file TayUnitTests.hpp.

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

Definition at line 44 of file TayUnitTests.hpp.

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

Definition at line 45 of file TayUnitTests.hpp.

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

Definition at line 46 of file TayUnitTests.hpp.