Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultSerialDenseLinearOpWithSolve_decl.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_DEFAULT_SERIAL_DENSE_LINEAR_OP_WITH_SOLVE_DECL_HPP
11 #define THYRA_DEFAULT_SERIAL_DENSE_LINEAR_OP_WITH_SOLVE_DECL_HPP
12 
13 
14 #include "Thyra_LinearOpWithSolveBase.hpp"
15 #include "RTOpPack_LapackWrappers.hpp"
16 
17 
18 namespace Thyra {
19 
20 
21 /* \brief . */
22 inline RTOpPack::ETransp convertToRTOpPackETransp( const EOpTransp transp )
23 {
24 #ifdef TEUCHOS_DEBUG
25  TEUCHOS_TEST_FOR_EXCEPT(transp == CONJ);
26 #endif
27  switch(transp) {
28  case NOTRANS:
29  return RTOpPack::NOTRANS;
30  case TRANS:
31  return RTOpPack::TRANS;
32  case CONJTRANS:
33  return RTOpPack::CONJTRANS;
34  default:
36  }
38 }
39 // ToDo: Move the above function into Thyra_OperatorVectorTypes.hpp
40 
41 
57 template<class Scalar>
59  : virtual public LinearOpWithSolveBase<Scalar>
60 {
61 public:
62 
65 
68 
70  void initialize( const RCP<const MultiVectorBase<Scalar> > &M );
71 
74 
76 
79 
84 
86 
87 protected:
88 
91 
93  bool opSupportedImpl(EOpTransp M_trans) const;
95  void applyImpl(
96  const EOpTransp M_trans,
97  const MultiVectorBase<Scalar> &X,
98  const Ptr<MultiVectorBase<Scalar> > &Y,
99  const Scalar alpha,
100  const Scalar beta
101  ) const;
102 
104 
107 
109  bool solveSupportsImpl(EOpTransp M_trans) const;
112  EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const;
115  const EOpTransp transp,
116  const MultiVectorBase<Scalar> &B,
117  const Ptr<MultiVectorBase<Scalar> > &X,
118  const Ptr<const SolveCriteria<Scalar> > solveCriteria
119  ) const;
120 
122 
123 private:
124 
125  // /////////////////////////
126  // Private data members
127 
130  Array<int> ipiv_;
131 
132  // /////////////////////////
133  // Private member functions
134 
135  static void factorize(
136  const MultiVectorBase<Scalar> &M,
138  const Ptr<Array<int> > &ipiv
139  );
140 
141  static void backsolve(
143  const ArrayView<const int> ipiv,
144  const EOpTransp transp,
145  const MultiVectorBase<Scalar> &B,
146  const Ptr<MultiVectorBase<Scalar> > &X
147  );
148 
149  // Not defined and not to be called
152 
153 };
154 
155 
160 template<class Scalar>
163 {
165 }
166 
167 
172 template<class Scalar>
175 {
178  M_lows->initialize(M); // With throw if singular
179  return M_lows;
180 }
181 
182 
183 } // end namespace Thyra
184 
185 
186 #endif // THYRA_DEFAULT_SERIAL_DENSE_LINEAR_OP_WITH_SOLVE_DECL_HPP
SolveStatus< Scalar > solveImpl(const EOpTransp transp, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
RCP< DefaultSerialDenseLinearOpWithSolve< Scalar > > defaultSerialDenseLinearOpWithSolve()
Nonmember constructor.
Base class for all linear operators that can support a high-level solve operation.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
Simple concreate subclass of LinearOpWithSolveBase for serial dense matrices implemented using LAPACK...
Use the non-transposed operator.
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types)...
Use the non-transposed operator with complex-conjugate elements (same as NOTRANS for real scalar type...
bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
void initialize(const RCP< const MultiVectorBase< Scalar > > &M)
Use the transposed operator.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Interface for a collection of column vectors called a multi-vector.
Simple struct for the return status from a solve.
RCP< DefaultSerialDenseLinearOpWithSolve< Scalar > > defaultSerialDenseLinearOpWithSolve(const RCP< const MultiVectorBase< Scalar > > &M)
Nonmember constructor.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
Simple struct that defines the requested solution criteria for a solve.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)