Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_ScalarProdBase_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_SCALAR_PROD_BASE_DECL_HPP
11#define THYRA_SCALAR_PROD_BASE_DECL_HPP
12
13#include "Thyra_OperatorVectorTypes.hpp"
14#include "Teuchos_Describable.hpp"
15
16
17namespace Thyra {
18
19
57template<class Scalar>
58class ScalarProdBase : virtual public Teuchos::Describable {
59public:
60
63
70 bool isEuclidean() const
71 { return isEuclideanImpl(); }
72
94 Scalar scalarProd(
95 const VectorBase<Scalar>& x, const VectorBase<Scalar>& y
96 ) const
97 { return scalarProdImpl(x, y); }
98
134 const ArrayView<Scalar> &scalarProds_out
135 ) const
136 { scalarProdsImpl(X, Y, scalarProds_out); }
137
147
149
150protected:
151
154
156 virtual bool isEuclideanImpl() const = 0;
157
159 virtual Scalar scalarProdImpl(
160 const VectorBase<Scalar>& x, const VectorBase<Scalar>& y ) const;
161
163 virtual void scalarProdsImpl(
165 const ArrayView<Scalar> &scalarProds_out
166 ) const = 0;
167
170 {
171 return Teuchos::null;
172 }
173
175
176};
177
178
179} // end namespace Thyra
180
181
182#endif // THYRA_SCALAR_PROD_BASE_DECL_HPP
Interface for a collection of column vectors called a multi-vector.
Abstract interface for scalar products.
Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
Return the scalar product of two vectors in the vector space.
bool isEuclidean() const
Return if this is a Euclidean (identity) scalar product is the same as the dot product.
virtual Scalar scalarProdImpl(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
Default implementation calls scalarProdsImpl().
virtual bool isEuclideanImpl() const =0
virtual RCP< const LinearOpBase< Scalar > > getLinearOpImpl() const
virtual void scalarProdsImpl(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const =0
RCP< const LinearOpBase< Scalar > > getLinearOp() const
Return a linear operator representing the scalar product Q.
void scalarProds(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const
Return the scalar product of each column in two multi-vectors in the vector space.
Abstract interface for finite-dimensional dense vectors.
T_To & dyn_cast(T_From &from)