Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Sacado_MP_Vector_SFS.hpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Stokhos Package
5// Copyright (2009) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
38//
39// ***********************************************************************
40// @HEADER
41
42#ifndef SACADO_MP_VECTOR_SFS_HPP
43#define SACADO_MP_VECTOR_SFS_HPP
44
45#include "Stokhos_ConfigDefs.h"
46
47#ifdef HAVE_STOKHOS_SACADO
48
49//#include "Sacado_MP_Vector.hpp"
51
52namespace Sacado {
53
54 namespace MP {
55
57 template <typename ordinal_t, typename value_t, int Num, typename device_t>
58 class Vector< Stokhos::StaticFixedStorage<ordinal_t,value_t,Num,device_t> >{
59 public:
60
63 typedef Storage storage_type;
64
65 typedef typename storage_type::value_type value_type;
66 typedef typename storage_type::ordinal_type ordinal_type;
67 typedef typename storage_type::execution_space execution_space;
68 typedef typename storage_type::pointer pointer;
69 typedef typename storage_type::volatile_pointer volatile_pointer;
70 typedef typename storage_type::const_pointer const_pointer;
71 typedef typename storage_type::const_volatile_pointer const_volatile_pointer;
72 typedef typename storage_type::reference reference;
73 typedef typename storage_type::volatile_reference volatile_reference;
74 typedef typename storage_type::const_reference const_reference;
75 typedef typename storage_type::const_volatile_reference const_volatile_reference;
76
77 typedef typename execution_space::memory_space memory_space;
78 typedef typename Stokhos::MemoryTraits<memory_space> MemTraits;
79
81 typedef typename ScalarType<value_type>::type scalar_type;
82
84 template < class NewStorageType >
85 struct apply {
86 typedef Vector< NewStorageType > type;
87 };
88
90 static const int num_args = 1;
91
92#if STOKHOS_ALIGN_MEMORY
93 KOKKOS_INLINE_FUNCTION
94 static void* operator new(std::size_t sz) {
95 return MemTraits::alloc(sz);
96 }
97 KOKKOS_INLINE_FUNCTION
98 static void* operator new[](std::size_t sz) {
99 return MemTraits::alloc(sz);
100 }
101 KOKKOS_INLINE_FUNCTION
102 static void* operator new(std::size_t sz, void* ptr) {
103 return ptr;
104 }
105 KOKKOS_INLINE_FUNCTION
106 static void* operator new[](std::size_t sz, void* ptr) {
107 return ptr;
108 }
109 KOKKOS_INLINE_FUNCTION
110 static void operator delete(void* ptr) {
111 MemTraits::free(ptr);
112 }
113 KOKKOS_INLINE_FUNCTION
114 static void operator delete[](void* ptr) {
115 MemTraits::free(ptr);
116 }
117 KOKKOS_INLINE_FUNCTION
118 static void operator delete(void* ptr, void*) {
119 MemTraits::free(ptr);
120 }
121 KOKKOS_INLINE_FUNCTION
122 static void operator delete[](void* ptr, void*) {
123 MemTraits::free(ptr);
124 }
125#endif
126
128
131 KOKKOS_INLINE_FUNCTION
132 Vector() : s(1) {}
133
135
138 KOKKOS_INLINE_FUNCTION
139 Vector(const value_type& x) : s(1,x) {}
140
142
146 KOKKOS_INLINE_FUNCTION
147 Vector(ordinal_type sz, pointer v, bool owned) : s(sz,v,owned) {}
148
150
153 KOKKOS_INLINE_FUNCTION
154 Vector(ordinal_type sz, const value_type& x) : s(sz,x) {}
155
157 KOKKOS_INLINE_FUNCTION
158 Vector(const storage_type& ss) : s(ss) {}
159
161 KOKKOS_INLINE_FUNCTION
162 Vector(const Vector& x) : s(x.s) {}
163
165 KOKKOS_INLINE_FUNCTION
166 Vector(const volatile Vector& x) : s(x.s) {}
167
169
172 Vector(std::initializer_list<value_type> l) : s(l.size(), l.begin()) {}
173
175 KOKKOS_INLINE_FUNCTION
176 ~Vector() {}
177
179 KOKKOS_INLINE_FUNCTION
180 void init(const value_type& v) { s.init(v); }
181
183 KOKKOS_INLINE_FUNCTION
184 void init(const value_type& v) volatile { s.init(v); }
185
187 KOKKOS_INLINE_FUNCTION
188 void init(const value_type* v) { s.init(v); }
189
191 KOKKOS_INLINE_FUNCTION
192 void init(const value_type* v) volatile { s.init(v); }
193
195 template <typename S>
196 KOKKOS_INLINE_FUNCTION
197 void init(const Vector<S>& v) {
198 s.init(v.s.coeff(), v.s.size());
199 }
200
202 template <typename S>
203 KOKKOS_INLINE_FUNCTION
204 void init(const Vector<S>& v) volatile {
205 s.init(v.s.coeff(), v.s.size());
206 }
207
209 KOKKOS_INLINE_FUNCTION
210 void load(value_type* v) { s.load(v); }
211
213 KOKKOS_INLINE_FUNCTION
214 void load(value_type* v) volatile { s.load(v); }
215
217 template <typename S>
218 KOKKOS_INLINE_FUNCTION
219 void load(Vector<S>& v) { s.load(v.s.coeff()); }
220
222 template <typename S>
223 KOKKOS_INLINE_FUNCTION
224 void load(Vector<S>& v) volatile { s.load(v.s.coeff()); }
225
227
230 KOKKOS_INLINE_FUNCTION
231 void reset(ordinal_type sz_new) {}
232
234
237 KOKKOS_INLINE_FUNCTION
238 void reset(ordinal_type sz_new) volatile {}
239
241
250 KOKKOS_INLINE_FUNCTION
251 void copyForWrite() volatile { }
252
254 KOKKOS_INLINE_FUNCTION
255 bool isEqualTo(const Vector& x) const {
256 typedef IsEqual<value_type> IE;
257 bool eq = true;
258 for (ordinal_type i=0; i<this->size(); i++)
259 eq = eq && IE::eval(x.coeff(i), this->coeff(i));
260 return eq;
261 }
262
264 KOKKOS_INLINE_FUNCTION
265 bool isEqualTo(const Vector& x) const volatile {
266 typedef IsEqual<value_type> IE;
267 bool eq = true;
268 for (ordinal_type i=0; i<this->size(); i++)
269 eq = eq && IE::eval(x.coeff(i), this->coeff(i));
270 return eq;
271 }
272
277
279 KOKKOS_INLINE_FUNCTION
280 Vector& operator=(const value_type& x) {
281 s.init(x);
282 return *this;
283 }
284
286 KOKKOS_INLINE_FUNCTION
287 /*volatile*/ Vector& operator=(const value_type& x) volatile {
288 s.init(x);
289 return const_cast<Vector&>(*this);
290 }
291
293 KOKKOS_INLINE_FUNCTION
294 Vector& operator=(const Vector& x) {
295 if (this != &x) {
296 s = x.s;
297 }
298
299 return *this;
300 }
301
303 KOKKOS_INLINE_FUNCTION
304 Vector& operator=(const volatile Vector& x) {
305 if (this != &x) {
306 s = x.s;
307 }
308
309 return *this;
310 }
311
313 KOKKOS_INLINE_FUNCTION
314 /*volatile*/ Vector& operator=(const Vector& x) volatile {
315 if (this != &x) {
316 s = x.s;
317 }
318
319 return const_cast<Vector&>(*this);
320 }
321
323 KOKKOS_INLINE_FUNCTION
324 /*volatile*/ Vector& operator=(const volatile Vector& x) volatile {
325 if (this != &x) {
326 s = x.s;
327 }
328
329 return const_cast<Vector&>(*this);
330 }
331
333
339 KOKKOS_INLINE_FUNCTION
340 const volatile storage_type& storage() const volatile { return s; }
341
343 KOKKOS_INLINE_FUNCTION
344 const storage_type& storage() const { return s; }
345
347 KOKKOS_INLINE_FUNCTION
348 volatile storage_type& storage() volatile { return s; }
349
351 KOKKOS_INLINE_FUNCTION
352 storage_type& storage() { return s; }
353
358
360 KOKKOS_INLINE_FUNCTION
361 const_volatile_reference val() const volatile { return s[0]; }
362
364 KOKKOS_INLINE_FUNCTION
365 const_reference val() const { return s[0]; }
366
368 KOKKOS_INLINE_FUNCTION
369 volatile_reference val() volatile { return s[0]; }
370
372 KOKKOS_INLINE_FUNCTION
373 reference val() { return s[0]; }
374
376
381
383 KOKKOS_INLINE_FUNCTION
384 static ordinal_type size() { return storage_type::size();}
385
387 KOKKOS_INLINE_FUNCTION
388 static bool hasFastAccess(ordinal_type sz) { return true; }
389
391 KOKKOS_INLINE_FUNCTION
392 const_pointer coeff() const { return s.coeff();}
393
395 KOKKOS_INLINE_FUNCTION
396 const_volatile_pointer coeff() const volatile { return s.coeff();}
397
399 KOKKOS_INLINE_FUNCTION
400 volatile_pointer coeff() volatile { return s.coeff();}
401
403 KOKKOS_INLINE_FUNCTION
404 pointer coeff() { return s.coeff();}
405
407 KOKKOS_INLINE_FUNCTION
408 value_type coeff(ordinal_type i) const volatile { return s[i]; }
409
411 KOKKOS_INLINE_FUNCTION
412 value_type coeff(ordinal_type i) const { return s[i]; }
413
415 KOKKOS_INLINE_FUNCTION
416 value_type coeff(ordinal_type i) volatile { return s[i]; }
417
419 KOKKOS_INLINE_FUNCTION
420 value_type coeff(ordinal_type i) { return s[i]; }
421
423 KOKKOS_INLINE_FUNCTION
424 const_volatile_reference fastAccessCoeff(ordinal_type i) const volatile {
425 return s[i];}
426
428 KOKKOS_INLINE_FUNCTION
429 const_reference fastAccessCoeff(ordinal_type i) const {
430 return s[i];}
431
433 KOKKOS_INLINE_FUNCTION
434 volatile_reference fastAccessCoeff(ordinal_type i) volatile {
435 return s[i];}
436
438 KOKKOS_INLINE_FUNCTION
439 reference fastAccessCoeff(ordinal_type i) {
440 return s[i];}
441
443 KOKKOS_INLINE_FUNCTION
444 const_volatile_reference operator[](ordinal_type i) const volatile {
445 return s[i];}
446
448 KOKKOS_INLINE_FUNCTION
449 const_reference operator[](ordinal_type i) const {
450 return s[i];}
451
453 KOKKOS_INLINE_FUNCTION
454 volatile_reference operator[](ordinal_type i) volatile {
455 return s[i];}
456
458 KOKKOS_INLINE_FUNCTION
459 reference operator[](ordinal_type i) {
460 return s[i];}
461
462 template <int i>
463 KOKKOS_INLINE_FUNCTION
464 value_type getCoeff() const volatile {
465 return s.template getCoeff<i>(); }
466
467 template <int i>
468 KOKKOS_INLINE_FUNCTION
469 value_type getCoeff() const {
470 return s.template getCoeff<i>(); }
471
472 template <int i>
473 KOKKOS_INLINE_FUNCTION
474 volatile_reference getCoeff() volatile {
475 return s.template getCoeff<i>(); }
476
477 template <int i>
478 KOKKOS_INLINE_FUNCTION
479 reference getCoeff() {
480 return s.template getCoeff<i>(); }
481
483 KOKKOS_INLINE_FUNCTION
484 pointer begin() { return s.coeff(); }
485
487 KOKKOS_INLINE_FUNCTION
488 const_pointer begin() const { return s.coeff(); }
489
491 KOKKOS_INLINE_FUNCTION
492 volatile_pointer begin() volatile { return s.coeff(); }
493
495 KOKKOS_INLINE_FUNCTION
496 const_volatile_pointer begin() const volatile { return s.coeff(); }
497
499 KOKKOS_INLINE_FUNCTION
500 const_pointer cbegin() const { return s.coeff(); }
501
503 KOKKOS_INLINE_FUNCTION
504 const_volatile_pointer cbegin() const volatile { return s.coeff(); }
505
507 KOKKOS_INLINE_FUNCTION
508 pointer end() { return s.coeff() + s.size(); }
509
511 KOKKOS_INLINE_FUNCTION
512 const_pointer end() const { return s.coeff() + s.size(); }
513
515 KOKKOS_INLINE_FUNCTION
516 volatile_pointer end() volatile { return s.coeff() + s.size(); }
517
519 KOKKOS_INLINE_FUNCTION
520 const_volatile_pointer end() const volatile { return s.coeff() + s.size(); }
521
523 KOKKOS_INLINE_FUNCTION
524 const_pointer cend() const { return s.coeff()+ s.size(); }
525
527 KOKKOS_INLINE_FUNCTION
528 const_volatile_pointer cend() const volatile { return s.coeff()+ s.size(); }
529
531
536
538 KOKKOS_INLINE_FUNCTION
539 Vector& operator += (const value_type& x) {
540#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
541#pragma ivdep
542#endif
543#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
544#pragma vector aligned
545#endif
546#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
547#pragma unroll
548#endif
549 for (ordinal_type i=0; i<s.size(); i++)
550 s[i] += x;
551 return *this;
552 }
553
555 KOKKOS_INLINE_FUNCTION
556 Vector& operator += (const volatile value_type& x) {
557#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
558#pragma ivdep
559#endif
560#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
561#pragma vector aligned
562#endif
563#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
564#pragma unroll
565#endif
566 for (ordinal_type i=0; i<s.size(); i++)
567 s[i] += x;
568 return *this;
569 }
570
572 KOKKOS_INLINE_FUNCTION
573 /*volatile*/ Vector& operator += (const value_type& x) volatile {
574#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
575#pragma ivdep
576#endif
577#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
578#pragma vector aligned
579#endif
580#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
581#pragma unroll
582#endif
583 for (ordinal_type i=0; i<s.size(); i++)
584 s[i] += x;
585 return const_cast<Vector&>(*this);
586 }
587
589 KOKKOS_INLINE_FUNCTION
590 /*volatile*/ Vector& operator += (const volatile value_type& x) volatile {
591#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
592#pragma ivdep
593#endif
594#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
595#pragma vector aligned
596#endif
597#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
598#pragma unroll
599#endif
600 for (ordinal_type i=0; i<s.size(); i++)
601 s[i] += x;
602 return const_cast<Vector&>(*this);
603 }
604
606 KOKKOS_INLINE_FUNCTION
607 Vector& operator -= (const value_type& x) {
608#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
609#pragma ivdep
610#endif
611#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
612#pragma vector aligned
613#endif
614#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
615#pragma unroll
616#endif
617 for (ordinal_type i=0; i<s.size(); i++)
618 s[i] -= x;
619 return *this;
620 }
621
623 KOKKOS_INLINE_FUNCTION
624 Vector& operator -= (const volatile value_type& x) {
625#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
626#pragma ivdep
627#endif
628#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
629#pragma vector aligned
630#endif
631#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
632#pragma unroll
633#endif
634 for (ordinal_type i=0; i<s.size(); i++)
635 s[i] -= x;
636 return *this;
637 }
638
640 KOKKOS_INLINE_FUNCTION
641 /*volatile*/ Vector& operator -= (const value_type& x) volatile {
642#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
643#pragma ivdep
644#endif
645#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
646#pragma vector aligned
647#endif
648#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
649#pragma unroll
650#endif
651 for (ordinal_type i=0; i<s.size(); i++)
652 s[i] -= x;
653 return const_cast<Vector&>(*this);
654 }
655
657 KOKKOS_INLINE_FUNCTION
658 /*volatile*/ Vector& operator -= (const volatile value_type& x) volatile {
659#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
660#pragma ivdep
661#endif
662#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
663#pragma vector aligned
664#endif
665#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
666#pragma unroll
667#endif
668 for (ordinal_type i=0; i<s.size(); i++)
669 s[i] -= x;
670 return const_cast<Vector&>(*this);
671 }
672
674 KOKKOS_INLINE_FUNCTION
675 Vector& operator *= (const value_type& x) {
676#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
677#pragma ivdep
678#endif
679#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
680#pragma vector aligned
681#endif
682#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
683#pragma unroll
684#endif
685 for (ordinal_type i=0; i<s.size(); i++)
686 s[i] *= x;
687 return *this;
688 }
689
691 KOKKOS_INLINE_FUNCTION
692 Vector& operator *= (const volatile value_type& x) {
693#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
694#pragma ivdep
695#endif
696#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
697#pragma vector aligned
698#endif
699#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
700#pragma unroll
701#endif
702 for (ordinal_type i=0; i<s.size(); i++)
703 s[i] *= x;
704 return *this;
705 }
706
708 KOKKOS_INLINE_FUNCTION
709 /*volatile*/ Vector& operator *= (const value_type& x) volatile {
710#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
711#pragma ivdep
712#endif
713#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
714#pragma vector aligned
715#endif
716#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
717#pragma unroll
718#endif
719 for (ordinal_type i=0; i<s.size(); i++)
720 s[i] *= x;
721 return const_cast<Vector&>(*this);
722 }
723
725 KOKKOS_INLINE_FUNCTION
726 /*volatile*/ Vector& operator *= (const volatile value_type& x) volatile {
727#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
728#pragma ivdep
729#endif
730#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
731#pragma vector aligned
732#endif
733#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
734#pragma unroll
735#endif
736 for (ordinal_type i=0; i<s.size(); i++)
737 s[i] *= x;
738 return const_cast<Vector&>(*this);
739 }
740
742 KOKKOS_INLINE_FUNCTION
743 Vector& operator /= (const value_type& x) {
744#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
745#pragma ivdep
746#endif
747#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
748#pragma vector aligned
749#endif
750#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
751#pragma unroll
752#endif
753 for (ordinal_type i=0; i<s.size(); i++)
754 s[i] /= x;
755 return *this;
756 }
757
759 KOKKOS_INLINE_FUNCTION
760 Vector& operator /= (const volatile value_type& x) {
761#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
762#pragma ivdep
763#endif
764#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
765#pragma vector aligned
766#endif
767#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
768#pragma unroll
769#endif
770 for (ordinal_type i=0; i<s.size(); i++)
771 s[i] /= x;
772 return *this;
773 }
774
776 KOKKOS_INLINE_FUNCTION
777 /*volatile*/ Vector& operator /= (const value_type& x) volatile {
778#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
779#pragma ivdep
780#endif
781#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
782#pragma vector aligned
783#endif
784#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
785#pragma unroll
786#endif
787 for (ordinal_type i=0; i<s.size(); i++)
788 s[i] /= x;
789 return const_cast<Vector&>(*this);
790 }
791
793 KOKKOS_INLINE_FUNCTION
794 /*volatile*/ Vector& operator /= (const volatile value_type& x) volatile {
795#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
796#pragma ivdep
797#endif
798#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
799#pragma vector aligned
800#endif
801#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
802#pragma unroll
803#endif
804 for (ordinal_type i=0; i<s.size(); i++)
805 s[i] /= x;
806 return const_cast<Vector&>(*this);
807 }
808
810 KOKKOS_INLINE_FUNCTION
811 Vector& operator += (const Vector& x) {
812#ifdef STOKHOS_HAVE_PRAGMA_IVDEP
813#pragma ivdep
814#endif
815#ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
816#pragma vector aligned
817#endif
818#ifdef STOKHOS_HAVE_PRAGMA_UNROLL
819#pragma unroll
820#endif
821 for (ordinal_type i=0; i<s.size(); i++)
822 s[i] += x.fastAccessCoeff(i);
823 return *this;
824 }
825
827 KOKKOS_INLINE_FUNCTION
828 Vector& operator += (const volatile Vector& x) {
829 *this = *this + x;
830 return *this;
831 }
832
834 KOKKOS_INLINE_FUNCTION
835 /*volatile*/ Vector& operator += (const Vector& x) volatile {
836 *this = *this + x;
837 return const_cast<Vector&>(*this);
838 }
839
841 KOKKOS_INLINE_FUNCTION
842 /*volatile*/ Vector& operator += (const volatile Vector& x) volatile {
843 *this = *this + x;
844 return const_cast<Vector&>(*this);
845 }
846
848 KOKKOS_INLINE_FUNCTION
849 Vector& operator -= (const Vector& x) {
850 *this = *this - x;
851 return *this;
852 }
853
855 KOKKOS_INLINE_FUNCTION
856 Vector& operator -= (const volatile Vector& x) {
857 *this = *this - x;
858 return *this;
859 }
860
862 KOKKOS_INLINE_FUNCTION
863 /*volatile*/ Vector& operator -= (const Vector& x) volatile {
864 *this = *this - x;
865 return const_cast<Vector&>(*this);
866 }
867
869 KOKKOS_INLINE_FUNCTION
870 /*volatile*/ Vector& operator -= (const volatile Vector& x) volatile {
871 *this = *this - x;
872 return const_cast<Vector&>(*this);
873 }
874
876 KOKKOS_INLINE_FUNCTION
877 Vector& operator *= (const Vector& x) {
878 *this = *this * x;
879 return *this;
880 }
881
883 KOKKOS_INLINE_FUNCTION
884 Vector& operator *= (const volatile Vector& x) {
885 *this = *this * x;
886 return *this;
887 }
888
890 KOKKOS_INLINE_FUNCTION
891 /*volatile*/ Vector& operator *= (const Vector& x) volatile {
892 *this = *this * x;
893 return const_cast<Vector&>(*this);
894 }
895
897 KOKKOS_INLINE_FUNCTION
898 /*volatile*/ Vector& operator *= (const volatile Vector& x) volatile {
899 *this = *this * x;
900 return const_cast<Vector&>(*this);
901 }
902
904 KOKKOS_INLINE_FUNCTION
905 Vector& operator /= (const Vector& x) {
906 *this = *this / x;
907 return *this;
908 }
909
911 KOKKOS_INLINE_FUNCTION
912 Vector& operator /= (const volatile Vector& x) {
913 *this = *this / x;
914 return *this;
915 }
916
918 KOKKOS_INLINE_FUNCTION
919 /*volatile*/ Vector& operator /= (const Vector& x) volatile {
920 *this = *this / x;
921 return const_cast<Vector&>(*this);
922 }
923
925 KOKKOS_INLINE_FUNCTION
926 /*volatile*/ Vector& operator /= (const volatile Vector& x) volatile {
927 *this = *this / x;
928 return const_cast<Vector&>(*this);
929 }
930
932 KOKKOS_INLINE_FUNCTION
933 Vector& operator++() {
934 for (ordinal_type i=0; i<s.size(); i++)
935 ++(s[i]);
936 return *this;
937 }
938
940 KOKKOS_INLINE_FUNCTION
941 volatile Vector& operator++() volatile {
942 for (ordinal_type i=0; i<s.size(); i++)
943 ++(s[i]);
944 return *this;
945 }
946
948 KOKKOS_INLINE_FUNCTION
949 Vector operator++(int) {
950 Vector tmp(*this);
951 ++(*this);
952 return tmp;
953 }
954
956 KOKKOS_INLINE_FUNCTION
957 Vector operator++(int) volatile {
958 Vector tmp(*this);
959 ++(*this);
960 return tmp;
961 }
962
964 KOKKOS_INLINE_FUNCTION
965 Vector& operator--() {
966 for (ordinal_type i=0; i<s.size(); i++)
967 --(s[i]);
968 return *this;
969 }
970
972 KOKKOS_INLINE_FUNCTION
973 volatile Vector& operator--() volatile {
974 for (ordinal_type i=0; i<s.size(); i++)
975 --(s[i]);
976 return *this;
977 }
978
980 KOKKOS_INLINE_FUNCTION
981 Vector operator--(int) {
982 Vector tmp(*this);
983 --(*this);
984 return tmp;
985 }
986
988 KOKKOS_INLINE_FUNCTION
989 Vector operator--(int) volatile {
990 Vector tmp(*this);
991 --(*this);
992 return tmp;
993 }
994
996
997 KOKKOS_INLINE_FUNCTION
998 std::string name() const volatile { return "x"; }
999
1000 protected:
1001
1002 Storage s;
1003
1004 }; // class Vector
1005
1006 //------------------------------------------------------------------------
1007 //------------------------------------------------------------------------
1008
1009 } // namespace MP
1010
1011} // namespace Sacado
1012
1014
1015#endif // HAVE_STOKHOS_SACADO
1016
1017#endif // SACADO_MP_VECTOR_SFS_HPP
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c fastAccessCoeff(j) - expr2.val(j)
expr val()
Stokhos::StandardStorage< int, double > storage_type
Kokkos::DefaultExecutionSpace execution_space
Statically allocated storage class.
Stokhos::StandardStorage< int, double > Storage
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
Traits class encapsulting memory alignment.