Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
17 namespace Thyra {
18 
19 
57 template<class Scalar>
58 class ScalarProdBase : virtual public Teuchos::Describable {
59 public:
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 
146  { return getLinearOpImpl(); }
147 
149 
150 protected:
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
RCP< const LinearOpBase< Scalar > > getLinearOp() const
Return a linear operator representing the scalar product Q.
virtual bool isEuclideanImpl() const =0
bool isEuclidean() const
Return if this is a Euclidean (identity) scalar product is the same as the dot product.
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.
Interface for a collection of column vectors called a multi-vector.
Abstract interface for finite-dimensional dense vectors.
virtual Scalar scalarProdImpl(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
Default implementation calls scalarProdsImpl().
Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
Return the scalar product of two vectors in the vector space.
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