RTOp Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RTOpPack_Types.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // RTOp: Interfaces and Support Software for Vector Reduction Transformation
4 // Operations
5 //
6 // Copyright 2006 NTESS and the RTOp contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 
12 #ifndef RTOPPACK_TYPES_HPP
13 #define RTOPPACK_TYPES_HPP
14 
15 
16 #include "RTOp_ConfigDefs.hpp"
17 #include "Teuchos_Array.hpp"
18 #include "Teuchos_RCP.hpp"
19 #include "Teuchos_ArrayRCP.hpp"
20 #include "Teuchos_Range1D.hpp"
21 #include "Teuchos_ScalarTraits.hpp"
23 #include "Teuchos_Assert.hpp"
25 #include "Teuchos_FancyOStream.hpp"
26 
27 
28 namespace RTOpPack {
29 
30 
31 //
32 // Basic types
33 //
34 
38 using Teuchos::Ptr;
40 using Teuchos::RCP;
42 using Teuchos::ArrayRCP;
44 using Teuchos::ArrayView;
46 using Teuchos::Array;
48 using Teuchos::Range1D;
55 
59 typedef char char_type;
60 
61 
62 //
63 // Exceptions
64 //
65 
66 
68 class UnknownError : public std::logic_error
69 {public: UnknownError(const std::string& what_arg) : std::logic_error(what_arg) {}};
71 class InvalidUsage : public std::logic_error
72 {public: InvalidUsage(const std::string& what_arg) : std::logic_error(what_arg) {}};
74 class InvalidNumVecs : public std::logic_error
75 {public: InvalidNumVecs(const std::string& what_arg) : std::logic_error(what_arg) {}};
77 class InvalidNumTargVecs : public std::logic_error
78 {public: InvalidNumTargVecs(const std::string& what_arg) : std::logic_error(what_arg) {}};
80 class IncompatibleVecs : public std::logic_error
81 {public: IncompatibleVecs(const std::string& what_arg) : std::logic_error(what_arg) {}};
83 class IncompatibleReductObj : public std::logic_error
84 {public: IncompatibleReductObj(const std::string& what_arg) : std::logic_error(what_arg) {}};
85 
86 
87 //
88 // VectorBase subviews
89 //
90 
91 
111 template<class Scalar>
113 public:
118  :globalOffset_(0), subDim_(0), stride_(0)
119  { initialize(0, values_in.size(), values_in, 1); }
121  ConstSubVectorView(Ordinal globalOffset_in, Ordinal subDim_in,
122  const ArrayRCP<const Scalar> &values_in, ptrdiff_t stride_in)
123  :globalOffset_(0), subDim_(0), stride_(0)
124  { initialize(globalOffset_in, subDim_in, values_in, stride_in); }
128  values_(sv.values()), stride_(sv.stride())
129  {}
131  void initialize(Ordinal globalOffset_in, Ordinal subDim_in,
132  const ArrayRCP<const Scalar> &values_in, ptrdiff_t stride_in)
133  {
134 #ifdef TEUCHOS_DEBUG
135  TEUCHOS_ASSERT(globalOffset_in >= 0);
136  if (!is_null(values_in)) {
137  TEUCHOS_ASSERT(subDim_in >= 0);
138  TEUCHOS_ASSERT(stride_in != 0);
140  subDim_in*std::abs(Teuchos::as<int>(stride_in)) - 1 <= values_in.upperOffset());
141  TEUCHOS_ASSERT(values_in.lowerOffset() <= 0);
142  }
143  else {
144  TEUCHOS_ASSERT(subDim_in==0);
145  }
146 #endif
147  globalOffset_=globalOffset_in;
148  subDim_=subDim_in;
149  values_=values_in;
150  stride_=stride_in;
151  }
156  void setGlobalOffset(Ordinal globalOffset_in)
157  {
158 #ifdef TEUCHOS_DEBUG
159  TEUCHOS_ASSERT(globalOffset_in >= 0);
160 #endif
161  globalOffset_ = globalOffset_in;
162  }
164  Ordinal globalOffset() const { return globalOffset_; }
166  Ordinal subDim() const { return subDim_; }
168  const ArrayRCP<const Scalar> values() const { return values_; }
170  ptrdiff_t stride() const { return stride_; }
173  const Scalar& operator[](Ordinal i) const
174  {
175 #ifdef TEUCHOS_DEBUG
177 #endif
178  return valuesBegin()[stride_*i];
179  }
182  const Scalar& operator()(Ordinal i) const { return (*this)[i]; }
183 private:
187  ptrdiff_t stride_;
189  {
190  if (stride_ > 0)
191  return values_.begin();
192  return values_.begin() + (subDim_*std::abs(Teuchos::as<int>(stride_)) - 1);
193  }
194 public:
195 };
196 
197 
214 template<class Scalar>
215 class SubVectorView : public ConstSubVectorView<Scalar> {
216 public:
220  SubVectorView(const ArrayRCP<Scalar> &values_in)
221  :ConstSubVectorView<Scalar>(values_in)
222  {}
224  SubVectorView(Ordinal globalOffset_in, Ordinal subDim_in,
225  const ArrayRCP<Scalar> &values_in, ptrdiff_t stride_in)
226  :ConstSubVectorView<Scalar>(globalOffset_in, subDim_in, values_in, stride_in)
227  {}
230  :ConstSubVectorView<Scalar>(0, subDim_in, Teuchos::arcp<Scalar>(subDim_in), 1)
231  {}
234  :ConstSubVectorView<Scalar>(sv)
235  {}
237  void initialize(Ordinal globalOffset_in, Ordinal subDim_in,
238  const ArrayRCP<Scalar> &values_in, ptrdiff_t stride_in)
239  { ConstSubVectorView<Scalar>::initialize(globalOffset_in, subDim_in, values_in, stride_in); }
241  const ArrayRCP<Scalar> values() const
242  { return Teuchos::arcp_const_cast<Scalar>(ConstSubVectorView<Scalar>::values()); }
245  Scalar& operator[](Ordinal i) const
246  { return const_cast<Scalar&>(ConstSubVectorView<Scalar>::operator[](i)); }
249  Scalar& operator()(Ordinal i) const { return (*this)[i]; }
250 public:
251 };
252 
253 
255 template<class Scalar>
256 void assign_entries( const Ptr<const SubVectorView<Scalar> > &msv,
257  const ConstSubVectorView<Scalar> &sv )
258 {
259 #ifdef TEUCHOS_DEBUG
260  TEUCHOS_ASSERT_EQUALITY(msv->subDim(), sv.subDim());
261 #endif
262  for( int i = 0; i < sv.subDim(); ++i ) {
263  (*msv)(i) = sv(i);
264  }
265 }
266 
267 
272 template<class Scalar>
273 std::ostream& operator<<(std::ostream &out, const ConstSubVectorView<Scalar> &sv)
274 {
275  out
276  << "{"
277  << "globalOffset="<<sv.globalOffset()
278  << ",subDim="<<sv.subDim()
279  << ",values="<<sv.values()
280  << ",stride="<<sv.stride()
281  << "}";
282  return out;
283 }
284 
285 
286 //
287 // MultiVectorBase subviews
288 //
289 
290 
312 template<class Scalar>
314 public:
318  leadingDim_(0)
319  {}
322  Ordinal globalOffset_in, Ordinal subDim_in,
323  Ordinal colOffset_in, Ordinal numSubCols_in,
324  const ArrayRCP<const Scalar> &values_in, Ordinal leadingDim_in
325  )
327  leadingDim_(0)
328  {
329  initialize(globalOffset_in, subDim_in, colOffset_in, numSubCols_in, values_in,
330  leadingDim_in);
331  }
334  :globalOffset_(smv.globalOffset()), subDim_(smv.subDim()),
336  values_(smv.values()), leadingDim_(smv.leadingDim())
337  {}
340  Ordinal globalOffset_in, Ordinal subDim_in,
341  Ordinal colOffset_in, Ordinal numSubCols_in,
342  const ArrayRCP<const Scalar> &values_in, Ordinal leadingDim_in
343  )
344  {
345 #ifdef TEUCHOS_DEBUG
346  TEUCHOS_ASSERT(globalOffset_in >= 0);
347  TEUCHOS_ASSERT(colOffset_in >= 0);
348  if (!is_null(values_in)) {
349  TEUCHOS_ASSERT(subDim_in >= 0);
350  TEUCHOS_ASSERT(leadingDim_in >= subDim_in);
351  TEUCHOS_ASSERT(numSubCols_in*leadingDim_in - 1 <= values_in.upperOffset());
352  TEUCHOS_ASSERT(values_in.lowerOffset() <= 0);
353  }
354  else {
355  TEUCHOS_ASSERT(subDim_in == 0);
356  }
357 #endif
358  globalOffset_=globalOffset_in;
359  subDim_=subDim_in;
360  colOffset_=colOffset_in;
361  numSubCols_=numSubCols_in;
362  values_=values_in;
363  leadingDim_=leadingDim_in;
364  }
367  {
370  }
372  void setGlobalOffset(Ordinal globalOffset_in)
373  {
374 #ifdef TEUCHOS_DEBUG
375  TEUCHOS_ASSERT(globalOffset_in >= 0);
376 #endif
377  globalOffset_ = globalOffset_in;
378  }
380  Ordinal globalOffset() const { return globalOffset_; }
382  Ordinal subDim() const { return subDim_; }
384  Ordinal colOffset() const { return colOffset_; }
386  Ordinal numSubCols() const { return numSubCols_; }
388  const ArrayRCP<const Scalar> values() const { return values_; }
390  Ordinal leadingDim() const { return leadingDim_; }
394  const Scalar& operator()(Ordinal i, Ordinal j) const
395  {
396 #ifdef TEUCHOS_DEBUG
399 #endif
400  return values_[ i + leadingDim_*j ];
401  }
406  {
407 #ifdef TEUCHOS_DEBUG
409 #endif
412  }
413 private:
420 public:
421 };
422 
423 
440 template<class Scalar>
442 public:
447  Ordinal numRows_in, Ordinal numCols_in
448  )
449  :ConstSubMultiVectorView<Scalar>(0, numRows_in, 0, numCols_in,
450  Teuchos::arcp<Scalar>(numRows_in*numCols_in), numRows_in)
451  {}
454  Ordinal globalOffset_in, Ordinal subDim_in,
455  Ordinal colOffset_in, Ordinal numSubCols_in,
456  const ArrayRCP<Scalar> &values_in, Ordinal leadingDim_in
457  )
458  :ConstSubMultiVectorView<Scalar>(globalOffset_in, subDim_in,
459  colOffset_in, numSubCols_in, values_in, leadingDim_in)
460  {}
463  :ConstSubMultiVectorView<Scalar>(smv)
464  {}
467  Ordinal globalOffset_in, Ordinal subDim_in,
468  Ordinal colOffset_in, Ordinal numSubCols_in,
469  const ArrayRCP<Scalar> &values_in, Ordinal leadingDim_in
470  )
471  {
473  subDim_in, colOffset_in, numSubCols_in, values_in, leadingDim_in);
474  }
476  const ArrayRCP<Scalar> values() const
477  {
478  return Teuchos::arcp_const_cast<Scalar>(
480  }
484  Scalar& operator()(Ordinal i, Ordinal j) const
485  { return const_cast<Scalar&>(ConstSubMultiVectorView<Scalar>::operator()(i,j)); }
490  {
491 #ifdef TEUCHOS_DEBUG
493 #endif
494  return SubVectorView<Scalar>(this->globalOffset(), this->subDim(),
495  values().persistingView(j*this->leadingDim(),this->subDim()), 1);
496  }
497 public:
498 };
499 
500 
502 template<class Scalar>
505 {
506 #ifdef TEUCHOS_DEBUG
507  TEUCHOS_ASSERT_EQUALITY(msmv->subDim(), smv.subDim());
508  TEUCHOS_ASSERT_EQUALITY(msmv->numSubCols(), smv.numSubCols());
509 #endif
510  for( Ordinal j = 0; j < smv.numSubCols(); ++j ) {
511  for( Ordinal i = 0; i < smv.subDim(); ++i ) {
512  (*msmv)(i,j) = smv(i,j);
513  }
514  }
515 }
516 
517 
518 //
519 // Primitive Type Traits
520 //
521 
522 
533 template <class Scalar, class ConcreteObj>
535 public:
537  typedef Scalar primitiveType;
539  static int numPrimitiveObjs()
540  { return Scalar::this_type_is_missing_a_specialization(); }
542  static int numIndexObjs()
543  { return Scalar::this_type_is_missing_a_specialization(); }
545  static int numCharObjs()
546  { return Scalar::this_type_is_missing_a_specialization(); }
548  static void extractPrimitiveObjs(
549  const Scalar &obj,
550  const ArrayView<primitiveType> &primitiveObjs,
551  const ArrayView<index_type> &indexObjs,
552  const ArrayView<char> &charObjs
553  )
554  {
555  Scalar::this_type_is_missing_a_specialization(obj);
556  }
558  static void loadPrimitiveObjs(
559  const ArrayView<const primitiveType> &primitiveObjs,
560  const ArrayView<const index_type> &indexObjs,
561  const ArrayView<const char> &charObjs,
562  const Ptr<Scalar> &obj
563  )
564  {
565  *obj = Scalar::this_type_is_missing_a_specialization();
566  }
567 };
568 
569 
570 
574 template <class Scalar>
575 class PrimitiveTypeTraits<Scalar, Scalar> {
576 public:
578  typedef Scalar primitiveType;
580  static int numPrimitiveObjs() { return 1; }
582  static int numIndexObjs() { return 0; }
584  static int numCharObjs() { return 0; }
586  static void extractPrimitiveObjs(
587  const Scalar &obj,
588  const ArrayView<primitiveType> &primitiveObjs,
589  const ArrayView<index_type> &indexObjs,
590  const ArrayView<char> &charObjs
591  )
592  {
593  assertInput(primitiveObjs, indexObjs, charObjs);
594  primitiveObjs[0] = obj;
595  }
597  static void loadPrimitiveObjs(
598  const ArrayView<const primitiveType> &primitiveObjs,
599  const ArrayView<const index_type> &indexObjs,
600  const ArrayView<const char> &charObjs,
601  const Ptr<Scalar> &obj
602  )
603  {
604  assertInput(primitiveObjs, indexObjs, charObjs);
605  *obj = primitiveObjs[0];
606  }
607 private:
608  static void assertInput(
609  const ArrayView<const primitiveType> &primitiveObjs,
610  const ArrayView<const index_type> &indexObjs,
611  const ArrayView<const char> &charObjs
612  )
613  {
614 #ifdef TEUCHOS_DEBUG
615  TEUCHOS_TEST_FOR_EXCEPT( primitiveObjs.size()!=1 || indexObjs.size()!=0
616  || charObjs.size()!=0 );
617 #else
618  (void)primitiveObjs;
619  (void)indexObjs;
620  (void)charObjs;
621 #endif
622  }
623 };
624 
625 
627 template <class Scalar>
629 public:
635  static int numPrimitiveObjs() { return 0; }
637  static int numIndexObjs() { return 1; }
639  static int numCharObjs() { return 0; }
641  static void extractPrimitiveObjs(
642  const index_type &obj,
643  const ArrayView<primitiveType> &primitiveObjs,
644  const ArrayView<index_type> &indexObjs,
645  const ArrayView<char> &charObjs
646  )
647  {
648  assertInput(primitiveObjs, indexObjs, charObjs);
649  indexObjs[0] = obj;
650  }
652  static void loadPrimitiveObjs(
653  const ArrayView<const primitiveType> &primitiveObjs,
654  const ArrayView<const index_type> &indexObjs,
655  const ArrayView<const char> &charObjs,
656  const Ptr<index_type> &obj
657  )
658  {
659  assertInput(primitiveObjs, indexObjs, charObjs);
660  *obj = indexObjs[0];
661  }
662 private:
663  static void assertInput(
664  const ArrayView<const primitiveType> &primitiveObjs,
665  const ArrayView<const index_type> &indexObjs,
666  const ArrayView<const char> &charObjs
667  )
668  {
669 #ifdef TEUCHOS_DEBUG
670  TEUCHOS_TEST_FOR_EXCEPT( primitiveObjs.size()!=0 || indexObjs.size()!=1
671  || charObjs.size()!=0 );
672 #endif
673  }
674 };
675 
676 
677 #if defined(HAVE_COMPLEX) && defined(HAVE_TEUCHOS_COMPLEX)
678 
679 
683 template <class Scalar>
684 class PrimitiveTypeTraits<std::complex<Scalar>, std::complex<Scalar> > {
685 public:
687  typedef PrimitiveTypeTraits<Scalar,Scalar> ScalarPrimitiveTypeTraits;
689  typedef typename ScalarPrimitiveTypeTraits::primitiveType primitiveType;
691  static int numPrimitiveObjs()
692  { return 2*ScalarPrimitiveTypeTraits::numPrimitiveObjs(); }
694  static int numIndexObjs() { return 0; }
696  static int numCharObjs() { return 0; }
698  static void extractPrimitiveObjs(
699  const std::complex<Scalar> &obj,
700  const ArrayView<primitiveType> &primitiveObjs,
701  const ArrayView<index_type> &indexObjs,
702  const ArrayView<char> &charObjs
703  )
704  {
705  using Teuchos::null;
706  const int numScalarPrimitiveObjs =
707  ScalarPrimitiveTypeTraits::numPrimitiveObjs();
708  assertInput(primitiveObjs, indexObjs, charObjs);
709  ScalarPrimitiveTypeTraits::extractPrimitiveObjs(
710  obj.real(), primitiveObjs(0,numScalarPrimitiveObjs), null, null );
711  ScalarPrimitiveTypeTraits::extractPrimitiveObjs(
712  obj.imag(), primitiveObjs(numScalarPrimitiveObjs,numScalarPrimitiveObjs), null, null );
713  }
715  static void loadPrimitiveObjs(
716  const ArrayView<const primitiveType> &primitiveObjs,
717  const ArrayView<const index_type> &indexObjs,
718  const ArrayView<const char> &charObjs,
719  const Ptr<std::complex<Scalar> > &obj
720  )
721  {
722  using Teuchos::null;
723  using Teuchos::outArg;
724  assertInput(primitiveObjs, indexObjs, charObjs);
725  const int numScalarPrimitiveObjs =
726  ScalarPrimitiveTypeTraits::numPrimitiveObjs();
727  Scalar real, imag;
728  ScalarPrimitiveTypeTraits::loadPrimitiveObjs(
729  primitiveObjs(0,numScalarPrimitiveObjs), null, null,
730  outArg(real) );
731  ScalarPrimitiveTypeTraits::loadPrimitiveObjs(
732  primitiveObjs(numScalarPrimitiveObjs,numScalarPrimitiveObjs), null, null,
733  outArg(imag) );
734  *obj = std::complex<Scalar>( real, imag );
735  }
736 private:
737  static void assertInput(
738  const ArrayView<const primitiveType> &primitiveObjs,
739  const ArrayView<const index_type> &indexObjs,
740  const ArrayView<const char> &charObjs
741  )
742  {
743 #ifdef TEUCHOS_DEBUG
745  primitiveObjs.size()!=2*ScalarPrimitiveTypeTraits::numPrimitiveObjs()
746  || indexObjs.size()!=0
747  || charObjs.size()!=0 );
748 #endif
749  }
750 };
751 
752 
756 template <class Scalar>
757 class PrimitiveTypeTraits<std::complex<Scalar>, Scalar> {
758 public:
760  typedef PrimitiveTypeTraits<Scalar,Scalar> ScalarPrimitiveTypeTraits;
762  typedef typename ScalarPrimitiveTypeTraits::primitiveType primitiveType;
764  static int numPrimitiveObjs()
765  { return ScalarPrimitiveTypeTraits::numPrimitiveObjs(); }
767  static int numIndexObjs() { return 0; }
769  static int numCharObjs() { return 0; }
771  static void extractPrimitiveObjs(
772  const Scalar &obj,
773  const ArrayView<primitiveType> &primitiveObjs,
774  const ArrayView<index_type> &indexObjs,
775  const ArrayView<char> &charObjs
776  )
777  {
778  using Teuchos::null;
779  assertInput(primitiveObjs, indexObjs, charObjs);
780  ScalarPrimitiveTypeTraits::extractPrimitiveObjs(
781  obj, primitiveObjs, null, null );
782  }
784  static void loadPrimitiveObjs(
785  const ArrayView<const primitiveType> &primitiveObjs,
786  const ArrayView<const index_type> &indexObjs,
787  const ArrayView<const char> &charObjs,
788  const Ptr<Scalar > &obj
789  )
790  {
791  using Teuchos::null;
792  assertInput(primitiveObjs, indexObjs, charObjs);
793  ScalarPrimitiveTypeTraits::loadPrimitiveObjs(
794  primitiveObjs, null, null, obj );
795  }
796 private:
797  static void assertInput(
798  const ArrayView<const primitiveType> &primitiveObjs,
799  const ArrayView<const index_type> &indexObjs,
800  const ArrayView<const char> &charObjs
801  )
802  {
803 #ifdef TEUCHOS_DEBUG
805  primitiveObjs.size()!=ScalarPrimitiveTypeTraits::numPrimitiveObjs()
806  || indexObjs.size()!=0
807  || charObjs.size()!=0 );
808 #endif
809  }
810 };
811 
812 
813 #endif // defined(HAVE_COMPLEX) && defined(HAVE_TEUCHOS_COMPLEX)
814 
815 
816 
817 //
818 // Forward declaration for templated types
819 //
820 
821 
823 template<class Scalar> class RTOpT;
824 
825 
826 } // namespace RTOpPack
827 
828 
829 #endif // RTOPPACK_TYPES_HPP
ConstSubMultiVectorView(Ordinal globalOffset_in, Ordinal subDim_in, Ordinal colOffset_in, Ordinal numSubCols_in, const ArrayRCP< const Scalar > &values_in, Ordinal leadingDim_in)
ArrayRCP< const Scalar > values_
bool is_null(const boost::shared_ptr< T > &p)
ArrayRCP< T > persistingView(size_type lowerOffset, size_type size) const
static void extractPrimitiveObjs(const Scalar &obj, const ArrayView< primitiveType > &primitiveObjs, const ArrayView< index_type > &indexObjs, const ArrayView< char > &charObjs)
Class for a changeable sub-vector.
SubMultiVectorView(const SubMultiVectorView< Scalar > &smv)
void assign_entries(const Ptr< const SubVectorView< Scalar > > &msv, const ConstSubVectorView< Scalar > &sv)
static void loadPrimitiveObjs(const ArrayView< const primitiveType > &primitiveObjs, const ArrayView< const index_type > &indexObjs, const ArrayView< const char > &charObjs, const Ptr< Scalar > &obj)
size_type size() const
size_type upperOffset() const
Teuchos_Ordinal index_type
IncompatibleVecs(const std::string &what_arg)
const ArrayRCP< Scalar > values() const
const ArrayRCP< const Scalar >::iterator valuesBegin() const
ConstSubVectorView(Ordinal globalOffset_in, Ordinal subDim_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t stride_in)
size_type size() const
SubMultiVectorView(Ordinal globalOffset_in, Ordinal subDim_in, Ordinal colOffset_in, Ordinal numSubCols_in, const ArrayRCP< Scalar > &values_in, Ordinal leadingDim_in)
Class for a non-changeable sub-vector.
SubVectorView(const ArrayRCP< Scalar > &values_in)
InvalidNumVecs(const std::string &what_arg)
SubMultiVectorView(Ordinal numRows_in, Ordinal numCols_in)
#define TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(index, lower_inclusive, upper_exclusive)
Scalar & operator()(Ordinal i) const
Zero-based indexing (Preconditions: values()!=NULL &amp;&amp; (0 &lt;= i &lt; subDim())).
const ArrayRCP< Scalar > values() const
SubVectorView(Ordinal subDim_in)
TEUCHOS_ORDINAL_TYPE Teuchos_Ordinal
Specialization where the scalar type is the same as the concrete object type.
static void assertInput(const ArrayView< const primitiveType > &primitiveObjs, const ArrayView< const index_type > &indexObjs, const ArrayView< const char > &charObjs)
A templated traits class for decomposing object into an array of primitive objects.
UnknownError(const std::string &what_arg)
SubVectorView(const SubVectorView< Scalar > &sv)
Class for a changeable sub-vector.
static void assertInput(const ArrayView< const primitiveType > &primitiveObjs, const ArrayView< const index_type > &indexObjs, const ArrayView< const char > &charObjs)
SubVectorView< Scalar > col(const Ordinal j) const
Return a SubVectorView view of the jth sub-column (Preconditions: values()!=NULL &amp;&amp; &amp;&amp; (0&lt;=j&lt;numSubCo...
SubVectorView(Ordinal globalOffset_in, Ordinal subDim_in, const ArrayRCP< Scalar > &values_in, ptrdiff_t stride_in)
void initialize(Ordinal globalOffset_in, Ordinal subDim_in, Ordinal colOffset_in, Ordinal numSubCols_in, const ArrayRCP< Scalar > &values_in, Ordinal leadingDim_in)
void initialize(Ordinal globalOffset_in, Ordinal subDim_in, const ArrayRCP< Scalar > &values_in, ptrdiff_t stride_in)
size_type lowerOffset() const
const Scalar & operator[](Ordinal i) const
Zero-based indexing (Preconditions: values()!=NULL &amp;&amp; (0 &lt;= i &lt; subDim())).
static void extractPrimitiveObjs(const Scalar &obj, const ArrayView< primitiveType > &primitiveObjs, const ArrayView< index_type > &indexObjs, const ArrayView< char > &charObjs)
void setGlobalOffset(Ordinal globalOffset_in)
ArrayRCP< const Scalar > values_
InvalidNumTargVecs(const std::string &what_arg)
ConstSubVectorView(const ConstSubVectorView< Scalar > &sv)
void setGlobalOffset(Ordinal globalOffset_in)
ConstSubVectorView(const ArrayRCP< const Scalar > &values_in)
const ArrayRCP< const Scalar > values() const
basic_FancyOStream< char > FancyOStream
InvalidUsage(const std::string &what_arg)
Class for a non-changeable sub-multi-vector (submatrix).
ScalarPrimitiveTypeTraits::primitiveType primitiveType
void initialize(Ordinal globalOffset_in, Ordinal subDim_in, Ordinal colOffset_in, Ordinal numSubCols_in, const ArrayRCP< const Scalar > &values_in, Ordinal leadingDim_in)
static void loadPrimitiveObjs(const ArrayView< const primitiveType > &primitiveObjs, const ArrayView< const index_type > &indexObjs, const ArrayView< const char > &charObjs, const Ptr< index_type > &obj)
static void loadPrimitiveObjs(const ArrayView< const primitiveType > &primitiveObjs, const ArrayView< const index_type > &indexObjs, const ArrayView< const char > &charObjs, const Ptr< Scalar > &obj)
const Scalar & operator()(Ordinal i) const
Zero-based indexing (Preconditions: values()!=NULL &amp;&amp; (0 &lt;= i &lt; subDim())).
ConstSubVectorView< Scalar > col(const Ordinal j) const
Return a ConstSubVectorView view of the jth sub-column (Preconditions: values()!=NULL &amp;&amp; (0&lt;=j&lt;numSub...
PrimitiveTypeTraits< Scalar, Scalar > ScalarPrimitiveTypeTraits
#define TEUCHOS_ASSERT(assertion_test)
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
static void extractPrimitiveObjs(const index_type &obj, const ArrayView< primitiveType > &primitiveObjs, const ArrayView< index_type > &indexObjs, const ArrayView< char > &charObjs)
Teuchos_Ordinal Ordinal
IncompatibleReductObj(const std::string &what_arg)
Scalar & operator[](Ordinal i) const
Zero-based indexing (Preconditions: values()!=NULL &amp;&amp; (0 &lt;= i &lt; subDim())).
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
iterator begin() const
ConstSubMultiVectorView(const ConstSubMultiVectorView< Scalar > &smv)
const ArrayRCP< const Scalar > values() const
Scalar & operator()(Ordinal i, Ordinal j) const
Zero-based indexing (Preconditions: values()!=NULL &amp;&amp; (0&lt;=i&lt; subDim()) &amp;&amp; (0&lt;=j&lt;numSubCols()).
const Scalar & operator()(Ordinal i, Ordinal j) const
Zero-based indexing (Preconditions: values()!=NULL &amp;&amp; (0&lt;=i&lt;subDim()) &amp;&amp; (0&lt;=j&lt; numSubCols()).
void initialize(Ordinal globalOffset_in, Ordinal subDim_in, const ArrayRCP< const Scalar > &values_in, ptrdiff_t stride_in)