1#ifndef included_AMP_NativeTpetraVectorOperations_H_
2#define included_AMP_NativeTpetraVectorOperations_H_
4#include "AMP/vectors/Scalar.h"
5#include "AMP/vectors/Vector.h"
6#include "AMP/vectors/operations/VectorOperations.h"
19template<
typename ST = double,
20 typename LO = int32_t,
21 typename GO = int64_t,
22 typename NT = Tpetra::Vector<>::node_type>
29 std::string
VectorOpName()
const override {
return "TpetraVectorOperations"; }
32 return std::make_shared<TpetraVectorOperations<ST, LO, GO, NT>>();
An AMP Vector that uses Tpetra for parallel data management, linear algebra, etc.
Scalar localL2Norm(const AMP::LinearAlgebra::VectorData &x) const override
Return local discrete -norm of this vector.
void setMin(const Scalar &alpha, VectorData &z) override
modify vector to set .
void axpby(const Scalar &alpha, const Scalar &beta, const VectorData &x, VectorData &y) override
Set this vector alpha * x + this. .
void abs(const VectorData &x, VectorData &z) override
Set this to the component-wise absolute value of a vector. .
Scalar localMin(const AMP::LinearAlgebra::VectorData &) const override
Return the local minimum value of the vector. .
void multiply(const VectorData &x, const VectorData &y, VectorData &z) override
Component-wise multiply one vector with another. For Vectors, .
std::shared_ptr< VectorOperations > cloneOperations() const override
Clone the operations.
void scale(const Scalar &alpha, VectorData &x) override
Scale a vector. For Vectors, .
void copyCast(const VectorData &, VectorData &) override
Set vector equal to x (with different precision) For Vectors, .
Scalar localL1Norm(const AMP::LinearAlgebra::VectorData &x) const override
Return local discrete -norm of this vector.
Scalar maxNorm(const VectorData &x) const override
Return the -norm of this vector.
void axpy(const Scalar &alpha, const VectorData &x, const VectorData &y, VectorData &z) override
Set this vector to alpha * x + y. .
std::string VectorOpName() const override
Get the type name.
void zero(VectorData &x) override
Set vector entries (including ghosts) to zero.
Scalar localWrmsNormMask(const AMP::LinearAlgebra::VectorData &, const AMP::LinearAlgebra::VectorData &, const AMP::LinearAlgebra::VectorData &) const override
Return a weighted norm of a subset of a vector.
void reciprocal(const VectorData &x, VectorData &y) override
Set this to the component-wise reciprocal of a vector. .
void setMax(const Scalar &alpha, VectorData &z) override
modify vector to set .
Scalar localMaxNorm(const AMP::LinearAlgebra::VectorData &x) const override
Return the local -norm of this vector.
Scalar localSum(const AMP::LinearAlgebra::VectorData &) const override
Return the local sum of the vector.
void setToScalar(const Scalar &alpha, VectorData &z) override
Set all compenents of a vector to a scalar. For Vectors, the components of z are set to .
Scalar L2Norm(const VectorData &x) const override
Return discrete -norm of this vector.
Scalar max(const VectorData &x) const override
Return the maximum value of the vector. .
void scale(const Scalar &alpha, const VectorData &x, VectorData &y) override
Set vector equal to scaled input. For Vectors, .
virtual ~TpetraVectorOperations()=default
Scalar dot(const VectorData &x, const VectorData &y) const override
Return the dot product of this vector with the argument vector.
Scalar localMinQuotient(const AMP::LinearAlgebra::VectorData &, const AMP::LinearAlgebra::VectorData &) const override
Returns the local minimum of the quotient of two vectors:
void subtract(const VectorData &x, const VectorData &y, VectorData &z) override
Subtracts one vector from another. For Vectors, .
Scalar localMax(const AMP::LinearAlgebra::VectorData &) const override
Return the local maximum value of the vector. .
Scalar L1Norm(const VectorData &x) const override
Return discrete -norm of this vector.
TpetraVectorOperations()=default
void divide(const VectorData &x, const VectorData &y, VectorData &z) override
Component-wise divide one vector by another. For Vectors, .
void linearSum(const Scalar &alpha, const VectorData &x, const Scalar &beta, const VectorData &y, VectorData &z) override
Set a vector to be a linear combination of two vectors. .
bool localEquals(const AMP::LinearAlgebra::VectorData &, const AMP::LinearAlgebra::VectorData &, const AMP::Scalar &) const override
Determine if the local portion of two vectors are equal using an absolute tolerance.
Scalar localDot(const AMP::LinearAlgebra::VectorData &x, const VectorData &y) const override
Return the local dot product of this vector with the argument vector.
Scalar min(const VectorData &x) const override
Return the minimum value of the vector. .
void add(const VectorData &x, const VectorData &y, VectorData &z) override
Adds two vectors. For Vectors, .
void addScalar(const VectorData &, const Scalar &, VectorData &) override
set vector to .
Scalar localWrmsNorm(const AMP::LinearAlgebra::VectorData &, const AMP::LinearAlgebra::VectorData &) const override
Return a weighted norm of a vector.
void setRandomValues(VectorData &x) override
Set data in this vector to random values.
void copy(const VectorData &x, VectorData &z) override
Set vector equal to x For Vectors, .
A class used to hold vector data.
A class used to hold vector operations.
Scalar is a class used to store a scalar variable that may be different types/precision.
#define AMP_ERROR(MSG)
Throw error.