| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Rapid Optimization Library (ROL) Package |
| 4 |
// |
| 5 |
// Copyright 2014 NTESS and the ROL contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
/** |
| 11 |
\class Belos::OperatorTraits<Scalar,ROL::MultiVector<Scalar>,ROL::LinearOperator<Scalar>> |
| 12 |
\brief Provides interface for using ROL::LinearOperator with Belos solvers |
| 13 |
(excluding block solvers). |
| 14 |
\author Created by Greg von Winckel |
| 15 |
*/ |
| 16 |
|
| 17 |
|
| 18 |
#ifndef ROL_BELOS_OPERATOR_HPP |
| 19 |
#define ROL_BELOS_OPERATOR_HPP |
| 20 |
|
| 21 |
#include "BelosConfigDefs.hpp" |
| 22 |
#include "BelosTypes.hpp" |
| 23 |
#include "BelosMultiVecTraits.hpp" |
| 24 |
#include "BelosOperatorTraits.hpp" |
| 25 |
|
| 26 |
#include "ROL_MultiVector.hpp" |
| 27 |
#include "ROL_LinearOperator.hpp" |
| 28 |
|
| 29 |
namespace Belos { |
| 30 |
|
| 31 |
template<class Scalar> |
| 32 |
class OperatorTraits<Scalar,ROL::MultiVector<Scalar>,ROL::LinearOperator<Scalar> > { |
| 33 |
public: |
| 34 |
static void |
| 35 |
/// Note that ROL and Belos use reverse orderings |
| 36 |
/// for input and output vectors |
| 37 |
Apply(const ROL::LinearOperator<Scalar>& Op, |
| 38 |
const ROL::MultiVector<Scalar> &X, |
| 39 |
ROL::MultiVector<Scalar> &Y, |
| 40 |
const ETrans trans = NOTRANS) { |
| 41 |
Scalar tol=0; |
| 42 |
int n = X.getNumberOfVectors(); |
| 43 |
for(int i=0;i<n;++i) { |
| 44 |
Op.apply(*(Y.getVector(i)),*(X.getVector(i)),tol); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
static bool |
| 49 |
HasApplyTranspose(const ROL::LinearOperator<Scalar>& Op) { |
| 50 |
return false; |
| 51 |
} |
| 52 |
}; |
| 53 |
|
| 54 |
} |
| 55 |
|
| 56 |
#endif |
| 57 |
|