1 #ifndef PARALUTION_VECTOR_HPP_
2 #define PARALUTION_VECTOR_HPP_
12 template <
typename ValueType>
16 template <
typename ValueType>
25 virtual int get_size(
void)
const = 0;
29 virtual bool Check(
void)
const = 0;
32 virtual void Clear() = 0;
35 virtual void Zeros() = 0;
38 virtual void Ones() = 0;
41 virtual void SetValues(
const ValueType val) = 0;
44 virtual void SetRandom(
const ValueType a = -1.0,
const ValueType
b = 1.0,
const int seed = 0) = 0;
81 const ValueType beta);
88 virtual void Scale(
const ValueType alpha) = 0;
100 virtual ValueType
Norm(
void)
const = 0;
103 virtual ValueType
Reduce(
void)
const = 0;
106 virtual ValueType
Asum(
void)
const = 0;
109 virtual int Amax(ValueType &value)
const = 0;
125 #endif // PARALUTION_VECTOR_HPP_
virtual void SetRandom(const ValueType a=-1.0, const ValueType b=1.0, const int seed=0)=0
Set random values from interval [a,b].
virtual ValueType Asum(void) const =0
Compute the sum of the absolute values of the vector (L1 norm), return = sum(|this|) ...
virtual bool Check(void) const =0
Return true if the vector is ok (empty vector is also ok) and false if some of values are NaN...
virtual void ReadFileBinary(const std::string)=0
Read vector from binary file.
virtual void PointWiseMult(const LocalVector< ValueType > &x)
Perform point-wise multiplication (element-wise) of type this = this * x.
Definition: vector.cpp:128
virtual void CopyFromAsync(const LocalVector< ValueType > &src)
Async copy.
Definition: vector.cpp:40
virtual ~Vector()
Definition: vector.cpp:21
virtual void ScaleAddScale(const ValueType alpha, const LocalVector< ValueType > &x, const ValueType beta)
Perform vector update of type this = alpha*this + x*beta.
Definition: vector.cpp:151
virtual void CopyFromFloat(const LocalVector< float > &src)
Copy values from float vector.
Definition: vector.cpp:51
virtual int Amax(ValueType &value) const =0
Compute the absolute max value of the vector, return = index(max(|this|))
Definition: vector.hpp:17
virtual ValueType DotNonConj(const LocalVector< ValueType > &x) const
Compute non-conjugate dot (scalar) product, return this^T y.
Definition: vector.cpp:117
virtual ValueType Reduce(void) const =0
Reduce the vector.
virtual void Scale(const ValueType alpha)=0
Perform vector scaling this = alpha*this.
const IndexType const IndexType const IndexType const ValueType const ValueType const ValueType ValueType * y
Definition: cuda_kernels_coo.hpp:91
virtual void Clear()=0
Clear (free) the vector.
virtual void WriteFileASCII(const std::string) const =0
Write vector to ASCII file.
virtual void ReadFileASCII(const std::string)=0
Read vector from ASCII file.
void power(const int mic_dev, const int size, const double val, ValueType *vec)
Definition: mic_vector_kernel.cpp:241
virtual void WriteFileBinary(const std::string) const =0
Write vector to binary file.
virtual void PartialSum(const LocalVector< ValueType > &x)
Computes partial sum.
Definition: vector.cpp:174
virtual void CopyFrom(const LocalVector< ValueType > &src)
Copy values from another local vector.
Definition: vector.cpp:29
Base class for operator and vector (i.e. global/local matrix/stencil/vector) classes, all the backend-related interface and data are defined here.
Definition: base_paralution.hpp:41
virtual void Ones()=0
Set the values of the vector to one.
virtual void CopyFromDouble(const LocalVector< double > &src)
Copy values from double vector.
Definition: vector.cpp:62
Vector()
Definition: vector.cpp:11
virtual ValueType Dot(const LocalVector< ValueType > &x) const
Compute dot (scalar) product, return this^T y.
Definition: vector.cpp:106
Definition: backend_manager.cpp:43
virtual void Power(const double power)=0
Perform power operation to a vector.
virtual int get_size(void) const =0
Return the size of the vector.
const IndexType const IndexType const IndexType const ValueType const ValueType const ValueType * x
Definition: cuda_kernels_coo.hpp:91
virtual void Zeros()=0
Set the values of the vector to zero.
virtual void SetValues(const ValueType val)=0
Set the values of the vector to given argument.
virtual ValueType Norm(void) const =0
Compute L2 norm of the vector, return = srqt(this^T this)
virtual void AddScale(const LocalVector< ValueType > &x, const ValueType alpha)
Perform vector update of type this = this + alpha*x.
Definition: vector.cpp:84
virtual void CloneFrom(const LocalVector< ValueType > &src)
Clone the entire vector (data+backend descr) from another local vector.
Definition: vector.cpp:73
virtual void ScaleAdd2(const ValueType alpha, const LocalVector< ValueType > &x, const ValueType beta, const LocalVector< ValueType > &y, const ValueType gamma)
Perform vector update of type this = alpha*this + x*beta + y*gamma.
Definition: vector.cpp:162
virtual void ScaleAdd(const ValueType alpha, const LocalVector< ValueType > &x)
Perform vector update of type this = alpha*this + x.
Definition: vector.cpp:95
Definition: host_vector.hpp:13