Go to the documentation of this file. 1 #ifndef PARGEMSLR_VECTOR_H
2 #define PARGEMSLR_VECTOR_H
9 #include "../utils/utils.hpp"
10 #include "../utils/parallel.hpp"
11 #include "../utils/memory.hpp"
91 virtual int Fill(
const T &v) = 0;
99 virtual int MoveData(
const int &location) = 0;
124 template <
typename T>
212 virtual int Fill(
const T &v) = 0;
227 virtual int Scale(
const T &alpha) = 0;
265 virtual int Norm2(
float &norm)
const = 0;
273 virtual int Norm2(
double &norm)
const = 0;
300 #ifdef PARGEMSLR_CUDA
301 #if (PARGEMSLR_CUDA_VERSION == 11)
306 virtual cusparseDnVecDescr_t GetCusparseVec()
const = 0;
virtual long int GetLengthGlobal() const =0
Get the global length of the vector.
virtual int Clear()
Free the current vector.
Definition: vector.cpp:52
virtual int Norm2(float &norm) const =0
Compute the 2-norm of a vector, result is type float.
virtual long int GetStartGlobal() const =0
Get the global start index of the vector.
PrecisionEnum GetPrecision() const
Get the data precision of the vector.
Definition: vector.cpp:66
virtual T & operator[](int i)=0
Get the reference of an index in the vector.
virtual T & operator[](int i)=0
Get the reference of an index in the vector.
virtual int MoveData(const int &location)=0
Move the data to another memory location.
VectorVirtualClass()
The constructor of VectorVirtualClass.
Definition: vector.cpp:8
virtual int Dot(const VectorClass< T > &y, T &t) const =0
Compute the dot product.
virtual int GetDataLocation() const =0
Get the data location of the vector.
virtual int Clear()
Free the current vector.
Definition: vector.cpp:117
virtual int Axpy(const T &alpha, const VectorClass< T > &x)=0
Compute y = alpha * x + y, where y is this vector. Currenlty we don't support x == y.
The virtual class of real/complex vector class.
Definition: vector.hpp:126
virtual int NormInf(float &norm)=0
Compute the inf-norm of a vector, result is type float.
virtual T * GetData() const =0
Get the data pointer of the vector.
virtual int Norm2(double &norm) const =0
Compute the 2-norm of a vector, result is type double.
virtual int NormInf(double &norm)=0
Compute the inf-norm of a vector, result is type double.
The template class complex.
Definition: complex.hpp:24
virtual int GetDataLocation() const =0
Get the data location of the vector.
virtual int Fill(const T &v)=0
Fill the vector with constant value.
virtual T * GetData() const =0
Get the data pointer of the vector.
virtual int Axpy(const T &alpha, const VectorClass< T > &x, VectorClass< T > &y)=0
Compute z = alpha * x + y, where z is this vector. Currenlty we don't support x == y,...
class pargemslr::ParallelLogClass parallel_log
The data structure for parallel computing, including data structures for MPI and CUDA.
VectorClass()
The constructor of VectorClass.
Definition: vector.cpp:90
virtual bool IsParallel() const
Tell if this is a prallel vector.
Definition: vector.cpp:78
virtual ~VectorVirtualClass()
The destructor of VectorVirtualClass.
Definition: vector.cpp:41
virtual int Axpy(const T &alpha, const VectorClass< T > &x, const T &beta, VectorClass< T > &y)=0
Compute z = alpha * x + beta * y, where z is this vector. Currenlty we don't support x == y,...
virtual int Rand()=0
Fill the vector with random value.
virtual int GetLengthLocal() const =0
Get the local length of the vector.
virtual int Scale(const T &alpha)=0
Scale the vector by x = alpha*x, where x is this vector.
virtual int GetLengthLocal() const =0
Get the local length of the vector.
The virtual class of all vector classes.
Definition: vector.hpp:22
Tell if a value is a complex value.
Definition: complex.hpp:684
virtual int Fill(const T &v)=0
Fill the vector with constant value.
virtual int MoveData(const int &location)=0
Move the data to another memory location.
virtual ~VectorClass()
The destructor of VectorClass.
Definition: vector.cpp:129
PrecisionEnum
The precision enum.
Definition: utils.hpp:453