Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Sacado_Fad_GeneralFad_MP_Vector.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//
29// The forward-mode AD classes in Sacado are a derivative work of the
30// expression template classes in the Fad package by Nicolas Di Cesare.
31// The following banner is included in the original Fad source code:
32//
33// ************ DO NOT REMOVE THIS BANNER ****************
34//
35// Nicolas Di Cesare <Nicolas.Dicesare@ann.jussieu.fr>
36// http://www.ann.jussieu.fr/~dicesare
37//
38// CEMRACS 98 : C++ courses,
39// templates : new C++ techniques
40// for scientific computing
41//
42//********************************************************
43//
44// A short implementation ( not all operators and
45// functions are overloaded ) of 1st order Automatic
46// Differentiation in forward mode (FAD) using
47// EXPRESSION TEMPLATES.
48//
49//********************************************************
50// @HEADER
51
52#ifndef SACADO_FAD_GENERALFAD_MP_VECTOR_HPP
53#define SACADO_FAD_GENERALFAD_MP_VECTOR_HPP
54
55#include "Sacado_Fad_GeneralFad.hpp"
57
58namespace Stokhos {
59 template <typename Ord, typename Val, int Num, typename Dev>
60 class StaticFixedStorage;
61}
62
63namespace Sacado {
64
65 namespace MP {
66 template <typename S> class Vector;
67 }
68
69 namespace Fad {
70
71 template <typename Ord, typename Val, int VecNum, typename Dev,
72 typename Storage>
73 struct ExprSpec< GeneralFad< Sacado::MP::Vector< Stokhos::StaticFixedStorage<Ord,Val,VecNum,Dev> >, Storage > > {
75 };
76
78
83 template <typename Ord, typename Val, int VecNum, typename Dev,
84 typename Storage>
85 class GeneralFad< Sacado::MP::Vector< Stokhos::StaticFixedStorage<Ord,Val,VecNum,Dev> >, Storage> : public Storage {
86
87 public:
88
90
92 typedef typename RemoveConst<T>::type value_type;
93
95 typedef typename ScalarType<value_type>::type scalar_type;
96
97 typedef typename value_type::value_type val_type;
98
103
105 KOKKOS_INLINE_FUNCTION
106 GeneralFad() : Storage(T(0.)) {}
107
109
112 template <typename S>
113 KOKKOS_INLINE_FUNCTION
114 GeneralFad(const S& x, SACADO_ENABLE_VALUE_CTOR_DECL) :
115 Storage(x) {}
116
118
121 KOKKOS_INLINE_FUNCTION
122 GeneralFad(const int sz, const T & x, const DerivInit zero_out = InitDerivArray) :
123 Storage(sz, x, zero_out) {}
124
126
131 KOKKOS_INLINE_FUNCTION
132 GeneralFad(const int sz, const int i, const T & x) :
133 Storage(sz, x) {
134 this->fastAccessDx(i)=1.;
135 }
136
138 KOKKOS_INLINE_FUNCTION
139 GeneralFad(const Storage& s) : Storage(s) {}
140
142 KOKKOS_INLINE_FUNCTION
143 GeneralFad(const GeneralFad& x) :
144 Storage(x) {}
145
147 template <typename S>
148 KOKKOS_INLINE_FUNCTION
149 GeneralFad(const Expr<S>& x, SACADO_ENABLE_EXPR_CTOR_DECL) :
150 Storage(x.size(), T(0.))
151 {
152 const int sz = x.size();
153
154 if (sz) {
155 if (x.hasFastAccess())
156 for(int i=0; i<sz; ++i)
157 for (int j=0; j<VecNum; ++j)
158 fastAccessDx(i,j) = x.fastAccessDx(i,j);
159 else
160 for(int i=0; i<sz; ++i)
161 for (int j=0; j<VecNum; ++j)
162 fastAccessDx(i,j) = x.dx(i,j);
163 }
164
165 for (int j=0; j<VecNum; ++j)
166 val(j) = x.val(j);
167 }
168
170 KOKKOS_INLINE_FUNCTION
172
174
180 KOKKOS_INLINE_FUNCTION
181 void diff(const int ith, const int n) {
182 if (this->size() != n)
183 this->resize(n);
184
185 this->zero();
186 this->fastAccessDx(ith) = T(1.);
187 }
188
190 KOKKOS_INLINE_FUNCTION
191 void setUpdateValue(bool update_val) { }
192
194 KOKKOS_INLINE_FUNCTION
195 bool updateValue() const { return true; }
196
198 template <typename S>
199 KOKKOS_INLINE_FUNCTION
200 SACADO_ENABLE_EXPR_FUNC(bool) isEqualTo(const Expr<S>& x) const {
201 typedef IsEqual<value_type> IE;
202 if (x.size() != this->size()) return false;
203 bool eq = IE::eval(x.val(), this->val());
204 for (int i=0; i<this->size(); i++)
205 eq = eq && IE::eval(x.dx(i), this->dx(i));
206 return eq;
207 }
208
210
215
217 KOKKOS_INLINE_FUNCTION
218 const T& val() const { return Storage::val();}
219
221 KOKKOS_INLINE_FUNCTION
222 T& val() { return Storage::val();}
223
225 KOKKOS_INLINE_FUNCTION
226 const val_type& val(int j) const { return Storage::val().fastAccessCoeff(j);}
227
229 KOKKOS_INLINE_FUNCTION
230 val_type& val(int j) { return Storage::val().fastAccessCoeff(j);}
231
233
238
243 KOKKOS_INLINE_FUNCTION
244 int availableSize() const { return this->length(); }
245
247 KOKKOS_INLINE_FUNCTION
248 bool hasFastAccess() const { return this->size()!=0; }
249
251 KOKKOS_INLINE_FUNCTION
252 bool isPassive() const { return this->size()==0; }
253
255 KOKKOS_INLINE_FUNCTION
256 void setIsConstant(bool is_const) {
257 if (is_const && this->size()!=0)
258 this->resize(0);
259 }
260
262 KOKKOS_INLINE_FUNCTION
263 const T* dx() const { return this->dx_; }
264
266 KOKKOS_INLINE_FUNCTION
267 T dx(int i) const { return this->size() ? this->dx_[i] : T(0.); }
268
270 KOKKOS_INLINE_FUNCTION
271 T& fastAccessDx(int i) { return this->dx_[i];}
272
274 KOKKOS_INLINE_FUNCTION
275 const T& fastAccessDx(int i) const { return this->dx_[i];}
276
278 KOKKOS_INLINE_FUNCTION
279 val_type dx(int i, int j) const { return this->size() ? this->dx_[i].fastAccessCoeff(j) : val_type(0.0); }
280
282 KOKKOS_INLINE_FUNCTION
283 val_type& fastAccessDx(int i, int j) {
284 return this->dx_[i].fastAccessCoeff(j);
285 }
286
288 KOKKOS_INLINE_FUNCTION
289 const val_type& fastAccessDx(int i, int j) const {
290 return this->dx_[i].fastAccessCoeff(j);
291 }
292
294
299
301 template <typename S>
302 KOKKOS_INLINE_FUNCTION
303 SACADO_ENABLE_VALUE_FUNC(GeneralFad&) operator=(const S& v) {
304 this->val() = v;
305 if (this->size()) this->resize(0);
306 return *this;
307 }
308
310 KOKKOS_INLINE_FUNCTION
311 GeneralFad&
312 operator=(const GeneralFad& x) {
313 // Copy value & dx_
314 Storage::operator=(x);
315 return *this;
316 }
317
319 template <typename S>
320 KOKKOS_INLINE_FUNCTION
321 SACADO_ENABLE_EXPR_FUNC(GeneralFad&) operator=(const Expr<S>& x) {
322 const int xsz = x.size();
323
324 if (xsz != this->size())
325 this->resizeAndZero(xsz);
326
327 const int sz = this->size();
328
329 // For ViewStorage, the resize above may not in fact resize the
330 // derivative array, so it is possible that sz != xsz at this point.
331 // The only valid use case here is sz > xsz == 0, so we use sz in the
332 // assignment below
333
334 if (sz) {
335 if (x.hasFastAccess())
336 for(int i=0; i<sz; ++i)
337 for (int j=0; j<VecNum; ++j)
338 fastAccessDx(i,j) = x.fastAccessDx(i,j);
339 else
340 for(int i=0; i<sz; ++i)
341 for (int j=0; j<VecNum; ++j)
342 fastAccessDx(i,j) = x.dx(i,j);
343 }
344
345 for (int j=0; j<VecNum; ++j)
346 val(j) = x.val(j);
347
348 return *this;
349 }
350
352
357
359 template <typename S>
360 KOKKOS_INLINE_FUNCTION
361 SACADO_ENABLE_VALUE_FUNC(GeneralFad&) operator += (const S& v) {
362 this->val() += v;
363 return *this;
364 }
365
367 template <typename S>
368 KOKKOS_INLINE_FUNCTION
369 SACADO_ENABLE_VALUE_FUNC(GeneralFad&) operator -= (const S& v) {
370 this->val() -= v;
371 return *this;
372 }
373
375 template <typename S>
376 KOKKOS_INLINE_FUNCTION
377 SACADO_ENABLE_VALUE_FUNC(GeneralFad&) operator *= (const S& v) {
378 const int sz = this->size();
379 this->val() *= v;
380 for (int i=0; i<sz; ++i)
381 this->fastAccessDx(i) *= v;
382 return *this;
383 }
384
386 template <typename S>
387 KOKKOS_INLINE_FUNCTION
388 SACADO_ENABLE_VALUE_FUNC(GeneralFad&) operator /= (const S& v) {
389 const int sz = this->size();
390 this->val() /= v;
391 for (int i=0; i<sz; ++i)
392 this->fastAccessDx(i) /= v;
393 return *this;
394 }
395
397 KOKKOS_INLINE_FUNCTION
398 GeneralFad& operator += (const GeneralFad& x) {
399 const int xsz = x.size(), sz = this->size();
400
401#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
402 if ((xsz != sz) && (xsz != 0) && (sz != 0))
403 throw "Fad Error: Attempt to assign with incompatible sizes";
404#endif
405
406 if (xsz) {
407 if (sz) {
408 for (int i=0; i<sz; ++i)
409 this->fastAccessDx(i) += x.fastAccessDx(i);
410 }
411 else {
412 this->resizeAndZero(xsz);
413 for (int i=0; i<xsz; ++i)
414 this->fastAccessDx(i) = x.fastAccessDx(i);
415 }
416 }
417
418 this->val() += x.val();
419 return *this;
420 }
421
423 KOKKOS_INLINE_FUNCTION
424 GeneralFad& operator -= (const GeneralFad& x) {
425 const int xsz = x.size(), sz = this->size();
426
427#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
428 if ((xsz != sz) && (xsz != 0) && (sz != 0))
429 throw "Fad Error: Attempt to assign with incompatible sizes";
430#endif
431
432 if (xsz) {
433 if (sz) {
434 for(int i=0; i<sz; ++i)
435 this->fastAccessDx(i) -= x.fastAccessDx(i);
436 }
437 else {
438 this->resizeAndZero(xsz);
439 for(int i=0; i<xsz; ++i)
440 this->fastAccessDx(i) = -x.fastAccessDx(i);
441 }
442 }
443
444 this->val() -= x.val();
445
446 return *this;
447 }
448
450 KOKKOS_INLINE_FUNCTION
451 GeneralFad& operator *= (const GeneralFad& x) {
452 const int xsz = x.size(), sz = this->size();
453 T xval = x.val();
454 T v = this->val();
455
456#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
457 if ((xsz != sz) && (xsz != 0) && (sz != 0))
458 throw "Fad Error: Attempt to assign with incompatible sizes";
459#endif
460
461 if (xsz) {
462 if (sz) {
463 for(int i=0; i<sz; ++i)
464 this->fastAccessDx(i) = v*x.fastAccessDx(i) + this->fastAccessDx(i)*xval;
465 }
466 else {
467 this->resizeAndZero(xsz);
468 for(int i=0; i<xsz; ++i)
469 this->fastAccessDx(i) = v*x.fastAccessDx(i);
470 }
471 }
472 else {
473 if (sz) {
474 for (int i=0; i<sz; ++i)
475 this->fastAccessDx(i) *= xval;
476 }
477 }
478
479 this->val() *= xval;
480
481 return *this;
482 }
483
485 KOKKOS_INLINE_FUNCTION
486 GeneralFad& operator /= (const GeneralFad& x) {
487 const int xsz = x.size(), sz = this->size();
488 T xval = x.val();
489 T v = this->val();
490
491#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
492 if ((xsz != sz) && (xsz != 0) && (sz != 0))
493 throw "Fad Error: Attempt to assign with incompatible sizes";
494#endif
495
496 if (xsz) {
497 if (sz) {
498 for(int i=0; i<sz; ++i)
499 this->fastAccessDx(i) =
500 ( this->fastAccessDx(i)*xval - v*x.fastAccessDx(i) )/ (xval*xval);
501 }
502 else {
503 this->resizeAndZero(xsz);
504 for(int i=0; i<xsz; ++i)
505 this->fastAccessDx(i) = - v*x.fastAccessDx(i) / (xval*xval);
506 }
507 }
508 else {
509 if (sz) {
510 for (int i=0; i<sz; ++i)
511 this->fastAccessDx(i) /= xval;
512 }
513 }
514
515 this->val() /= xval;
516
517 return *this;
518 }
519
521 template <typename S>
522 KOKKOS_INLINE_FUNCTION
523 SACADO_ENABLE_EXPR_FUNC(GeneralFad&) operator += (const Expr<S>& x) {
524 const int xsz = x.size();
525 int sz = this->size();
526
527#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
528 if ((xsz != sz) && (xsz != 0) && (sz != 0))
529 throw "Fad Error: Attempt to assign with incompatible sizes";
530#endif
531
532 if (xsz > sz) {
533 this->resizeAndZero(xsz);
534 sz = this->size();
535 }
536
537 if (sz) {
538 if (x.hasFastAccess())
539 for(int i=0; i<sz; ++i)
540 for (int j=0; j<VecNum; ++j)
541 fastAccessDx(i,j) += x.fastAccessDx(i,j);
542 else
543 for(int i=0; i<sz; ++i)
544 for (int j=0; j<VecNum; ++j)
545 fastAccessDx(i,j) += x.dx(i,j);
546 }
547
548 for (int j=0; j<VecNum; ++j)
549 val(j) += x.val(j);
550
551 return *this;
552 }
553
555 template <typename S>
556 KOKKOS_INLINE_FUNCTION
557 SACADO_ENABLE_EXPR_FUNC(GeneralFad&) operator -= (const Expr<S>& x) {
558 const int xsz = x.size(), sz = this->size();
559
560#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
561 if ((xsz != sz) && (xsz != 0) && (sz != 0))
562 throw "Fad Error: Attempt to assign with incompatible sizes";
563#endif
564
565 if (xsz) {
566 if (sz) {
567 if (x.hasFastAccess())
568 for(int i=0; i<sz; ++i)
569 for (int j=0; j<VecNum; ++j)
570 fastAccessDx(i,j) -= x.fastAccessDx(i,j);
571 else
572 for (int i=0; i<sz; ++i)
573 for (int j=0; j<VecNum; ++j)
574 fastAccessDx(i,j) -= x.dx(i,j);
575 }
576 else {
577 this->resizeAndZero(xsz);
578 if (x.hasFastAccess())
579 for(int i=0; i<xsz; ++i)
580 for (int j=0; j<VecNum; ++j)
581 fastAccessDx(i,j) = -x.fastAccessDx(i,j);
582 else
583 for (int i=0; i<xsz; ++i)
584 for (int j=0; j<VecNum; ++j)
585 fastAccessDx(i,j) = -x.dx(i,j);
586 }
587 }
588
589 for (int j=0; j<VecNum; ++j)
590 val(j) -= x.val(j);
591
592 return *this;
593 }
594
596 template <typename S>
597 KOKKOS_INLINE_FUNCTION
598 SACADO_ENABLE_EXPR_FUNC(GeneralFad&) operator *= (const Expr<S>& x) {
599 const int xsz = x.size(), sz = this->size();
600 T xval = x.val();
601 T v = this->val();
602
603#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
604 if ((xsz != sz) && (xsz != 0) && (sz != 0))
605 throw "Fad Error: Attempt to assign with incompatible sizes";
606#endif
607
608 if (xsz) {
609 if (sz) {
610 if (x.hasFastAccess())
611 for(int i=0; i<sz; ++i)
612 for (int j=0; j<VecNum; ++j)
613 fastAccessDx(i,j) = v.fastAccessCoeff(j)*x.fastAccessDx(i,j) + fastAccessDx(i,j)*xval.fastAccessCoeff(j);
614 else
615 for (int i=0; i<sz; ++i)
616 for (int j=0; j<VecNum; ++j)
617 fastAccessDx(i,j) = v.fastAccessCoeff(j)*x.dx(i,j) + fastAccessDx(i,j)*xval.fastAccessCoeff(j);
618 }
619 else {
620 this->resizeAndZero(xsz);
621 if (x.hasFastAccess())
622 for(int i=0; i<xsz; ++i)
623 for (int j=0; j<VecNum; ++j)
624 fastAccessDx(i,j) = v.fastAccessCoeff(j)*x.fastAccessDx(i,j);
625 else
626 for (int i=0; i<xsz; ++i)
627 for (int j=0; j<VecNum; ++j)
628 fastAccessDx(i,j) = v.fastAccessCoeff(j)*x.dx(i,j);
629 }
630 }
631 else {
632 if (sz) {
633 for (int i=0; i<sz; ++i)
634 for (int j=0; j<VecNum; ++j)
635 fastAccessDx(i,j) *= xval.fastAccessCoeff(j);
636 }
637 }
638
639 for (int j=0; j<VecNum; ++j)
640 val(j) *= xval.fastAccessCoeff(j);
641
642 return *this;
643 }
644
646 template <typename S>
647 KOKKOS_INLINE_FUNCTION
648 SACADO_ENABLE_EXPR_FUNC(GeneralFad&) operator /= (const Expr<S>& x) {
649 const int xsz = x.size(), sz = this->size();
650 T xval = x.val();
651 T v = this->val();
652
653#if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
654 if ((xsz != sz) && (xsz != 0) && (sz != 0))
655 throw "Fad Error: Attempt to assign with incompatible sizes";
656#endif
657
658 if (xsz) {
659 T xval2 = xval*xval;
660 if (sz) {
661 if (x.hasFastAccess())
662 for(int i=0; i<sz; ++i)
663 for (int j=0; j<VecNum; ++j)
664 fastAccessDx(i,j) = ( fastAccessDx(i,j)*xval.fastAccessCoeff(j) - v.fastAccessCoeff(j)*x.fastAccessDx(i,j) )/ (xval2.fastAccessCoeff(j));
665 else
666 for (int i=0; i<sz; ++i)
667 for (int j=0; j<VecNum; ++j)
668 fastAccessDx(i,j) = ( fastAccessDx(i,j)*xval.fastAccessCoeff(j) - v.fastAccessCoeff(j)*x.dx(i,j) )/ (xval2.fastAccessCoeff(j));
669 }
670 else {
671 this->resizeAndZero(xsz);
672 if (x.hasFastAccess())
673 for(int i=0; i<xsz; ++i)
674 for (int j=0; j<VecNum; ++j)
675 fastAccessDx(i,j) = - v.fastAccessCoeff(j)*x.fastAccessDx(i,j) / (xval2.fastAccessCoeff(j));
676 else
677 for (int i=0; i<xsz; ++i)
678 for (int j=0; j<VecNum; ++j)
679 fastAccessDx(i,j) = -v.fastAccessCoeff(j)*x.dx(i,j) / (xval2.fastAccessCoeff(j));
680 }
681 }
682 else {
683 if (sz) {
684 for (int i=0; i<sz; ++i)
685 for (int j=0; j<VecNum; ++j)
686 this->fastAccessDx(i,j) /= xval.fastAccessCoeff(j);
687 }
688 }
689
690 for (int j=0; j<VecNum; ++j)
691 val(j) /= xval.fastAccessCoeff(j);
692
693 return *this;
694 }
695
697
698 private:
699
700 template <typename S>
701 KOKKOS_INLINE_FUNCTION
702 void
703 fastAssign(const Expr<S>& x) {
704 const int sz = this->size();
705 for(int i=0; i<sz; ++i)
706 for (int j=0; j<VecNum; ++j)
707 fastAccessDx(i,j) = x.fastAccessDx(i,j);
708
709 for (int j=0; j<VecNum; ++j)
710 val(j) = x.val(j);
711 }
712
713 template <typename S>
714 KOKKOS_INLINE_FUNCTION
715 void
716 slowAssign(const Expr<S>& x) {
717 const int sz = this->size();
718 for(int i=0; i<sz; ++i)
719 for (int j=0; j<VecNum; ++j)
720 fastAccessDx(i,j) = x.dx(i,j);
721
722 for (int j=0; j<VecNum; ++j)
723 val(j) = x.val(j);
724 }
725
726 }; // class GeneralFad
727
728 } // namespace Fad
729
730} // namespace Sacado
731
732#endif // SACADO_FAD_GENERALFAD_HPP
expr expr expr expr fastAccessDx(i, j)) FAD_UNARYOP_MACRO(exp
expr val()
expr expr expr dx(i, j)
KOKKOS_INLINE_FUNCTION val_type dx(int i, int j) const
Returns derivative component i with bounds checking.
KOKKOS_INLINE_FUNCTION GeneralFad(const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
Constructor with size sz and value x.
KOKKOS_INLINE_FUNCTION const T & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION GeneralFad(const S &x, SACADO_ENABLE_VALUE_CTOR_DECL)
Constructor with supplied value x.
KOKKOS_INLINE_FUNCTION void setUpdateValue(bool update_val)
Set whether this Fad object should update values.
KOKKOS_INLINE_FUNCTION const val_type & fastAccessDx(int i, int j) const
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION SACADO_ENABLE_EXPR_FUNC(bool) isEqualTo(const Expr< S > &x) const
Returns whether two Fad objects have the same values.
KOKKOS_INLINE_FUNCTION int availableSize() const
Returns number of derivative components that can be stored without reallocation.
KOKKOS_INLINE_FUNCTION T dx(int i) const
Returns derivative component i with bounds checking.
KOKKOS_INLINE_FUNCTION val_type & fastAccessDx(int i, int j)
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION bool updateValue() const
Return whether this Fad object has an updated value.
KOKKOS_INLINE_FUNCTION T & fastAccessDx(int i)
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION GeneralFad(const Expr< S > &x, SACADO_ENABLE_EXPR_CTOR_DECL)
Copy constructor from any Expression object.
KOKKOS_INLINE_FUNCTION GeneralFad(const int sz, const int i, const T &x)
Constructor with size sz, index i, and value x.
KOKKOS_INLINE_FUNCTION void diff(const int ith, const int n)
Set GeneralFad object as the ith independent variable.
Top-level namespace for Stokhos classes and functions.
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
Definition: csr_vector.h:265