Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_OperatorVectorTypes.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_OPERATOR_VECTOR_TYPES_HPP
11 #define THYRA_OPERATOR_VECTOR_TYPES_HPP
12 
13 #include "Thyra_ConfigDefs.hpp"
14 #include "RTOpPack_Types.hpp"
15 #include "Teuchos_Range1D.hpp"
16 #include "Teuchos_RCP.hpp"
17 #include "Teuchos_FancyOStream.hpp"
18 #include "Teuchos_Array.hpp"
19 #include "Teuchos_ArrayRCP.hpp"
20 #include "Teuchos_ArrayView.hpp"
21 #include "Teuchos_Tuple.hpp"
22 #include "Teuchos_ParameterList.hpp"
23 #include "Teuchos_ScalarTraits.hpp"
24 #include "Teuchos_TypeNameTraits.hpp"
25 
26 
27 namespace Thyra {
28 
29 // Using declarations from Teuchos
30 
35 using Teuchos::Ptr;
40 using Teuchos::RCP;
45 using Teuchos::Array;
50 using Teuchos::ArrayView;
55 using Teuchos::ArrayRCP;
60 using Teuchos::Tuple;
85 using Teuchos::typeName;
96 
97 
102 enum EConj {
105 };
106 
107 
112 inline
113 const char* toString(EConj conj)
114 {
115  switch(conj) {
116  case NONCONJ_ELE: return "NONCONJ_ELE";
117  case CONJ_ELE: return "CONJ_ELE";
118  default: TEUCHOS_TEST_FOR_EXCEPT(true);
119  }
120  // return "BAD"; // Should never be called!
121 }
122 
123 
128 enum EOpTransp {
141 };
142 
143 
148 inline
149 const char* toString(EOpTransp transp)
150 {
151  switch(transp) {
152  case NOTRANS: return "NOTRANS";
153  case CONJ: return "CONJ";
154  case TRANS: return "TRANS";
155  case CONJTRANS: return "CONJTRANS";
156  default: TEUCHOS_TEST_FOR_EXCEPT(true);
157  }
158  // return "BAD"; // Should never be called!
159 }
160 
161 
167 inline
169 {
170  switch(transp) {
171  case NOTRANS: return NOTRANS;
172  case CONJ: return NOTRANS;
173  case TRANS: return TRANS;
174  case CONJTRANS: return TRANS;
175  default: TEUCHOS_TEST_FOR_EXCEPT(true);
176  }
177  // return NOTRANS; // Will never be called!
178 }
179 
180 
185 inline
187 {
188  switch(transp) {
189  case NOTRANS: return TRANS;
190  case CONJ: return CONJTRANS;
191  case TRANS: return CONJ;
192  case CONJTRANS: return NOTRANS;
193  default: TEUCHOS_TEST_FOR_EXCEPT(true);
194  }
195  // return NOTRANS; // Will never be called!
196 }
197 
198 
203 inline
205 {
206  if( trans1 == trans2 )
207  return NOTRANS;
208  if( trans1 == NOTRANS )
209  return trans2;
210  if( trans2 == NOTRANS )
211  return trans1;
212  if( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) )
213  return CONJTRANS;
214  if( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) )
215  return CONJ;
216  if( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) )
217  return TRANS;
218  else
220  // return NOTRANS; // Will never be executed!
221 }
222 
223 
228 inline
230 {
231  switch(trans) {
232  case NOTRANS: return NONCONJ_ELE;
233  case CONJ: return CONJ_ELE;
234  case TRANS: return NONCONJ_ELE;
235  case CONJTRANS: return CONJ_ELE;
236  default: TEUCHOS_TEST_FOR_EXCEPT(true);
237  }
238  // return NONCONJ_ELE; // Will never be called!
239 }
240 
245 inline
247 {
248  switch(conj) {
249  case NONCONJ_ELE: return NOTRANS;
250  case CONJ_ELE: return CONJ;
251  default: TEUCHOS_TEST_FOR_EXCEPT(true);
252  }
253  // return NOTRANS; // Will never be called!
254 }
255 
256 
261 inline
263 {
264  switch(conj) {
265  case NONCONJ_ELE: return TRANS;
266  case CONJ_ELE: return CONJTRANS;
267  default: TEUCHOS_TEST_FOR_EXCEPT(true);
268  }
269  // return NOTRANS; // Will never be called!
270 }
271 
277 enum EViewType {
280 };
281 
282 
292 };
293 
294 
295 namespace Exceptions {
296 
297 
303 class UnInitialized : public std::logic_error
304 {public: UnInitialized(const std::string& what_arg)
305  : std::logic_error(what_arg) {}};
306 
307 
312 class IncompatibleVectorSpaces : public std::logic_error
313 {public:
314  IncompatibleVectorSpaces(const std::string& what_arg)
315  : std::logic_error(what_arg) {}
316 };
317 
318 
323 class OpNotSupported : public std::logic_error
324 {public: OpNotSupported(const std::string& what_arg)
325  : std::logic_error(what_arg) {}};
326 
327 
328 } // namespace Exceptions
329 
330 
331 // Fundamental ANA operator/vector interface classes
332 
333 
334 template<class Scalar> class VectorSpaceFactoryBase;
335 template<class Scalar> class VectorSpaceBase;
336 template<class Scalar> class LinearOpBase;
337 template<class Scalar> class MultiVectorBase;
338 template<class Scalar> class VectorBase;
339 
340 
341 } // end namespace Thyra
342 
343 
344 #endif // THYRA_OPERATOR_VECTOR_TYPES_HPP
Use the linear operator with conjugate elements.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
Thrown if vector spaces are incompatible.
The view is a direct view of data and no copies are made.
The stride between elements in an array is greater than or equal to one.
basic_FancyOStream< char > FancyOStream
Use the non-transposed operator.
EOpTransp real_trans(EOpTransp transp)
Return NOTRANS or TRANS for real scalar valued operators and this also is used for determining struct...
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types)...
EOpTransp not_trans(EOpTransp transp)
Perform a not operation on an EOpTransp value.
Abstract interface for objects that represent a space for vectors.
EViewType
Determines if a view is a direct view of data or a detached copy of data.
EConj transToConj(EOpTransp trans)
Convert from EOpTransp to EConj.
Use the non-transposed operator with complex-conjugate elements (same as NOTRANS for real scalar type...
The view is a detached copy of the data.
Abstract interface for objects that can create vector spaces of a specified dimension.
Use the transposed operator.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Interface for a collection of column vectors called a multi-vector.
Thrown if any member functions are called before initialize() has been called.
EOpTransp trans_trans(EOpTransp trans1, EOpTransp trans2)
Combine two transpose arguments.
Abstract interface for finite-dimensional dense vectors.
TEUCHOSCORE_LIB_DLL_EXPORT std::string toString(const EVerbosityLevel verbLevel)
EOpTransp applyConjToTrans(EConj conj)
Convert from EConj to EOpTransp for forward apply.
The stride between elements in an array is one.
Base class for all linear operators.
Use the linear operator with non-conjugate elements.
EStrideType
Determine if data is unit stride or non-unit stride.
EOpTransp applyTransposeConjToTrans(EConj conj)
Convert from EConj to EOpTransp for forward apply.
EConj
Enumeration for determining how a linear operator is applied. `*.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
std::string typeName(const T &t)
Teuchos::Range1D Range1D