Fast Auxiliary Space Preconditioning  1.8.4 Feb/15/2016
sparse_bsr.c File Reference

Sparse matrix operations for dBSRmat matrices. More...

#include <math.h>
#include "fasp.h"
#include "fasp_functs.h"

Go to the source code of this file.

Functions

dBSRmat fasp_dbsr_create (const INT ROW, const INT COL, const INT NNZ, const INT nb, const INT storage_manner)
 Create BSR sparse matrix data memory space. More...
 
void fasp_dbsr_alloc (const INT ROW, const INT COL, const INT NNZ, const INT nb, const INT storage_manner, dBSRmat *A)
 Allocate memory space for BSR format sparse matrix. More...
 
void fasp_dbsr_free (dBSRmat *A)
 Free memory space for BSR format sparse matrix. More...
 
void fasp_dbsr_null (dBSRmat *A)
 Initialize sparse matrix on structured grid. More...
 
void fasp_dbsr_cp (dBSRmat *A, dBSRmat *B)
 copy a dCSRmat to a new one B=A More...
 
INT fasp_dbsr_trans (dBSRmat *A, dBSRmat *AT)
 Find A^T from given dBSRmat matrix A. More...
 
SHORT fasp_dbsr_diagpref (dBSRmat *A)
 Reorder the column and data arrays of a square BSR matrix, so that the first entry in each row is the diagonal one. More...
 
dvector fasp_dbsr_getdiaginv (dBSRmat *A)
 Get D^{-1} of matrix A. More...
 
dBSRmat fasp_dbsr_diaginv (dBSRmat *A)
 Compute B := D^{-1}*A, where 'D' is the block diagonal part of A. More...
 
dBSRmat fasp_dbsr_diaginv2 (dBSRmat *A, REAL *diaginv)
 Compute B := D^{-1}*A, where 'D' is the block diagonal part of A. More...
 
dBSRmat fasp_dbsr_diaginv3 (dBSRmat *A, REAL *diaginv)
 Compute B := D^{-1}*A, where 'D' is the block diagonal part of A. More...
 
dBSRmat fasp_dbsr_diaginv4 (dBSRmat *A, REAL *diaginv)
 Compute B := D^{-1}*A, where 'D' is the block diagonal part of A. More...
 
void fasp_dbsr_getdiag (INT n, dBSRmat *A, REAL *diag)
 Abstract the diagonal blocks of a BSR matrix. More...
 
dBSRmat fasp_dbsr_diagLU (dBSRmat *A, REAL *DL, REAL *DU)
 Compute B := DL*A*DU. We decompose each diagonal block of A into LDU form and DL = diag(L^{-1}) and DU = diag(U^{-1}). More...
 
dBSRmat fasp_dbsr_diagLU2 (dBSRmat *A, REAL *DL, REAL *DU)
 Compute B := DL*A*DU. We decompose each diagonal block of A into LDU form and DL = diag(L^{-1}) and DU = diag(U^{-1}). More...
 

Detailed Description

Sparse matrix operations for dBSRmat matrices.

Definition in file sparse_bsr.c.

Function Documentation

void fasp_dbsr_alloc ( const INT  ROW,
const INT  COL,
const INT  NNZ,
const INT  nb,
const INT  storage_manner,
dBSRmat A 
)

Allocate memory space for BSR format sparse matrix.

Parameters
ROWNumber of rows of block
COLNumber of columns of block
NNZNumber of nonzero blocks
nbDimension of each block
storage_mannerStorage manner for each sub-block
APointer to new dBSRmat matrix
Author
Xiaozhe Hu
Date
10/26/2010

Definition at line 87 of file sparse_bsr.c.

void fasp_dbsr_cp ( dBSRmat A,
dBSRmat B 
)

copy a dCSRmat to a new one B=A

Parameters
APointer to the dBSRmat matrix
BPointer to the dBSRmat matrix
Author
Xiaozhe Hu
Date
08/07/2011

Definition at line 181 of file sparse_bsr.c.

dBSRmat fasp_dbsr_create ( const INT  ROW,
const INT  COL,
const INT  NNZ,
const INT  nb,
const INT  storage_manner 
)

Create BSR sparse matrix data memory space.

Parameters
ROWNumber of rows of block
COLNumber of columns of block
NNZNumber of nonzero blocks
nbDimension of each block
storage_mannerStorage manner for each sub-block
Returns
A The new dBSRmat matrix
Author
Xiaozhe Hu
Date
10/26/2010

Definition at line 36 of file sparse_bsr.c.

dBSRmat fasp_dbsr_diaginv ( dBSRmat A)

Compute B := D^{-1}*A, where 'D' is the block diagonal part of A.

Parameters
APointer to the dBSRmat matrix
Author
Zhiyang Zhou
Date
2010/10/26
Note
Works for general nb (Xiaozhe)

Modified by Chunsheng Feng, Zheng Li on 08/25/2012

Definition at line 496 of file sparse_bsr.c.

dBSRmat fasp_dbsr_diaginv2 ( dBSRmat A,
REAL diaginv 
)

