Go to the documentation of this file. 1 #ifndef PARGEMSLR_COO_MATRIX_H
2 #define PARGEMSLR_COO_MATRIX_H
10 #include "../utils/utils.hpp"
11 #include "../vectors/sequential_vector.hpp"
123 int Setup(
int nrows,
int ncols);
133 int Setup(
int nrows,
int ncols,
int reserve);
144 int Setup(
int nrows,
int ncols,
int reserve,
int location);
201 virtual int Fill(
const T &v);
209 virtual int Scale(
const T &alpha);
217 virtual int MoveData(
const int &location);
227 int PushBack(
int row,
int col, T v);
315 int Laplacian(
int nx,
int ny,
int nz, T alphax, T alphay, T alphaz, T shift,
bool rand_perturb =
false);
345 int PlotPatternGnuPlot(
const char *datafilename,
int *rperm,
int *cperm,
int conditiona,
int conditionb);
virtual long int GetNumNonzeros() const
Get the number of nonzeros in this matrix.
Definition: coo_matrix.cpp:271
int Setup(int nrows, int ncols)
Free the current matrix, and create the new matrix using the default reserved memory size on the host...
Definition: coo_matrix.cpp:140
int Laplacian(int nx, int ny, int nz, T alphax, T alphay, T alphaz, T shift, bool rand_perturb=false)
Generate Laplacian matrix, 5-pt for 2D problem and 7-pt for 3D problem.
Definition: coo_matrix.cpp:519
CSR matrix data structure.
int * GetI() const
Get the I pointer of the matrix.
Definition: coo_matrix.cpp:313
IntVectorClass< int > & GetJVector()
Get the reference to the J vector.
Definition: coo_matrix.cpp:363
CooMatrixClass()
The constructor of CooMatrixClass.
Definition: coo_matrix.cpp:24
SequentialVectorClass< T > & GetDataVector()
Get the reference to the data vector.
Definition: coo_matrix.cpp:384
T * GetData() const
Get the data pointer of the matrix.
Definition: coo_matrix.cpp:333
virtual int MoveData(const int &location)
Move the data to another memory location.
Definition: coo_matrix.cpp:440
int ToCsr(int location, CsrMatrixClass< T > &csrmat_out)
Convert the matrix to csr.
Definition: coo_matrix.cpp:479
virtual int GetNumColsLocal() const
Get the local number of columns of the matrix.
Definition: coo_matrix.cpp:261
int PushBack(int row, int col, T v)
Insert value to the COO matrix.
Definition: coo_matrix.cpp:190
The class of sequential real/complex vector.
Definition: structs.hpp:12
Class of COO matrices. Note that most coo matrix functions are not yet on the device.
Definition: coo_matrix.hpp:24
CooMatrixClass< T > & operator=(const CooMatrixClass< T > &mat)
The = operator of CooMatrixClass.
Definition: coo_matrix.cpp:72
virtual ~CooMatrixClass()
The destructor of CooMatrixClass.
Definition: coo_matrix.cpp:111
virtual int Eye()
Create an indentity matrix.
Definition: coo_matrix.cpp:407
The virtual matrix classes.
int * GetJ() const
Get the J pointer of the matrix.
Definition: coo_matrix.cpp:323
The template class complex.
Definition: complex.hpp:24
virtual int Clear()
Free the current matrix.
Definition: coo_matrix.cpp:121
The virtual class of all matrix classes.
Definition: matrix.hpp:23
virtual int Fill(const T &v)
Fill the matrix pattern with constant value.
Definition: coo_matrix.cpp:452
int SetNumNonzeros()
Set the number of nonzeros in this matrix.
Definition: coo_matrix.cpp:281
virtual int GetDataLocation() const
Get the data location of the matrix.
Definition: coo_matrix.cpp:228
int SetNumCols(int cols)
Set the number of cols in this matrix.
Definition: coo_matrix.cpp:299
IntVectorClass< int > & GetIVector()
Get the reference to the I vector.
Definition: coo_matrix.cpp:343
virtual int GetNumRowsLocal() const
Get the local number of rows of the matrix.
Definition: coo_matrix.cpp:246
Tell if a value is a complex value.
Definition: complex.hpp:684
int PlotPatternGnuPlot(const char *datafilename, int *rperm, int *cperm, int conditiona, int conditionb)
Plot the pattern of the csr matrix using gnuplot. Similar to spy in the MATLAB. Function for testing ...
Definition: coo_matrix.cpp:785
Class of CSR/CSC matrices.
Definition: structs.hpp:16
int ReadFromMMFile(const char *matfile, int idxin)
Read matrix on the host memory, matrix market format.
Definition: coo_matrix.cpp:775
virtual int Scale(const T &alpha)
Scale the matrix.
Definition: coo_matrix.cpp:466
int Helmholtz(int n, T w)
Generate 3D Helmholtz matrix with 7-pt on [0,1]^3. -\Delta u - w^2 u = f.
Definition: coo_matrix.cpp:647