9 #ifndef _fei_MatrixTraits_FillableMat_hpp_
10 #define _fei_MatrixTraits_FillableMat_hpp_
15 #include <fei_CSRMat.hpp>
16 #include <fei_CSVec.hpp>
17 #include <fei_Vector_Impl.hpp>
23 struct MatrixTraits<FillableMat> {
27 {
return(
"FillableMat"); }
29 static double* getBeginPointer(FillableMat* )
34 static int getOffset(FillableMat* ,
int ,
int )
41 static int setValues(FillableMat* mat,
double scalar)
43 mat->setValues(scalar);
52 numRows = mat->getNumRows();
58 static int getRowLength(FillableMat* mat,
int row,
int& length)
61 const CSVec* matrixrow = mat->getRow(row);
62 length = matrixrow->size();
83 int row,
int len,
double* coefs,
int* indices)
86 const CSVec* matrixrow = mat->getRow(row);
88 const std::vector<int>& row_indices = matrixrow->indices();
89 const std::vector<double>& row_coefs = matrixrow->coefs();
90 const int rowlen = row_indices.size();
91 for(
int i=0; i<rowlen; ++i) {
93 coefs[i] = row_coefs[i];
94 indices[i] = row_indices[i];
107 int numRows,
const int* rows,
108 int numCols,
const int* cols,
109 const double*
const* values,
112 if (numCols < 1 || numRows < 1)
return(0);
114 for(
int i=0; i<numRows; ++i) {
115 mat->sumInRow(rows[i], cols, values[i], numCols);
119 for(
int i=0; i<numRows; ++i) {
120 mat->putRow(rows[i], cols, values[i], numCols);
137 static int matvec(FillableMat* mat,
146 if (fvx == NULL || fvy == NULL) {
162 #endif // _fei_MatrixTraits_FillableMat_hpp_
static const char * typeName()
static int matvec(T *A, fei::Vector *x, fei::Vector *y)
static int getRowLength(T *mat, int row, int &length)
static int getNumLocalRows(T *mat, int &numRows)
T * getUnderlyingVector()
void multiply_CSRMat_CSVec(const CSRMat &A, const CSVec &x, CSVec &y)
static int setValues(T *mat, double scalar)
static int copyOutRow(T *mat, int row, int len, double *coefs, int *indices)
static int putValuesIn(T *mat, int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sum_into)
static int globalAssemble(T *A)