10 #include <type_traits>
28 struct C :
public A {};
50 template <
typename ad_type>
57 const bool is_value_ad =
59 const bool is_ad_value =
61 const bool is_scalar_ad =
63 const bool is_ad_scalar =
67 const bool is_int_ad =
79 typedef decltype(std::declval<ad_type>()*std::declval<ad_type>()) ad_expr_type;
80 typedef decltype(std::declval<value_type>()*std::declval<value_type>()) val_expr_type;
82 const bool is_ad_expr_ad =
84 const bool is_val_expr_ad =
100 typedef typename ad_type::value_type value_type;
104 success = success && test_ad_conversions<ad_type>(out);
105 success = success && test_ad_conversions<ad_ad_type>(out);
110 x.fastAccessDx(
i) = 2.0;
111 ad_ad_type
y = x +
x;
121 ad_ad_type
z = (x +
x) + y;
148 success = success && test_ad_conversions<ad_type>(out);
149 success = success && test_ad_conversions<ad_ad_type>(out);
164 success = success && test_ad_conversions<ad_type>(out);
165 success = success && test_ad_conversions<fad_ad_type>(out);
175 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions,
Fad_SLFadType )
176 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions,
Fad_SFadType )
177 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions,
Fad_DVFadType )
178 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions,
Fad_SimpleFadType )
179 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ViewConversions,
Fad_VFadType )
185 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, ELRFad_DFadType )
186 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, ELRFad_SLFadType )
187 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, ELRFad_SFadType )
188 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ViewConversions, ELRFad_VFadType )
194 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, CacheFad_DFadType )
195 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, CacheFad_SLFadType )
196 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, CacheFad_SFadType )
197 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ViewConversions, CacheFad_VFadType )
203 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, ELRCacheFad_DFadType )
204 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, ELRCacheFad_SLFadType )
205 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ADConversions, ELRCacheFad_SFadType )
206 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, ViewConversions, ELRCacheFad_VFadType )
211 typedef Sacado::LFad::LogicalSparse<
double,
bool>
LFadType;
212 typedef Sacado::FlopCounterPack::ScalarFlopCounter<
double>
SFCType;
218 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, OtherConversions, LFadType )
219 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, OtherConversions, SFCType )
220 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, OtherConversions, TaylorType )
221 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, OtherConversions, CacheTaylorType )
222 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, OtherConversions, RadType )
223 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, OtherConversions, Rad2Type )
224 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Conversion, OtherConversions, RadVecType )
226 int main(
int argc,
char* argv[] ) {
Sacado::CacheFad::SLFad< double, 10 > Fad_SLFadType
Forward-mode AD class using dynamic memory allocation.
#define TEST_EQUALITY_CONST(v1, v2)
const int global_fad_size
Sacado::CacheFad::DFad< double > Fad_DFadType
GeneralFad< StaticStorage< T, Num > > SLFad
Forward-mode AD class using dynamic memory allocation but no expression templates.
F::template apply< A1, A2, A3, A4, A5 >::type type
TEUCHOS_UNIT_TEST(Conversion, IsConvertible)
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(ConditionalReturnType, Fad, FAD)
Sacado::Fad::DVFad< double > Fad_DVFadType
Sacado::Fad::ViewFad< double, global_fad_size, 1, Fad_DFadType > Fad_VFadType
static int runUnitTestsFromMain(int argc, char *argv[])
GeneralFad< DynamicStorage< T > > DFad
Determine whether a given type is a view.
Sacado::Fad::SimpleFad< double > Fad_SimpleFadType
Forward-mode AD class using dynamic memory allocation and expression templates.
Templated flop counter class.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, TYPE)
#define TEST_EQUALITY(v1, v2)
GeneralFad< ViewStorage< T, static_length, static_stride, U > > ViewFad
bool test_ad_conversions(Teuchos::FancyOStream &out)
GeneralFad< StaticFixedStorage< T, Num > > SFad
Sacado::CacheFad::SFad< double, 5 > Fad_SFadType