Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
FadUnitTests.hpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Sacado Package
5// Copyright (2006) Sandia Corporation
6//
7// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8// the U.S. Government retains certain rights in this software.
9//
10// This library is free software; you can redistribute it and/or modify
11// it under the terms of the GNU Lesser General Public License as
12// published by the Free Software Foundation; either version 2.1 of the
13// License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23// USA
24// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25// (etphipp@sandia.gov).
26//
27// ***********************************************************************
28// @HEADER
29
30#ifndef FADUNITTESTS_HPP
31#define FADUNITTESTS_HPP
32
33// Sacado includes
34#include "Sacado_No_Kokkos.hpp"
35#include "Sacado_Random.hpp"
36
37// Fad includes
38#include "Fad/fad.h"
39
40// gtest includes
41#include <gtest/gtest.h>
42
43#include "GTestUtils.hpp"
44
45// A class for testing each Fad operation
46template <typename FadType>
48protected:
50
51 // DFad variables
53
54 // Fad variables
55 FAD::Fad<ScalarType> a_fad_, b_fad_, c_fad_;
56
57 // Random number generator
59
60 // Number of derivative components
61 int n;
62
63 // Tolerances to which fad objects should be the same
65
66 FadOpsUnitTest() : urand(), n(5), tol_a(1.0e-15), tol_r(1.0e-12) {}
67
68 void SetUp() override {
70
71 val = urand.number();
73 a_fad_ = FAD::Fad<ScalarType>(n,val);
74
75 val = urand.number();
77 b_fad_ = FAD::Fad<ScalarType>(n,val);
78
79 for (int i=0; i<n; i++) {
80 val = urand.number();
81 a_dfad_.fastAccessDx(i) = val;
82 a_fad_.fastAccessDx(i) = val;
83
84 val = urand.number();
85 b_dfad_.fastAccessDx(i) = val;
86 b_fad_.fastAccessDx(i) = val;
87 }
88
89 val = 0.0;
90 c_dfad_ = FadType(n, val);
91 c_fad_ = FAD::Fad<ScalarType>(n,val);
92 }
93
94 void TearDown() override {}
95
96 template <typename ScalarT>
97 ScalarT composite1(const ScalarT& a, const ScalarT& b) {
98 ScalarT t1 = 3. * a + sin(b) / log(fabs(a - b * 7.));
99 ScalarT t2 = 1.0e3;
100 ScalarT t3 = 5.7e4;
101 ScalarT t4 = 3.2e5;
102 t1 *= cos(a + exp(t1)) / 6. - tan(t1*sqrt(abs(a * log10(abs(b)))));
103 t1 -= acos((6.+asin(pow(fabs(a),b)/t2))/t3) * asin(pow(fabs(b),2.)*1.0/t4) * atan((b*pow(2.,log(abs(a))))/(t3*t4));
104 t1 /= cosh(b - 0.7) + 7.*sinh(t1 + 0.8)*tanh(9./a) - 9.;
105 t1 += pow(abs(a*4.),b-8.)/cos(a*b*a);
106
107 return t1;
108 }
109
110}; // class FadOpsUnitTest
111
113
114#define BINARY_OP_TEST(FIXTURENAME,TESTNAME,OP) \
115 TYPED_TEST_P(FIXTURENAME, TESTNAME) { \
116 auto a_dfad = this->a_dfad_; \
117 auto b_dfad = this->b_dfad_; \
118 auto c_dfad = this->c_dfad_; \
119 auto a_fad = this->a_fad_; \
120 auto b_fad = this->b_fad_; \
121 auto c_fad = this->c_fad_; \
122 c_dfad = a_dfad OP b_dfad; \
123 c_fad = a_fad OP b_fad; \
124 COMPARE_FADS(c_dfad, c_fad); \
125 \
126 double val = this->urand.number(); \
127 c_dfad = a_dfad OP val; \
128 c_fad = a_fad OP val; \
129 COMPARE_FADS(c_dfad, c_fad); \
130 \
131 c_dfad = val OP b_dfad; \
132 c_fad = val OP b_fad; \
133 COMPARE_FADS(c_dfad, c_fad); \
134 }
135
136#define RELOP_TEST(FIXTURENAME,TESTNAME,OP) \
137 TYPED_TEST_P(FIXTURENAME, TESTNAME) { \
138 auto a_dfad = this->a_dfad_; \
139 auto b_dfad = this->b_dfad_; \
140 auto a_fad = this->a_fad_; \
141 auto b_fad = this->b_fad_; \
142 bool r1 = a_dfad OP b_dfad; \
143 bool r2 = a_fad OP b_fad; \
144 ASSERT_TRUE(r1 == r2); \
145 \
146 double val = this->urand.number(); \
147 r1 = a_dfad OP val; \
148 r2 = a_fad OP val; \
149 ASSERT_TRUE(r1 == r2); \
150 \
151 r1 = val OP b_dfad; \
152 r2 = val OP b_fad; \
153 ASSERT_TRUE(r1 == r2); \
154 }
155
156#define BINARY_FUNC_TEST(FIXTURENAME,TESTNAME,FUNC) \
157 TYPED_TEST_P(FIXTURENAME, TESTNAME) { \
158 auto a_dfad = this->a_dfad_; \
159 auto b_dfad = this->b_dfad_; \
160 auto c_dfad = this->c_dfad_; \
161 auto a_fad = this->a_fad_; \
162 auto b_fad = this->b_fad_; \
163 auto c_fad = this->c_fad_; \
164 c_dfad = FUNC (a_dfad,b_dfad); \
165 c_fad = FUNC (a_fad,b_fad); \
166 COMPARE_FADS(c_dfad, c_fad); \
167 \
168 double val = this->urand.number(); \
169 c_dfad = FUNC (a_dfad,val); \
170 c_fad = FUNC (a_fad,val); \
171 COMPARE_FADS(c_dfad, c_fad); \
172 \
173 c_dfad = FUNC (val,b_dfad); \
174 c_fad = FUNC (val,b_fad); \
175 COMPARE_FADS(c_dfad, c_fad); \
176 }
177
178#define UNARY_OP_TEST(FIXTURENAME,TESTNAME,OP) \
179 TYPED_TEST_P(FIXTURENAME, TESTNAME) { \
180 auto a_dfad = this->a_dfad_; \
181 auto c_dfad = this->c_dfad_; \
182 auto a_fad = this->a_fad_; \
183 auto c_fad = this->c_fad_; \
184 c_dfad = OP a_dfad; \
185 c_fad = OP a_fad; \
186 COMPARE_FADS(c_dfad, c_fad); \
187 }
188
189#define UNARY_FUNC_TEST(FIXTURENAME,TESTNAME,FUNC) \
190 TYPED_TEST_P(FIXTURENAME, TESTNAME) { \
191 auto a_dfad = this->a_dfad_; \
192 auto c_dfad = this->c_dfad_; \
193 auto a_fad = this->a_fad_; \
194 auto c_fad = this->c_fad_; \
195 c_dfad = FUNC (a_dfad); \
196 c_fad = FUNC (a_fad); \
197 COMPARE_FADS(c_dfad, c_fad); \
198 }
199
200#define UNARY_ASSIGNOP_TEST(FIXTURENAME,TESTNAME,OP) \
201 TYPED_TEST_P(FIXTURENAME, TESTNAME){ \
202 auto a_dfad = this->a_dfad_; \
203 auto b_dfad = this->b_dfad_; \
204 auto c_dfad = this->c_dfad_; \
205 auto a_fad = this->a_fad_; \
206 auto b_fad = this->b_fad_; \
207 auto c_fad = this->c_fad_; \
208 c_dfad = b_dfad; \
209 c_fad = b_fad; \
210 c_dfad OP a_dfad; \
211 c_fad OP a_fad; \
212 COMPARE_FADS(c_dfad, c_fad); \
213 \
214 double val = this->urand.number(); \
215 c_dfad OP val; \
216 c_fad OP val; \
217 COMPARE_FADS(c_dfad, c_fad); \
218 }
219
220BINARY_OP_TEST(FadOpsUnitTest, testAddition, +)
221BINARY_OP_TEST(FadOpsUnitTest, testSubtraction, -)
222BINARY_OP_TEST(FadOpsUnitTest, testMultiplication, *)
223BINARY_OP_TEST(FadOpsUnitTest, testDivision, /)
224
225RELOP_TEST(FadOpsUnitTest, testEquals, ==)
226RELOP_TEST(FadOpsUnitTest, testNotEquals, !=)
227RELOP_TEST(FadOpsUnitTest, testLessThanOrEquals, <=)
228RELOP_TEST(FadOpsUnitTest, testGreaterThanOrEquals, >=)
229RELOP_TEST(FadOpsUnitTest, testLessThan, <)
230RELOP_TEST(FadOpsUnitTest, testGreaterThan, >)
231
232BINARY_FUNC_TEST(FadOpsUnitTest, testPow, pow)
233
234UNARY_OP_TEST(FadOpsUnitTest, testUnaryPlus, +)
235UNARY_OP_TEST(FadOpsUnitTest, testUnaryMinus, -)
236
237UNARY_FUNC_TEST(FadOpsUnitTest, testExp, exp)
238UNARY_FUNC_TEST(FadOpsUnitTest, testLog, log)
239UNARY_FUNC_TEST(FadOpsUnitTest, testLog10, log10)
240UNARY_FUNC_TEST(FadOpsUnitTest, testSqrt, sqrt)
241UNARY_FUNC_TEST(FadOpsUnitTest, testCos, cos)
242UNARY_FUNC_TEST(FadOpsUnitTest, testSin, sin)
243UNARY_FUNC_TEST(FadOpsUnitTest, testTan, tan)
244UNARY_FUNC_TEST(FadOpsUnitTest, testACos, acos)
245UNARY_FUNC_TEST(FadOpsUnitTest, testASin, asin)
246UNARY_FUNC_TEST(FadOpsUnitTest, testATan, atan)
247UNARY_FUNC_TEST(FadOpsUnitTest, testCosh, cosh)
248UNARY_FUNC_TEST(FadOpsUnitTest, testSinh, sinh)
249UNARY_FUNC_TEST(FadOpsUnitTest, testTanh, tanh)
250UNARY_FUNC_TEST(FadOpsUnitTest, testAbs, abs)
251UNARY_FUNC_TEST(FadOpsUnitTest, testFAbs, fabs)
252
253UNARY_ASSIGNOP_TEST(FadOpsUnitTest, testPlusEquals, +=)
254UNARY_ASSIGNOP_TEST(FadOpsUnitTest, testMinusEquals, -=)
255UNARY_ASSIGNOP_TEST(FadOpsUnitTest, testTimesEquals, *=)
256UNARY_ASSIGNOP_TEST(FadOpsUnitTest, testDivideEquals, /=)
257
259 typedef decltype(this->a_dfad_) FadType;
260 typedef typename Sacado::ScalarType<FadType>::type ScalarType;
261
262 ScalarType val;
263
264 auto a_dfad = this->a_dfad_;
265 auto b_dfad = this->b_dfad_;
266 auto c_dfad = this->c_dfad_;
267 auto a_fad = this->a_fad_;
268 auto b_fad = this->b_fad_;
269 auto c_fad = this->c_fad_;
270
271 FadType aa_dfad = a_dfad + 1.0;
272 c_dfad = max(aa_dfad, a_dfad);
273 COMPARE_VALUES(c_dfad.val(), aa_dfad.val());
274 for (int i=0; i<this->n; i++) {
275 COMPARE_VALUES(c_dfad.dx(i), aa_dfad.dx(i));
276 COMPARE_VALUES(c_dfad.fastAccessDx(i), aa_dfad.fastAccessDx(i));
277 }
278
279 c_dfad = max(a_dfad, aa_dfad);
280 COMPARE_VALUES(c_dfad.val(), aa_dfad.val());
281 for (int i=0; i<this->n; i++) {
282 COMPARE_VALUES(c_dfad.dx(i), aa_dfad.dx(i));
283 COMPARE_VALUES(c_dfad.fastAccessDx(i), aa_dfad.fastAccessDx(i));
284 }
285
286 c_dfad = max(a_dfad+1.0, a_dfad);
287 COMPARE_VALUES(c_dfad.val(), aa_dfad.val());
288 for (int i=0; i<this->n; i++) {
289 COMPARE_VALUES(c_dfad.dx(i), aa_dfad.dx(i));
290 COMPARE_VALUES(c_dfad.fastAccessDx(i), aa_dfad.fastAccessDx(i));
291 }
292
293 c_dfad = max(a_dfad, a_dfad+1.0);
294 COMPARE_VALUES(c_dfad.val(), aa_dfad.val());
295 for (int i=0; i<this->n; i++) {
296 COMPARE_VALUES(c_dfad.dx(i), aa_dfad.dx(i));
297 COMPARE_VALUES(c_dfad.fastAccessDx(i), aa_dfad.fastAccessDx(i));
298 }
299
300 val = a_dfad.val() + 1;
301 c_dfad = max(a_dfad, val);
302 COMPARE_VALUES(c_dfad.val(), val);
303 for (int i=0; i<this->n; i++)
304 COMPARE_VALUES(c_dfad.dx(i), 0.0);
305
306 val = a_dfad.val() - 1;
307 c_dfad = max(a_dfad, val);
308 COMPARE_VALUES(c_dfad.val(), a_dfad.val());
309 for (int i=0; i<this->n; i++) {
310 COMPARE_VALUES(c_dfad.dx(i), a_dfad.dx(i));
311 COMPARE_VALUES(c_dfad.fastAccessDx(i), a_dfad.fastAccessDx(i));
312 }
313
314 val = b_dfad.val() + 1;
315 c_dfad = max(val, b_dfad);
316 COMPARE_VALUES(c_dfad.val(), val);
317 for (int i=0; i<this->n; i++)
318 COMPARE_VALUES(c_dfad.dx(i), 0.0);
319
320 val = b_dfad.val() - 1;
321 c_dfad = max(val, b_dfad);
322 COMPARE_VALUES(c_dfad.val(), b_dfad.val());
323 for (int i=0; i<this->n; i++) {
324 COMPARE_VALUES(c_dfad.dx(i), b_dfad.dx(i));
325 COMPARE_VALUES(c_dfad.fastAccessDx(i), b_dfad.fastAccessDx(i));
326 }
327}
328
330 typedef decltype(this->a_dfad_) FadType;
331 typedef typename Sacado::ScalarType<FadType>::type ScalarType;
332
333 ScalarType val;
334
335 auto a_dfad = this->a_dfad_;
336 auto b_dfad = this->b_dfad_;
337 auto c_dfad = this->c_dfad_;
338 auto a_fad = this->a_fad_;
339 auto b_fad = this->b_fad_;
340 auto c_fad = this->c_fad_;
341
342 FadType aa_dfad = a_dfad - 1.0;
343 c_dfad = min(aa_dfad, a_dfad);
344 COMPARE_VALUES(c_dfad.val(), aa_dfad.val());
345 for (int i=0; i<this->n; i++) {
346 COMPARE_VALUES(c_dfad.dx(i), aa_dfad.dx(i));
347 COMPARE_VALUES(c_dfad.fastAccessDx(i), aa_dfad.fastAccessDx(i));
348 }
349
350 c_dfad = min(a_dfad, aa_dfad);
351 COMPARE_VALUES(c_dfad.val(), aa_dfad.val());
352 for (int i=0; i<this->n; i++) {
353 COMPARE_VALUES(c_dfad.dx(i), aa_dfad.dx(i));
354 COMPARE_VALUES(c_dfad.fastAccessDx(i), aa_dfad.fastAccessDx(i));
355 }
356
357 val = a_dfad.val() - 1;
358 c_dfad = min(a_dfad, val);
359 COMPARE_VALUES(c_dfad.val(), val);
360 for (int i=0; i<this->n; i++)
361 COMPARE_VALUES(c_dfad.dx(i), 0.0);
362
363 val = a_dfad.val() + 1;
364 c_dfad = min(a_dfad, val);
365 COMPARE_VALUES(c_dfad.val(), a_dfad.val());
366 for (int i=0; i<this->n; i++) {
367 COMPARE_VALUES(c_dfad.dx(i), a_dfad.dx(i));
368 COMPARE_VALUES(c_dfad.fastAccessDx(i), a_dfad.fastAccessDx(i));
369 }
370
371 val = b_dfad.val() - 1;
372 c_dfad = min(val, b_dfad);
373 COMPARE_VALUES(c_dfad.val(), val);
374 for (int i=0; i<this->n; i++)
375 COMPARE_VALUES(c_dfad.dx(i), 0.0);
376
377 val = b_dfad.val() + 1;
378 c_dfad = min(val, b_dfad);
379 COMPARE_VALUES(c_dfad.val(), b_dfad.val());
380 for (int i=0; i<this->n; i++) {
381 COMPARE_VALUES(c_dfad.dx(i), b_dfad.dx(i));
382 COMPARE_VALUES(c_dfad.fastAccessDx(i), b_dfad.fastAccessDx(i));
383 }
384}
385
386TYPED_TEST_P(FadOpsUnitTest, testComposite1) {
387 auto a_dfad = this->a_dfad_;
388 auto b_dfad = this->b_dfad_;
389 auto c_dfad = this->c_dfad_;
390 auto a_fad = this->a_fad_;
391 auto b_fad = this->b_fad_;
392 auto c_fad = this->c_fad_;
393
394 c_dfad = this->composite1(a_dfad, b_dfad);
395 c_fad = this->composite1(a_fad, b_fad);
396 COMPARE_FADS(c_dfad, c_fad);
397}
398
400 typedef decltype(this->a_dfad_) FadType;
401 typedef typename Sacado::ScalarType<FadType>::type ScalarType;
402
403 auto a_dfad = this->a_dfad_;
404 auto b_dfad = this->b_dfad_;
405 auto a_fad = this->a_fad_;
406 auto b_fad = this->b_fad_;
407
408 FadType aa_dfad = a_dfad;
409 FAD::Fad<ScalarType> aa_fad = a_fad;
410 aa_dfad = 1.0;
411 aa_fad = 1.0;
412 aa_dfad = aa_dfad + b_dfad;
413 aa_fad = aa_fad + b_fad;
414 COMPARE_FADS(aa_dfad, aa_fad);
415}
416
418 typedef decltype(this->a_dfad_) FadType;
419 typedef typename Sacado::ScalarType<FadType>::type ScalarType;
420
421 auto a_dfad = this->a_dfad_;
422 auto b_dfad = this->b_dfad_;
423 auto a_fad = this->a_fad_;
424 auto b_fad = this->b_fad_;
425
426 FadType aa_dfad = a_dfad;
427 FAD::Fad<ScalarType> aa_fad = a_fad;
428 aa_dfad = 1.0;
429 aa_fad = 1.0;
430 aa_dfad = aa_dfad - b_dfad;
431 aa_fad = aa_fad - b_fad;
432 COMPARE_FADS(aa_dfad, aa_fad);
433}
434
436 typedef decltype(this->a_dfad_) FadType;
437 typedef typename Sacado::ScalarType<FadType>::type ScalarType;
438
439 auto a_dfad = this->a_dfad_;
440 auto b_dfad = this->b_dfad_;
441 auto a_fad = this->a_fad_;
442 auto b_fad = this->b_fad_;
443
444 FadType aa_dfad = a_dfad;
445 FAD::Fad<ScalarType> aa_fad = a_fad;
446 aa_dfad = 2.0;
447 aa_fad = 2.0;
448 aa_dfad = aa_dfad * b_dfad;
449 aa_fad = aa_fad * b_fad;
450 COMPARE_FADS(aa_dfad, aa_fad);
451}
452
454 typedef decltype(this->a_dfad_) FadType;
455 typedef typename Sacado::ScalarType<FadType>::type ScalarType;
456
457 auto a_dfad = this->a_dfad_;
458 auto b_dfad = this->b_dfad_;
459 auto a_fad = this->a_fad_;
460 auto b_fad = this->b_fad_;
461
462 FadType aa_dfad = a_dfad;
463 FAD::Fad<ScalarType> aa_fad = a_fad;
464 aa_dfad = 2.0;
465 aa_fad = 2.0;
466 aa_dfad = aa_dfad / b_dfad;
467 aa_fad = aa_fad / b_fad;
468 COMPARE_FADS(aa_dfad, aa_fad);
469}
470
471 // Check various corner cases for pow()
473 typedef decltype(this->a_dfad_) FadType;
474
475 FadType a, b, c, cc;
476
477 // Constant b
478 a = FadType(this->n,1.2345);
479 for (int i=0; i<this->n; ++i)
480 a.fastAccessDx(i) = this->urand.number();
481 b = 3.456;
482 c = pow(a, b);
483 cc = FadType(this->n, pow(a.val(),b.val()));
484 for (int i=0; i<this->n; ++i)
485 cc.fastAccessDx(i) = b.val()*pow(a.val(),b.val()-1)*a.dx(i);
486 COMPARE_FADS(c, cc);
487
488 // Constant scalar b
489 c = pow(a, b.val());
490 COMPARE_FADS(c, cc);
491
492 // Constant b == 0
493 b = 0.0;
494 c = pow(a, b);
495 cc.val() = 1.0;
496 for (int i=0; i<this->n; ++i)
497 cc.fastAccessDx(i) = 0.0;
498 COMPARE_FADS(c, cc);
499
500 // Constant scalar b == 0
501 c = pow(a, b.val());
502 COMPARE_FADS(c, cc);
503
504 // a == 0 and constant b
505 a.val() = 0.0;
506 b = 3.456;
507 c = pow(a, b);
508 cc.val() = 0.0;
509 for (int i=0; i<this->n; ++i)
510 cc.fastAccessDx(i) = 0.0;
511 COMPARE_FADS(c, cc);
512
513 // a == 0 and constant scalar b
514 c = pow(a, b.val());
515 COMPARE_FADS(c, cc);
516
517 // a == 0 and b == 0
518 b = 0.0;
519 c = pow(a, b);
520 cc.val() = 1.0;
521 for (int i=0; i<this->n; ++i)
522 cc.fastAccessDx(i) = 0.0;
523 COMPARE_FADS(c, cc);
524
525 // a == 0 and scalar b == 0
526 c = pow(a, b.val());
527 COMPARE_FADS(c, cc);
528
529 // a == 0 and b == 1
530 b = 1.0;
531 c = pow(a, b);
532 cc = a;
534 COMPARE_FADS(c, cc);
535 }
536 c = pow(a, b.val());
537 COMPARE_FADS(c, cc);
538
539 // a == 0 and b == 2
540 b = 2.0;
541 c = pow(a, b);
542 cc = a*a;
544 COMPARE_FADS(c, cc);
545 }
546 c = pow(a, b.val());
547 COMPARE_FADS(c, cc);
548}
549
552 testAddition,
553 testSubtraction,
554 testMultiplication,
555 testDivision,
556 testEquals,
557 testNotEquals,
558 testLessThanOrEquals,
559 testGreaterThanOrEquals,
560 testLessThan,
561 testGreaterThan,
562 testPow,
563 testUnaryPlus,
564 testUnaryMinus,
565 testExp,
566 testLog,
567 testLog10,
568 testSqrt,
569 testCos,
570 testSin,
571 testTan,
572 testACos,
573 testASin,
574 testATan,
575 testCosh,
576 testSinh,
577 testTanh,
578 testAbs,
579 testFAbs,
580 testPlusEquals,
581 testMinusEquals,
582 testTimesEquals,
583 testDivideEquals,
584 testMax,
585 testMin,
586 testComposite1,
587 testPlusLR,
588 testMinusLR,
589 testTimesLR,
590 testDivideLR,
591 testPowConstB);
592
593#endif // FADUNITTESTS_HPP
#define RELOP_TEST(FIXTURENAME, TESTNAME, OP)
#define UNARY_FUNC_TEST(FIXTURENAME, TESTNAME, FUNC)
TYPED_TEST_P(FadOpsUnitTest, testMax)
#define UNARY_OP_TEST(FIXTURENAME, TESTNAME, OP)
TYPED_TEST_SUITE_P(FadOpsUnitTest)
#define UNARY_ASSIGNOP_TEST(FIXTURENAME, TESTNAME, OP)
#define BINARY_FUNC_TEST(FIXTURENAME, TESTNAME, FUNC)
#define BINARY_OP_TEST(FIXTURENAME, TESTNAME, OP)
REGISTER_TYPED_TEST_SUITE_P(FadOpsUnitTest, testAddition, testSubtraction, testMultiplication, testDivision, testEquals, testNotEquals, testLessThanOrEquals, testGreaterThanOrEquals, testLessThan, testGreaterThan, testPow, testUnaryPlus, testUnaryMinus, testExp, testLog, testLog10, testSqrt, testCos, testSin, testTan, testACos, testASin, testATan, testCosh, testSinh, testTanh, testAbs, testFAbs, testPlusEquals, testMinusEquals, testTimesEquals, testDivideEquals, testMax, testMin, testComposite1, testPlusLR, testMinusLR, testTimesLR, testDivideLR, testPowConstB)
#define COMPARE_VALUES(a, b)
#define COMPARE_FADS(a, b)
fabs(expr.val())
log(expr.val())
tan(expr.val())
abs(expr.val())
cos(expr.val())
cosh(expr.val())
acos(expr.val())
sin(expr.val())
sinh(expr.val())
log10(expr.val())
exp(expr.val())
atan(expr.val())
expr val()
sqrt(expr.val())
tanh(expr.val())
asin(expr.val())
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
adouble max(const adouble &a, const adouble &b)
adouble min(const adouble &a, const adouble &b)
Sacado::Fad::DFad< double > FadType
ScalarType tol_a
FAD::Fad< ScalarType > b_fad_
ScalarType tol_r
Sacado::ScalarType< FadType >::type ScalarType
void SetUp() override
FAD::Fad< ScalarType > a_fad_
FAD::Fad< ScalarType > c_fad_
void TearDown() override
Sacado::Random< ScalarType > urand
ScalarT composite1(const ScalarT &a, const ScalarT &b)
A random number generator that generates random numbers uniformly distributed in the interval (a,...
Base template specification for testing whether type is statically sized.