10 #ifndef THYRA_DIAGONAL_SCALAR_PROD_DEF_HPP
11 #define THYRA_DIAGONAL_SCALAR_PROD_DEF_HPP
14 #include "Thyra_DiagonalScalarProd_decl.hpp"
15 #include "Thyra_DetachedSpmdVectorView.hpp"
16 #include "Thyra_SpmdVectorSpaceBase.hpp"
17 #include "Thyra_AssertOp.hpp"
18 #include "Teuchos_CommHelpers.hpp"
27 template<
class Scalar>
32 template<
class Scalar>
36 s_diag_ = s_diag.assert_not_null();
43 template<
class Scalar>
50 template<
class Scalar>
63 *s_diag_->space(), *Y.
range() );
75 for (
Ordinal j = 0; j < m; ++j) {
80 Scalar scalarProd_j = ST::zero();
82 for (
Ordinal i = 0; i < x.subDim(); ++i) {
83 scalarProd_j += ST::conjugate(x[i]) * s_diag[i] * y[i];
87 Scalar g_scalarProd_j = 0.0;
88 Teuchos::reduceAll<Ordinal,Scalar>(
91 Teuchos::outArg(g_scalarProd_j)
93 scalarProds_out[j] = g_scalarProd_j;
96 scalarProds_out[j] = scalarProd_j;
104 template<
class Scalar>
116 #endif // THYRA_DIAGONAL_SCALAR_PROD_DEF_HPP
#define THYRA_ASSERT_VEC_SPACES(FUNC_NAME, VS1, VS2)
This is a very useful macro that should be used to validate that two vector spaces are compatible...
bool is_null(const boost::shared_ptr< T > &p)
virtual RCP< const VectorSpaceBase< Scalar > > range() const =0
Return a smart pointer for the range space for this operator.
virtual void scalarProdsImpl(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const
virtual bool isEuclideanImpl() const
Returns false.
RCP< const LinearOpBase< Scalar > > getLinearOpImpl() const
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
Interface for a collection of column vectors called a multi-vector.
RCP< const VectorBase< Scalar > > col(Ordinal j) const
Calls colImpl().
Abstract interface for finite-dimensional dense vectors.
virtual RCP< const VectorSpaceBase< Scalar > > domain() const =0
Return a smart pointer for the domain space for this operator.
const RCP< const SpmdVectorSpaceBase< Scalar > > spmdSpace() const
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
TypeTo as(const TypeFrom &t)
Create an explicit detached non-mutable (const) view of all of the local elements on this process of ...
void initialize(const RCP< const VectorBase< Scalar > > &s_diag)
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)