00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef INC_PASO_SPARSEMATRIX
00026 #define INC_PASO_SPARSEMATRIX
00027
00028 #include "Common.h"
00029 #include "Pattern.h"
00030 #include "Options.h"
00031 #include "Paso.h"
00032
00033
00034
00035
00036
00037 #define MATRIX_FORMAT_DEFAULT 0
00038 #define MATRIX_FORMAT_CSC 1
00039 #define MATRIX_FORMAT_SYM 2
00040 #define MATRIX_FORMAT_BLK1 4
00041 #define MATRIX_FORMAT_OFFSET1 8
00042 #define MATRIX_FORMAT_TRILINOS_CRS 16
00043
00044 typedef int Paso_SparseMatrixType;
00045
00046 typedef struct Paso_SparseMatrix {
00047 Paso_SparseMatrixType type;
00048 dim_t reference_counter;
00049
00050 dim_t row_block_size;
00051 dim_t col_block_size;
00052 dim_t block_size;
00053
00054 dim_t numRows;
00055 dim_t numCols;
00056 Paso_Pattern* pattern;
00057 dim_t len;
00058 double *val;
00059 void* solver;
00060 } Paso_SparseMatrix;
00061
00062
00063
00064 Paso_SparseMatrix* Paso_SparseMatrix_alloc(Paso_SparseMatrixType,Paso_Pattern*,dim_t,dim_t,const bool_t);
00065 Paso_SparseMatrix* Paso_SparseMatrix_getReference(Paso_SparseMatrix*);
00066 void Paso_SparseMatrix_free(Paso_SparseMatrix*);
00067 void Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
00068 void Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
00069 void Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
00070 void Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(const double alpha, const Paso_SparseMatrix* A, const double* in, const double beta, double* out);
00071 void Paso_SparseMatrix_copy(Paso_SparseMatrix*,double*);
00072 void Paso_SparseMatrix_addAbsRow_CSR_OFFSET0(Paso_SparseMatrix*,double*);
00073 void Paso_SparseMatrix_addRow_CSR_OFFSET0(Paso_SparseMatrix*,double*);
00074 void Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
00075 void Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
00076 void Paso_SparseMatrix_nullifyRowsAndCols_CSC(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
00077 void Paso_SparseMatrix_nullifyRowsAndCols_CSR(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
00078 void Paso_SparseMatrix_nullifyRows_CSR_BLK1(Paso_SparseMatrix* A, double* mask_row, double main_diagonal_value);
00079 void Paso_SparseMatrix_saveHB_CSC(Paso_SparseMatrix *, FILE*);
00080 Paso_SparseMatrix* Paso_SparseMatrix_getSubmatrix(Paso_SparseMatrix* A,dim_t,dim_t,index_t*,index_t*);
00081 void Paso_SparseMatrix_setValues(Paso_SparseMatrix*,double);
00082 void Paso_SparseMatrix_saveMM_CSC(Paso_SparseMatrix *, FILE *);
00083 void Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_stripe(const double alpha, const dim_t nRows, const dim_t row_block_size, const dim_t col_block_size, const index_t* ptr, const index_t* index, const double* val, const double* in, const double beta, double* out);
00084 Paso_SparseMatrix* Paso_SparseMatrix_loadMM_toCSR( char *fileName_p );
00085 void Paso_SparseMatrix_saveMM(Paso_SparseMatrix * A_p, char * fileName_p);
00086
00087
00088
00089
00090
00091
00092 #endif
00093