Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
support
operator_solve
client_support
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
:
35
TEUCHOS_TEST_FOR_EXCEPT
(
true
);
36
}
37
TEUCHOS_UNREACHABLE_RETURN
(RTOpPack::NOTRANS);
38
}
39
// ToDo: Move the above function into Thyra_OperatorVectorTypes.hpp
40
41
57
template
<
class
Scalar>
58
class
DefaultSerialDenseLinearOpWithSolve
59
:
virtual
public
LinearOpWithSolveBase
<Scalar>
60
{
61
public
:
62
65
67
DefaultSerialDenseLinearOpWithSolve
();
68
70
void
initialize
(
const
RCP
<
const
MultiVectorBase<Scalar>
> &M );
71
73
RCP<const LinearOpBase<Scalar>
>
getFwdOp
()
const
;
74
76
79
81
RCP<const VectorSpaceBase<Scalar>
>
range
()
const
;
83
RCP<const VectorSpaceBase<Scalar>
>
domain
()
const
;
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
;
111
bool
solveSupportsSolveMeasureTypeImpl
(
112
EOpTransp M_trans,
const
SolveMeasureType
& solveMeasureType)
const
;
114
SolveStatus<Scalar>
solveImpl
(
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
128
RCP<const MultiVectorBase<Scalar>
> M_;
129
RTOpPack::ConstSubMultiVectorView<Scalar>
LU_;
130
Array<int>
ipiv_;
131
132
// /////////////////////////
133
// Private member functions
134
135
static
void
factorize(
136
const
MultiVectorBase<Scalar>
&M,
137
const
Ptr
<
RTOpPack::ConstSubMultiVectorView<Scalar>
> &LU,
138
const
Ptr
<
Array<int>
> &ipiv
139
);
140
141
static
void
backsolve(
142
const
RTOpPack::ConstSubMultiVectorView<Scalar>
&LU,
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
150
DefaultSerialDenseLinearOpWithSolve
(
const
DefaultSerialDenseLinearOpWithSolve
&);
151
DefaultSerialDenseLinearOpWithSolve
& operator=(
const
DefaultSerialDenseLinearOpWithSolve
&);
152
153
};
154
155
160
template
<
class
Scalar>
161
RCP<DefaultSerialDenseLinearOpWithSolve<Scalar>
>
162
defaultSerialDenseLinearOpWithSolve
()
163
{
164
return
Teuchos::rcp
(
new
DefaultSerialDenseLinearOpWithSolve<Scalar>
);
165
}
166
167
172
template
<
class
Scalar>
173
RCP<DefaultSerialDenseLinearOpWithSolve<Scalar>
>
174
defaultSerialDenseLinearOpWithSolve
(
const
RCP
<
const
MultiVectorBase<Scalar>
> &M )
175
{
176
RCP<DefaultSerialDenseLinearOpWithSolve<Scalar>
>
177
M_lows =
Teuchos::rcp
(
new
DefaultSerialDenseLinearOpWithSolve<Scalar>
());
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
RTOpPack::ConstSubMultiVectorView
Teuchos::Array
Teuchos::ArrayView
Teuchos::Ptr
Teuchos::RCP
Thyra::DefaultSerialDenseLinearOpWithSolve::applyImpl
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:93
Thyra::DefaultSerialDenseLinearOpWithSolve::opSupportedImpl
bool opSupportedImpl(EOpTransp M_trans) const
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:85
Thyra::DefaultSerialDenseLinearOpWithSolve::solveSupportsSolveMeasureTypeImpl
bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:118
Thyra::DefaultSerialDenseLinearOpWithSolve::initialize
void initialize(const RCP< const MultiVectorBase< Scalar > > &M)
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:34
Thyra::DefaultSerialDenseLinearOpWithSolve::range
RCP< const VectorSpaceBase< Scalar > > range() const
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:60
Thyra::DefaultSerialDenseLinearOpWithSolve::solveSupportsImpl
bool solveSupportsImpl(EOpTransp M_trans) const
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:109
Thyra::DefaultSerialDenseLinearOpWithSolve::domain
RCP< const VectorSpaceBase< Scalar > > domain() const
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:70
Thyra::DefaultSerialDenseLinearOpWithSolve::solveImpl
SolveStatus< Scalar > solveImpl(const EOpTransp transp, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:128
Thyra::DefaultSerialDenseLinearOpWithSolve::getFwdOp
RCP< const LinearOpBase< Scalar > > getFwdOp() const
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:50
Thyra::DefaultSerialDenseLinearOpWithSolve::defaultSerialDenseLinearOpWithSolve
RCP< DefaultSerialDenseLinearOpWithSolve< Scalar > > defaultSerialDenseLinearOpWithSolve()
Nonmember constructor.
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_decl.hpp:162
Thyra::DefaultSerialDenseLinearOpWithSolve::DefaultSerialDenseLinearOpWithSolve
DefaultSerialDenseLinearOpWithSolve()
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_def.hpp:29
Thyra::DefaultSerialDenseLinearOpWithSolve::defaultSerialDenseLinearOpWithSolve
RCP< DefaultSerialDenseLinearOpWithSolve< Scalar > > defaultSerialDenseLinearOpWithSolve(const RCP< const MultiVectorBase< Scalar > > &M)
Nonmember constructor.
Definition
Thyra_DefaultSerialDenseLinearOpWithSolve_decl.hpp:174
Thyra::LinearOpWithSolveBase
Base class for all linear operators that can support a high-level solve operation.
Definition
Thyra_LinearOpWithSolveBase_decl.hpp:279
Thyra::MultiVectorBase
Interface for a collection of column vectors called a multi-vector.
Definition
Thyra_MultiVectorBase_decl.hpp:464
TEUCHOS_TEST_FOR_EXCEPT
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Thyra::NOTRANS
NOTRANS
Type for the dimension of a vector space. `**/ typedef Teuchos::Ordinal Ordinal;.
Definition
Thyra_OperatorVectorTypes.hpp:130
TEUCHOS_UNREACHABLE_RETURN
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Teuchos::rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Thyra::SolveCriteria
Simple struct that defines the requested solution criteria for a solve.
Definition
Thyra_SolveSupportTypes.hpp:280
Thyra::SolveMeasureType
Solve tolerance type.
Definition
Thyra_SolveSupportTypes.hpp:80
Thyra::SolveStatus
Simple struct for the return status from a solve.
Definition
Thyra_SolveSupportTypes.hpp:391
Generated by
1.17.0