32 #ifndef FADLAPACKUNITTESTS_HPP 33 #define FADLAPACKUNITTESTS_HPP 41 #include <cppunit/extensions/HelperMacros.h> 43 #define COMPARE_VALUES(a, b) \ 44 CPPUNIT_ASSERT( std::abs(a-b) < this->tol_a + this->tol_r*std::abs(a) ); 46 #define COMPARE_FADS(a, b) \ 47 CPPUNIT_ASSERT(a.size() == b.size()); \ 48 CPPUNIT_ASSERT(a.hasFastAccess() == b.hasFastAccess()); \ 49 COMPARE_VALUES(a.val(), b.val()); \ 50 for (int k=0; k<a.size(); k++) { \ 51 COMPARE_VALUES(a.dx(k), b.dx(k)); \ 52 COMPARE_VALUES(a.fastAccessDx(k), b.fastAccessDx(k)); \ 56 #define COMPARE_FAD_VECTORS(X1, X2, n) \ 57 CPPUNIT_ASSERT(X1.size() == std::size_t(n)); \ 58 CPPUNIT_ASSERT(X2.size() == std::size_t(n)); \ 59 for (unsigned int i=0; i<n; i++) { \ 60 COMPARE_FADS(X1[i], X2[i]); \ 65 template <
class FadType,
class ScalarType>
81 double absolute_tolerance,
double relative_tolerance);
113 template <
class FadType,
class ScalarType>
116 urand(), real_urand(), m(5),
n(6), l(4), ndot(7), tol_a(1.0e-11), tol_r(1.0e-11) {}
118 template <
class FadType,
class ScalarType>
121 double relative_tolerance) :
128 tol_a(absolute_tolerance),
129 tol_r(relative_tolerance) {}
131 template <
class FadType,
class ScalarType>
135 template <
class FadType,
class ScalarType>
140 template <
class FadType,
class ScalarType>
147 double A[] = { 1.1, 0.1, .01, 0.9 };
150 double B[] = { 0.1, 0.2 };
154 const double refX[] = {0.088978766430738, 0.212335692618807};
157 teuchos_lapack.
GESV(
n, nrhs, &
A[0], lda, &IPIV[0], &
B[0], ldb, &info);
167 #undef COMPARE_VALUES 169 #undef COMPARE_FAD_VECTORS 171 #endif // FADLAPACKUNITTESTS_HPP void GESV(const OrdinalType n, const OrdinalType nrhs, ScalarType *A, const OrdinalType lda, OrdinalType *IPIV, ScalarType *B, const OrdinalType ldb, OrdinalType *info) const
A class for storing a contiguously allocated array of Fad objects. This is a general definition that ...
Sacado::Random< ScalarType > urand
CPPUNIT_TEST_SUITE(FadLAPACKUnitTests)
#define COMPARE_VALUES(a, b)
Sacado::Fad::Vector< unsigned int, FadType > VectorType
Sacado::Random< double > real_urand