30#include "Teuchos_UnitTestHarness.hpp"
31#include "Teuchos_UnitTestRepository.hpp"
32#include "Teuchos_GlobalMPISession.hpp"
33#include "Teuchos_TestingHelpers.hpp"
48 for (
int i=0; i<
N; ++i)
49 x.fastAccessDx(i) = 2.0;
50 ad_type y = safe_sqrt(x);
52 TEST_EQUALITY( y.val(), z.val() );
53 for (
int i=0; i<
N; ++i)
54 TEST_EQUALITY( y.dx(i), z.dx(i) );
59 TEST_EQUALITY_CONST( y.val(), 0.0 );
60 for (
int i=0; i<
N; ++i)
61 TEST_EQUALITY_CONST( y.dx(i), 0.0 );
66 double c = std::sqrt(
a);
67 TEST_EQUALITY( b,
c );
73TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SafeSqrt, SafeSqrt,
Fad_DFadType )
74TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SafeSqrt, SafeSqrt,
Fad_SLFadType )
75TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SafeSqrt, SafeSqrt,
Fad_SFadType )
80TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SafeSqrt, SafeSqrt,
ELRFad_DFadType )
82TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SafeSqrt, SafeSqrt,
ELRFad_SFadType )
98#if defined(SACADO_ENABLE_NEW_DESIGN) && !defined(SACADO_NEW_FAD_DESIGN_IS_DEFAULT)
102TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SafeSqrt, SafeSqrt, ExpFad_DFadType )
103TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SafeSqrt, SafeSqrt, ExpFad_SLFadType )
104TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SafeSqrt, SafeSqrt, ExpFad_SFadType )
107int main(
int argc,
char* argv[] ) {
108 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
109 return Teuchos::UnitTestRepository::runUnitTestsFromMain(argc, argv);
Sacado::CacheFad::SLFad< double, 10 > Fad_SLFadType
Sacado::CacheFad::SFad< double, 5 > Fad_SFadType
Sacado::CacheFad::DFad< double > Fad_DFadType
Sacado::ELRFad::SLFad< double, global_fad_size > ELRFad_SLFadType
Sacado::ELRCacheFad::SLFad< double, global_fad_size > ELRCacheFad_SLFadType
Sacado::ELRFad::DFad< double > ELRFad_DFadType
Sacado::CacheFad::DFad< double > CacheFad_DFadType
Sacado::ELRFad::SFad< double, global_fad_size > ELRFad_SFadType
Sacado::CacheFad::SLFad< double, global_fad_size > CacheFad_SLFadType
Sacado::ELRCacheFad::DFad< double > ELRCacheFad_DFadType
Sacado::ELRCacheFad::SFad< double, global_fad_size > ELRCacheFad_SFadType
Sacado::CacheFad::SFad< double, global_fad_size > CacheFad_SFadType
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 c
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(SafeSqrt, SafeSqrt, AD)
GeneralFad< DynamicStorage< T > > DFad
GeneralFad< StaticStorage< T, Num > > SLFad
GeneralFad< StaticFixedStorage< T, Num > > SFad
SACADO_INLINE_FUNCTION T safe_sqrt(const T &x)