Escript
Revision_4320
Main Page
Namespaces
Classes
Files
File List
File Members
paso
src
SparseMatrix.h
Go to the documentation of this file.
1
2
/*****************************************************************************
3
*
4
* Copyright (c) 2003-2013 by University of Queensland
5
* http://www.uq.edu.au
6
*
7
* Primary Business: Queensland, Australia
8
* Licensed under the Open Software License version 3.0
9
* http://www.opensource.org/licenses/osl-3.0.php
10
*
11
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12
* Development since 2012 by School of Earth Sciences
13
*
14
*****************************************************************************/
15
16
17
/************************************************************************************/
18
19
/* Paso: SparseMatrix and SystemVector */
20
21
/************************************************************************************/
22
23
/* Author: lgross@uq.edu.au */
24
25
/************************************************************************************/
26
27
#ifndef INC_PASO_SPARSEMATRIX
28
#define INC_PASO_SPARSEMATRIX
29
30
#include "
Common.h
"
31
#include "
Pattern.h
"
32
#include "
Options.h
"
33
#include "
Paso.h
"
34
35
/************************************************************************************/
36
37
/* this struct holds a stiffness matrix: */
38
39
40
typedef
int
Paso_SparseMatrixType
;
41
42
typedef
struct
Paso_SparseMatrix
{
43
Paso_SparseMatrixType
type
;
44
dim_t
reference_counter
;
45
46
dim_t
row_block_size
;
47
dim_t
col_block_size
;
48
dim_t
block_size
;
49
50
dim_t
numRows
;
51
dim_t
numCols
;
52
Paso_Pattern
*
pattern
;
53
dim_t
len
;
54
55
double
*
val
;
/* this is used for classical CSR or CSC */
56
57
index_t
solver_package
;
/* package controlling the solver pointer */
58
void
*
solver_p
;
/* pointer to data needed by a solver */
59
60
}
Paso_SparseMatrix
;
61
62
/* interfaces: */
63
64
Paso_SparseMatrix
*
Paso_SparseMatrix_alloc
(
Paso_SparseMatrixType
,
Paso_Pattern
*,
dim_t
,
dim_t
,
const
bool_t
);
65
Paso_SparseMatrix
*
Paso_SparseMatrix_getReference
(
Paso_SparseMatrix
*);
66
dim_t
Paso_SparseMatrix_getNumColors
(
Paso_SparseMatrix
*);
67
void
Paso_SparseMatrix_applyDiagonal_CSR_OFFSET0
(
Paso_SparseMatrix
* A,
const
double
* left,
const
double
* right);
68
index_t
*
Paso_SparseMatrix_borrowColoringPointer
(
Paso_SparseMatrix
*);
69
void
Paso_SparseMatrix_free
(
Paso_SparseMatrix
*);
70
void
Paso_SparseMatrix_MatrixVector_CSC_OFFSET0
(
const
double
alpha,
const
Paso_SparseMatrix
* A,
const
double
* in,
const
double
beta,
double
* out);
71
void
Paso_SparseMatrix_MatrixVector_CSC_OFFSET1
(
const
double
alpha,
const
Paso_SparseMatrix
* A,
const
double
* in,
const
double
beta,
double
* out);
72
void
Paso_SparseMatrix_MatrixVector_CSR_OFFSET0
(
const
double
alpha,
const
Paso_SparseMatrix
* A,
const
double
* in,
const
double
beta,
double
* out);
73
void
Paso_SparseMatrix_MatrixVector_CSR_OFFSET1
(
const
double
alpha,
const
Paso_SparseMatrix
* A,
const
double
* in,
const
double
beta,
double
* out);
74
void
Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG
(
const
double
alpha,
const
Paso_SparseMatrix
* A,
const
double
* in,
const
double
beta,
double
* out);
75
76
void
Paso_SparseMatrix_copy
(
Paso_SparseMatrix
*,
double
*);
77
void
Paso_SparseMatrix_maxAbsRow_CSR_OFFSET0
(
const
Paso_SparseMatrix
*,
double
*);
78
void
Paso_SparseMatrix_addAbsRow_CSR_OFFSET0
(
const
Paso_SparseMatrix
*,
double
*);
79
void
Paso_SparseMatrix_addRow_CSR_OFFSET0
(
Paso_SparseMatrix
*,
double
*);
80
void
Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1
(
Paso_SparseMatrix
* A,
double
* mask_row,
double
* mask_col,
double
main_diagonal_value);
81
void
Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1
(
Paso_SparseMatrix
* A,
double
* mask_row,
double
* mask_col,
double
main_diagonal_value);
82
void
Paso_SparseMatrix_nullifyRowsAndCols_CSC
(
Paso_SparseMatrix
* A,
double
* mask_row,
double
* mask_col,
double
main_diagonal_value);
83
void
Paso_SparseMatrix_nullifyRowsAndCols_CSR
(
Paso_SparseMatrix
* A,
double
* mask_row,
double
* mask_col,
double
main_diagonal_value);
84
void
Paso_SparseMatrix_nullifyRows_CSR_BLK1
(
Paso_SparseMatrix
* A,
double
* mask_row,
double
main_diagonal_value);
85
void
Paso_SparseMatrix_saveHB_CSC
(
Paso_SparseMatrix
*, FILE*);
86
Paso_SparseMatrix
*
Paso_SparseMatrix_getSubmatrix
(
Paso_SparseMatrix
* A,
dim_t
,
dim_t
,
index_t
*,
index_t
*);
87
Paso_SparseMatrix
*
Paso_SparseMatrix_getBlock
(
Paso_SparseMatrix
* A,
int
blockid);
88
Paso_SparseMatrix
*
Paso_SparseMatrix_MatrixMatrix
(
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B);
89
void
Paso_SparseMatrix_MatrixMatrix_DD
(
Paso_SparseMatrix
*C,
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B);
90
void
Paso_SparseMatrix_MatrixMatrix_DB
(
Paso_SparseMatrix
*C,
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B);
91
void
Paso_SparseMatrix_MatrixMatrix_BD
(
Paso_SparseMatrix
*C,
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B);
92
void
Paso_SparseMatrix_MatrixMatrix_BB
(
Paso_SparseMatrix
*C,
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B);
93
94
Paso_SparseMatrix
*
Paso_SparseMatrix_MatrixMatrixTranspose
(
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B,
const
Paso_SparseMatrix
* T);
95
void
Paso_SparseMatrix_MatrixMatrixTranspose_DD
(
Paso_SparseMatrix
*C,
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B,
const
Paso_SparseMatrix
* T);
96
void
Paso_SparseMatrix_MatrixMatrixTranspose_DB
(
Paso_SparseMatrix
*C,
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B,
const
Paso_SparseMatrix
* T);
97
void
Paso_SparseMatrix_MatrixMatrixTranspose_BD
(
Paso_SparseMatrix
*C,
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B,
const
Paso_SparseMatrix
* T);
98
void
Paso_SparseMatrix_MatrixMatrixTranspose_BB
(
Paso_SparseMatrix
*C,
const
Paso_SparseMatrix
* A,
const
Paso_SparseMatrix
* B,
const
Paso_SparseMatrix
* T);
99
100
Paso_SparseMatrix
*
Paso_SparseMatrix_unroll
(
const
Paso_SparseMatrixType
type,
const
Paso_SparseMatrix
* A);
101
Paso_SparseMatrix
*
Paso_SparseMatrix_getTranspose
(
Paso_SparseMatrix
* P);
102
103
void
Paso_SparseMatrix_setValues
(
Paso_SparseMatrix
*,
double
);
104
void
Paso_SparseMatrix_saveMM_CSC
(
Paso_SparseMatrix
*, FILE *);
105
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);
106
Paso_SparseMatrix
*
Paso_SparseMatrix_loadMM_toCSR
(
char
*fileName_p );
107
void
Paso_SparseMatrix_saveMM
(
Paso_SparseMatrix
* A_p,
char
* fileName_p);
108
void
Paso_SparseMatrix_nullifyRows_CSR
(
Paso_SparseMatrix
*,
double
*,
double
);
109
index_t
*
Paso_SparseMatrix_borrowMainDiagonalPointer
(
Paso_SparseMatrix
* A_p);
110
void
Paso_SparseMatrix_copyFromMainDiagonal
(
Paso_SparseMatrix
* A_p,
double
* out);
111
void
Paso_SparseMatrix_copyToMainDiagonal
(
Paso_SparseMatrix
* A_p,
const
double
* in);
112
void
Paso_SparseMatrix_copyBlockFromMainDiagonal
(
Paso_SparseMatrix
* A_p,
double
* out);
113
void
Paso_SparseMatrix_copyBlockToMainDiagonal
(
Paso_SparseMatrix
* A_p,
const
double
* in);
114
void
Paso_SparseMatrix_applyBlockMatrix
(
Paso_SparseMatrix
* A_p,
double
* block_diag,
int
* pivot,
double
*x,
double
*b);
115
void
Paso_SparseMatrix_invMain
(
Paso_SparseMatrix
* A_p,
double
* inv_diag,
int
* pivot);
116
dim_t
Paso_SparseMatrix_maxDeg
(
Paso_SparseMatrix
* A_p);
117
dim_t
Paso_SparseMatrix_getTotalNumRows
(
const
Paso_SparseMatrix
* A);
118
dim_t
Paso_SparseMatrix_getTotalNumCols
(
const
Paso_SparseMatrix
*A);
119
dim_t
Paso_SparseMatrix_getNumRows
(
const
Paso_SparseMatrix
*A);
120
dim_t
Paso_SparseMatrix_getNumCols
(
const
Paso_SparseMatrix
*A);
121
double
Paso_SparseMatrix_getSize
(
const
Paso_SparseMatrix
*A);
122
double
Paso_SparseMatrix_getSparsity
(
const
Paso_SparseMatrix
*A);
123
124
125
#endif
/* #ifndef INC_PASO_SPARSEMATRIX */
126
Generated on Fri Mar 15 2013 14:07:51 for Escript by
1.8.1.2