Compute B := D^{-1}*A, where 'D' is the block diagonal part of A.

Parameters
APointer to the dBSRmat matrix
diaginvPointer to the inverses of all the diagonal blocks
Author
Zhiyang Zhou
Date
2010/11/07
Note
Works for general nb (Xiaozhe)

Modified by Chunsheng Feng, Zheng Li on 08/25/2012

Definition at line 660 of file sparse_bsr.c.

dBSRmat fasp_dbsr_diaginv3 ( dBSRmat A,
REAL diaginv 
)

Compute B := D^{-1}*A, where 'D' is the block diagonal part of A.

Parameters
APointer to the dBSRmat matrix
diaginvPointer to the inverses of all the diagonal blocks
Returns
BSR matrix after diagonal scaling
Author
Xiaozhe Hu
Date
12/25/2010
Note
Works for general nb (Xiaozhe)

Modified by Xiaozhe Hu on 05/26/2012

Definition at line 762 of file sparse_bsr.c.

dBSRmat fasp_dbsr_diaginv4 ( dBSRmat A,
REAL diaginv 
)

Compute B := D^{-1}*A, where 'D' is the block diagonal part of A.

Parameters
APointer to the dBSRmat matrix
diaginvPointer to the inverses of all the diagonal blocks
Returns
BSR matrix after diagonal scaling
Note
Works for general nb (Xiaozhe)
A is pre-ordered that the first block of each row is the diagonal block!
Author
Xiaozhe Hu
Date
03/12/2011

Modified by Chunsheng Feng, Zheng Li on 08/26/2012

Definition at line 1120 of file sparse_bsr.c.

dBSRmat fasp_dbsr_diagLU ( dBSRmat A,
REAL DL,
REAL DU 
)

Compute B := DL*A*DU. We decompose each diagonal block of A into LDU form and DL = diag(L^{-1}) and DU = diag(U^{-1}).

Parameters
APointer to the dBSRmat matrix
DLPointer to the diag(L^{-1})
DUPointer to the diag(U^{-1})
Returns
BSR matrix after scaling
Author
Xiaozhe Hu
Date
04/02/2014

Definition at line 1449 of file sparse_bsr.c.

dBSRmat fasp_dbsr_diagLU2 ( dBSRmat A,
REAL DL,
REAL DU 
)

Compute B := DL*A*DU. We decompose each diagonal block of A into LDU form and DL = diag(L^{-1}) and DU = diag(U^{-1}).

Parameters
APointer to the dBSRmat matrix
DLPointer to the diag(L^{-1})
DUPointer to the diag(U^{-1})
Returns
BSR matrix after scaling
Author
Zheng Li, Xiaozhe Hu
Date
06/17/2014

Definition at line 1677 of file sparse_bsr.c.

SHORT fasp_dbsr_diagpref ( dBSRmat A)

Reorder the column and data arrays of a square BSR matrix, so that the first entry in each row is the diagonal one.

Parameters
APointer to the BSR matrix
Author
Xiaozhe Hu
Date
03/10/2011
Author
Chunsheng Feng, Zheng Li
Date
09/02/2012
Note
Reordering is done in place.

Definition at line 292 of file sparse_bsr.c.

void fasp_dbsr_free ( dBSRmat A)

Free memory space for BSR format sparse matrix.

Parameters
APointer to the dBSRmat matrix
Author
Xiaozhe Hu
Date
10/26/2010

Definition at line 133 of file sparse_bsr.c.

fasp_dbsr_getdiag ( INT  n,
dBSRmat A,
REAL diag 
)

Abstract the diagonal blocks of a BSR matrix.

Parameters
nNumber of blocks to get
APointer to the 'dBSRmat' type matrix
diagPointer to array which stores the diagonal blocks in row by row manner
Author
Zhiyang Zhou
Date
2010/10/26
Note
Works for general nb (Xiaozhe)

Modified by Chunsheng Feng, Zheng Li on 08/25/2012

Definition at line 1411 of file sparse_bsr.c.

dvector fasp_dbsr_getdiaginv ( dBSRmat A)

Get D^{-1} of matrix A.

Parameters
APointer to the dBSRmat matrix
Author
Xiaozhe Hu
Date
02/19/2013
Note
Works for general nb (Xiaozhe)

Definition at line 392 of file sparse_bsr.c.

void fasp_dbsr_null ( dBSRmat A)

Initialize sparse matrix on structured grid.

Parameters
APointer to the dBSRmat matrix
Author
Xiaozhe Hu
Date
10/26/2010

Definition at line 158 of file sparse_bsr.c.

INT fasp_dbsr_trans ( dBSRmat A,
dBSRmat AT 
)

Find A^T from given dBSRmat matrix A.

Parameters
APointer to the dBSRmat matrix
ATPointer to the transpose of dBSRmat matrix A
Author
Chunsheng FENG
Date
2011/06/08

Modified by Xiaozhe Hu (08/06/2011)

Definition at line 208 of file sparse_bsr.c.