/usr/include/trilinos/Thyra_OperatorVectorTypes.hpp is in libtrilinos-thyra-dev 12.10.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | // @HEADER
// ***********************************************************************
//
// Thyra: Interfaces and Support for Abstract Numerical Algorithms
// Copyright (2004) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
//
// ***********************************************************************
// @HEADER
#ifndef THYRA_OPERATOR_VECTOR_TYPES_HPP
#define THYRA_OPERATOR_VECTOR_TYPES_HPP
#include "Thyra_ConfigDefs.hpp"
#include "RTOpPack_Types.hpp"
#include "Teuchos_Range1D.hpp"
#include "Teuchos_RCP.hpp"
#include "Teuchos_FancyOStream.hpp"
#include "Teuchos_Array.hpp"
#include "Teuchos_ArrayRCP.hpp"
#include "Teuchos_ArrayView.hpp"
#include "Teuchos_Tuple.hpp"
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_ScalarTraits.hpp"
#include "Teuchos_TypeNameTraits.hpp"
namespace Thyra {
// Using declarations from Teuchos
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::Ptr;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::RCP;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::Array;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::ArrayView;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::ArrayRCP;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::Tuple;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
typedef Teuchos::Range1D Range1D;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::FancyOStream;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::ParameterList;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::ScalarTraits;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::typeName;
/** \brief .
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
using Teuchos::TypeNameTraits;
/** \brief Type for the dimension of a vector space.
`*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
typedef Teuchos::Ordinal Ordinal;
/** \brief Enumeration for determining how a linear operator is applied.
`*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
enum EConj {
NONCONJ_ELE ///< Use the linear operator with non-conjugate elements.
,CONJ_ELE ///< Use the linear operator with conjugate elements.
};
/** \brief Return a string name for a <tt>EOpTransp</tt> value.
`*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
inline
const char* toString(EConj conj)
{
switch(conj) {
case NONCONJ_ELE: return "NONCONJ_ELE";
case CONJ_ELE: return "CONJ_ELE";
default: TEUCHOS_TEST_FOR_EXCEPT(true);
}
// return "BAD"; // Should never be called!
}
/** \brief Enumeration for determining how a linear operator is applied.
`*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
enum EOpTransp {
/** \brief Use the non-transposed operator. */
NOTRANS,
/** \brief Use the non-transposed operator with complex-conjugate elements
* (same as <tt>NOTRANS</tt> for real scalar types).
*/
CONJ,
/** \brief Use the transposed operator. */
TRANS,
/** \brief Use the transposed operator with complex-conjugate clements (same
* as <tt>TRANS</tt> for real scalar types).
*/
CONJTRANS
};
/** \brief Return a string name for a <tt>EOpTransp</tt> value.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
inline
const char* toString(EOpTransp transp)
{
switch(transp) {
case NOTRANS: return "NOTRANS";
case CONJ: return "CONJ";
case TRANS: return "TRANS";
case CONJTRANS: return "CONJTRANS";
default: TEUCHOS_TEST_FOR_EXCEPT(true);
}
// return "BAD"; // Should never be called!
}
/** \brief Return <tt>NOTRANS</tt> or <tt>TRANS</tt> for real scalar valued
* operators and this also is used for determining structural transpose.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
inline
EOpTransp real_trans(EOpTransp transp)
{
switch(transp) {
case NOTRANS: return NOTRANS;
case CONJ: return NOTRANS;
case TRANS: return TRANS;
case CONJTRANS: return TRANS;
default: TEUCHOS_TEST_FOR_EXCEPT(true);
}
// return NOTRANS; // Will never be called!
}
/** \brief Perform a not operation on an EOpTransp value
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
inline
EOpTransp not_trans( EOpTransp transp )
{
switch(transp) {
case NOTRANS: return TRANS;
case CONJ: return CONJTRANS;
case TRANS: return CONJ;
case CONJTRANS: return NOTRANS;
default: TEUCHOS_TEST_FOR_EXCEPT(true);
}
// return NOTRANS; // Will never be called!
}
/** \brief Combine two transpose arguments
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
inline
EOpTransp trans_trans( EOpTransp trans1, EOpTransp trans2 )
{
if( trans1 == trans2 )
return NOTRANS;
if( trans1 == NOTRANS )
return trans2;
if( trans2 == NOTRANS )
return trans1;
if( ( trans1 == CONJ && trans2 == TRANS ) || ( trans2 == CONJ && trans1 == TRANS ) )
return CONJTRANS;
if( ( trans1 == TRANS && trans2 == CONJTRANS ) || ( trans2 == TRANS && trans1 == CONJTRANS ) )
return CONJ;
if( ( trans1 == CONJ && trans2 == CONJTRANS ) || ( trans2 == CONJ && trans1 == CONJTRANS ) )
return TRANS;
else
TEUCHOS_TEST_FOR_EXCEPT(true);
// return NOTRANS; // Will never be executed!
}
/** \brief Convert from <tt>EOpTransp</tt> to <tt>EConj</tt>.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
inline
EConj transToConj( EOpTransp trans )
{
switch(trans) {
case NOTRANS: return NONCONJ_ELE;
case CONJ: return CONJ_ELE;
case TRANS: return NONCONJ_ELE;
case CONJTRANS: return CONJ_ELE;
default: TEUCHOS_TEST_FOR_EXCEPT(true);
}
// return NONCONJ_ELE; // Will never be called!
}
/** \brief Convert from <tt>EConj</tt> to <tt>EOpTransp</tt> for forward apply.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
inline
EOpTransp applyConjToTrans( EConj conj )
{
switch(conj) {
case NONCONJ_ELE: return NOTRANS;
case CONJ_ELE: return CONJ;
default: TEUCHOS_TEST_FOR_EXCEPT(true);
}
// return NOTRANS; // Will never be called!
}
/** \brief Convert from <tt>EConj</tt> to <tt>EOpTransp</tt> for forward apply.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
inline
EOpTransp applyTransposeConjToTrans( EConj conj )
{
switch(conj) {
case NONCONJ_ELE: return TRANS;
case CONJ_ELE: return CONJTRANS;
default: TEUCHOS_TEST_FOR_EXCEPT(true);
}
// return NOTRANS; // Will never be called!
}
/** \brief Determines if a view is a direct view of data or a detached copy of
* data.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
enum EViewType {
VIEW_TYPE_DIRECT ///< The view is a direct view of data and no copies are made.
,VIEW_TYPE_DETACHED ///< The view is a detached copy of the data.
};
/** \brief Determine if data is unit stride or non-unit stride.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
enum EStrideType {
/// The stride between elements in an array is one.
STRIDE_TYPE_UNIT,
/// The stride between elements in an array is greater than or equal to one.
STRIDE_TYPE_NONUNIT
};
namespace Exceptions {
/** \brief Thrown if any member functions are called before initialize() has
* been called.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
class UnInitialized : public std::logic_error
{public: UnInitialized(const std::string& what_arg)
: std::logic_error(what_arg) {}};
/** \brief Thrown if vector spaces are incompatible.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
class IncompatibleVectorSpaces : public std::logic_error
{public:
IncompatibleVectorSpaces(const std::string& what_arg)
: std::logic_error(what_arg) {}
};
/** \biref Thrown if the argument <tt>M_trans</tt> is not supported.
*
* \ingroup Thyra_Op_Vec_fundamental_interfaces_code_grp
*/
class OpNotSupported : public std::logic_error
{public: OpNotSupported(const std::string& what_arg)
: std::logic_error(what_arg) {}};
} // namespace Exceptions
// Fundamental ANA operator/vector interface classes
template<class Scalar> class VectorSpaceFactoryBase;
template<class Scalar> class VectorSpaceBase;
template<class Scalar> class LinearOpBase;
template<class Scalar> class MultiVectorBase;
template<class Scalar> class VectorBase;
} // end namespace Thyra
#endif // THYRA_OPERATOR_VECTOR_TYPES_HPP
|