Thyra Version of the Day
Loading...
Searching...
No Matches
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
18namespace Thyra {
19
20
21/* \brief . */
22inline RTOpPack::ETransp convertToRTOpPackETransp( const EOpTransp transp )
23{
24#ifdef TEUCHOS_DEBUG
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 }
37 TEUCHOS_UNREACHABLE_RETURN(RTOpPack::NOTRANS);
38}
39// ToDo: Move the above function into Thyra_OperatorVectorTypes.hpp
40
41
57template<class Scalar>
59 : virtual public LinearOpWithSolveBase<Scalar>
60{
61public:
62
65
68
70 void initialize( const RCP<const MultiVectorBase<Scalar> > &M );
71
74
76
79
84
86
87protected:
88
91
93 bool opSupportedImpl(EOpTransp M_trans) const;
95 void applyImpl(
96 const EOpTransp M_trans,
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,
117 const Ptr<MultiVectorBase<Scalar> > &X,
118 const Ptr<const SolveCriteria<Scalar> > solveCriteria
119 ) const;
120
122
123private:
124
125 // /////////////////////////
126 // Private data members
127
130 Array<int> ipiv_;
131
132 // /////////////////////////
133 // Private member functions
134
135 static void factorize(
138 const Ptr<Array<int> > &ipiv
139 );
140
141 static void backsolve(
143 const ArrayView<const int> ipiv,
144 const EOpTransp transp,
147 );
148
149 // Not defined and not to be called
152
153};
154
155
160template<class Scalar>
166
167
172template<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
Simple concreate subclass of LinearOpWithSolveBase for serial dense matrices implemented using LAPACK...
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
void initialize(const RCP< const MultiVectorBase< Scalar > > &M)
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.
RCP< DefaultSerialDenseLinearOpWithSolve< Scalar > > defaultSerialDenseLinearOpWithSolve(const RCP< const MultiVectorBase< Scalar > > &M)
Nonmember constructor.
Base class for all linear operators that can support a high-level solve operation.
Interface for a collection of column vectors called a multi-vector.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
@ TRANS
Use the transposed operator.
@ NOTRANS
Use the non-transposed operator.
@ CONJTRANS
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types).
@ CONJ
Use the non-transposed operator with complex-conjugate elements (same as NOTRANS for real scalar type...
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Simple struct that defines the requested solution criteria for a solve.
Simple struct for the return status from a solve.