1 |
|
2 |
/* $Id: SparseMatrix.h 1306 2007-09-18 05:51:09Z ksteube $ */ |
3 |
|
4 |
/******************************************************* |
5 |
* |
6 |
* Copyright 2003-2007 by ACceSS MNRF |
7 |
* Copyright 2007 by University of Queensland |
8 |
* |
9 |
* http://esscc.uq.edu.au |
10 |
* Primary Business: Queensland, Australia |
11 |
* Licensed under the Open Software License version 3.0 |
12 |
* http://www.opensource.org/licenses/osl-3.0.php |
13 |
* |
14 |
*******************************************************/ |
15 |
|
16 |
/**************************************************************/ |
17 |
|
18 |
/* Paso: SparseMatrix and SystemVector */ |
19 |
|
20 |
/**************************************************************/ |
21 |
|
22 |
/* Author: gross@access.edu.au */ |
23 |
|
24 |
/**************************************************************/ |
25 |
|
26 |
#ifndef INC_PASO_SPARSEMATRIX |
27 |
#define INC_PASO_SPARSEMATRIX |
28 |
|
29 |
#include "Common.h" |
30 |
#include "Pattern.h" |
31 |
#include "Options.h" |
32 |
#include "Paso.h" |
33 |
|
34 |
/**************************************************************/ |
35 |
|
36 |
/* this struct holds a stiffness matrix: */ |
37 |
|
38 |
#define MATRIX_FORMAT_DEFAULT 0 |
39 |
#define MATRIX_FORMAT_CSC 1 |
40 |
#define MATRIX_FORMAT_SYM 2 |
41 |
#define MATRIX_FORMAT_BLK1 4 |
42 |
#define MATRIX_FORMAT_OFFSET1 8 |
43 |
#define MATRIX_FORMAT_TRILINOS_CRS 16 |
44 |
|
45 |
typedef int Paso_SparseMatrixType; |
46 |
|
47 |
typedef struct Paso_SparseMatrix { |
48 |
Paso_SparseMatrixType type; |
49 |
dim_t reference_counter; |
50 |
|
51 |
dim_t row_block_size; |
52 |
dim_t col_block_size; |
53 |
dim_t block_size; |
54 |
|
55 |
dim_t numRows; |
56 |
dim_t numCols; |
57 |
Paso_Pattern* pattern; |
58 |
dim_t len; |
59 |
double *val; /* this is used for classical CSR or CSC */ |
60 |
} Paso_SparseMatrix; |
61 |
|
62 |
/* interfaces: */ |
63 |
|
64 |
Paso_SparseMatrix* Paso_SparseMatrix_alloc(Paso_SparseMatrixType,Paso_Pattern*,dim_t,dim_t); |
65 |
Paso_SparseMatrix* Paso_SparseMatrix_getReference(Paso_SparseMatrix*); |
66 |
void Paso_SparseMatrix_free(Paso_SparseMatrix*); |
67 |
void Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(double alpha, Paso_SparseMatrix* A, double* in, double beta, double* out); |
68 |
void Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(double alpha, Paso_SparseMatrix* A, double* in, double beta, double* out); |
69 |
void Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(double alpha, Paso_SparseMatrix* A, double* in, double beta, double* out); |
70 |
void Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(double alpha, Paso_SparseMatrix* A, double* in, double beta, double* out); |
71 |
void Paso_SparseMatrix_copy(Paso_SparseMatrix*,double*); |
72 |
void Paso_SparseMatrix_addAbsRow_CSR_OFFSET0(Paso_SparseMatrix*,double*); |
73 |
void Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value); |
74 |
void Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value); |
75 |
void Paso_SparseMatrix_nullifyRowsAndCols_CSC(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value); |
76 |
void Paso_SparseMatrix_nullifyRowsAndCols_CSR(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value); |
77 |
void Paso_SparseMatrix_saveHB_CSC(Paso_SparseMatrix *, FILE*); |
78 |
Paso_SparseMatrix* Paso_SparseMatrix_getSubmatrix(Paso_SparseMatrix* A,dim_t,dim_t,index_t*,index_t*); |
79 |
void Paso_SparseMatrix_setValues(Paso_SparseMatrix*,double); |
80 |
void Paso_SparseMatrix_saveMM_CSC(Paso_SparseMatrix *, FILE *); |
81 |
/* |
82 |
void Paso_SparseMatrix_add(Paso_SparseMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*); |
83 |
Paso_SparseMatrix* Paso_SparseMatrix_loadMM_toCSR(char *); |
84 |
*/ |
85 |
|
86 |
#endif /* #ifndef INC_PASO_SPARSEMATRIX */ |
87 |
|