10#ifndef TPETRA_LINEARPROBLEM_DEF_HPP
11#define TPETRA_LINEARPROBLEM_DEF_HPP
21#include "Teuchos_DataAccess.hpp"
22#include "Teuchos_TestForException.hpp"
24#include "Tpetra_MultiVector.hpp"
29template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
38template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
41 const Teuchos::RCP<multivector_type>&
X,
42 const Teuchos::RCP<multivector_type>&
B)
49template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
58template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
60 leftScale(
const Teuchos::RCP<const vector_type>&
D, Teuchos::ETransp
mode) {
61 const Scalar ST0 = Teuchos::ScalarTraits<Scalar>::zero();
62 const Scalar ST1 = Teuchos::ScalarTraits<Scalar>::one();
63 if (
mode == Teuchos::NO_TRANS) {
65 B_->elementWiseMultiply(
ST1, *
D, *B_,
ST0);
70 X_->elementWiseMultiply(
ST1,
R, *X_,
ST0);
76template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
78 rightScale(
const Teuchos::RCP<const vector_type>&
D, Teuchos::ETransp
mode) {
79 const Scalar ST0 = Teuchos::ScalarTraits<Scalar>::zero();
80 const Scalar ST1 = Teuchos::ScalarTraits<Scalar>::one();
81 if (
mode == Teuchos::NO_TRANS) {
85 X_->elementWiseMultiply(
ST1,
R, *X_,
ST0);
88 B_->elementWiseMultiply(
ST1, *
D, *B_,
ST0);
93template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
99 "Linear problem does not have a matrix (A_).");
102 std::logic_error,
"Solution vector (X_) is unset.");
105 std::logic_error,
"RHS vector (B_) is unset.");
108 std::logic_error,
"Domain map of matrix is not the 'same as' the solution map.");
111 std::logic_error,
"Range map of matrix is not the 'same as' the RHS map.");
116template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
123 if (src ==
nullptr) {
129 return ((this->A_->getDomainMap() == src->getMatrix()->getDomainMap())
and
130 (this->A_->getRangeMap() == src->getMatrix()->getRangeMap()));
142#define TPETRA_LINEARPROBLEM_INSTANT(SCALAR, LO, GO, NODE) \
143 template class LinearProblem<SCALAR, LO, GO, NODE>;
Declaration of Tpetra::Details::Behavior, a class that describes Tpetra's behavior.
Declaration of the Tpetra::MultiVector class.
Struct that holds views of the contents of a CrsMatrix.
virtual bool checkSizes(const SrcDistObject &source) override
Compare the source and target (this) objects for compatibility.
void rightScale(const Teuchos::RCP< const vector_type > &D, Teuchos::ETransp mode=Teuchos::NO_TRANS)
Perform right scaling of a linear problem.
LinearProblem()
Default Constructor.
void leftScale(const Teuchos::RCP< const vector_type > &D, Teuchos::ETransp mode=Teuchos::NO_TRANS)
Perform left scaling of a linear problem.
void checkInput() const
Check input parameters for existence and size consistency.
Abstract base class for objects that can be the source of an Import or Export operation.
A distributed dense vector.
Namespace Tpetra contains the class and methods constituting the Tpetra library.