Fast Auxiliary Space Preconditioning 2.7.7 Aug/28/2022
Loading...
Searching...
No Matches
BlaSparseBSR.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_cp (const dBSRmat *A, dBSRmat *B)
 copy a dCSRmat to a new one B=A More...
 
SHORT fasp_dbsr_compress_inplace (dBSRmat *A, const REAL dtol)
 Compress a BSR matrix A IN PLACE by dropping small entries max(|Aij|) <= dtol. More...
 
INT fasp_dbsr_trans (const dBSRmat *A, dBSRmat *AT)
 Find A^T from given dBSRmat matrix A. More...
 
SHORT fasp_dbsr_getblk (const dBSRmat *A, const INT *Is, const INT *Js, const INT m, const INT n, dBSRmat *B)
 Get a sub BSR matrix of A with specified rows and columns. 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 (const dBSRmat *A)
 Get D^{-1} of matrix A. More...
 
dBSRmat fasp_dbsr_diaginv (const dBSRmat *A)
 Compute B := D^{-1}*A, where 'D' is the block diagonal part of A. More...
 
dBSRmat fasp_dbsr_diaginv2 (const dBSRmat *A, REAL *diaginv)
 Compute B := D^{-1}*A, where 'D' is the block diagonal part of A. More...
 
dBSRmat fasp_dbsr_diaginv3 (const dBSRmat *A, REAL *diaginv)
 Compute B := D^{-1}*A, where 'D' is the block diagonal part of A. More...
 
dBSRmat fasp_dbsr_diaginv4 (const 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, const dBSRmat *A, REAL *diag)
 Abstract the diagonal blocks of a BSR matrix. More...
 
dBSRmat fasp_dbsr_diagLU (const 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...
 
dBSRmat fasp_dbsr_perm (const dBSRmat *A, const INT *P)
 Apply permutation of A, i.e. Aperm=PAP' by the orders given in P. More...
 
INT fasp_dbsr_merge_col (dBSRmat *A)
 Check and merge some same col index in one row. More...
 
void dBSRmat_Multicoloring_Theta (dBSRmat *A, REAL theta, INT *rowmax, INT *groups, INT **ic_out, INT **icmap_out)
 

Detailed Description

Sparse matrix operations for dBSRmat matrices.

Note
This file contains Level-1 (Bla) functions. It requires: AuxArray.c, AuxMemory.c, AuxThreads.c, BlaSmallMat.c, and BlaSmallMatInv.c

Copyright (C) 2009–Present by the FASP team. All rights reserved.

Released under the terms of the GNU Lesser General Public License 3.0 or later.

Definition in file BlaSparseBSR.c.

Function Documentation

◆ dBSRmat_Multicoloring_Theta()

void dBSRmat_Multicoloring_Theta ( dBSRmat A,
REAL  theta,
INT rowmax,
INT groups,
INT **  ic_out,
INT **  icmap_out 
)

Definition at line 2337 of file BlaSparseBSR.c.

◆ fasp_dbsr_alloc()

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 96 of file BlaSparseBSR.c.

◆ fasp_dbsr_compress_inplace()

SHORT fasp_dbsr_compress_inplace ( dBSRmat A,
const REAL  dtol 
)

Compress a BSR matrix A IN PLACE by dropping small entries max(|Aij|) <= dtol.

Parameters
APointer to dBSRmat BSR matrix
dtolDrop tolerance
Author
Li Zhao
Date
05/21/2023
Note
This routine can be modified for filtering.

Definition at line 197 of file BlaSparseBSR.c.

◆ fasp_dbsr_cp()

void fasp_dbsr_cp ( const 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 169 of file BlaSparseBSR.c.

◆ fasp_dbsr_create()

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 48 of file BlaSparseBSR.c.

◆ fasp_dbsr_diaginv()

dBSRmat fasp_dbsr_diaginv ( const 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 Modified by Chensong Zhang on 09/27/2017

Definition at line 645 of file BlaSparseBSR.c.

◆ fasp_dbsr_diaginv2()

dBSRmat fasp_dbsr_diaginv2 ( const 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 803 of file BlaSparseBSR.c.

◆ fasp_dbsr_diaginv3()

dBSRmat fasp_dbsr_diaginv3 ( const 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 911 of file BlaSparseBSR.c.

◆ fasp_dbsr_diaginv4()

dBSRmat fasp_dbsr_diaginv4 ( const 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 1335 of file BlaSparseBSR.c.

◆ fasp_dbsr_diagLU()

dBSRmat fasp_dbsr_diagLU ( const 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 1677 of file BlaSparseBSR.c.

◆ fasp_dbsr_diagLU2()

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 1905 of file BlaSparseBSR.c.

◆ fasp_dbsr_diagpref()

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 435 of file BlaSparseBSR.c.

◆ fasp_dbsr_free()

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 140 of file BlaSparseBSR.c.

◆ fasp_dbsr_getblk()

SHORT fasp_dbsr_getblk ( const dBSRmat A,
const INT Is,
const INT Js,
const INT  m,
const INT  n,
dBSRmat B 
)

Get a sub BSR matrix of A with specified rows and columns.

Parameters
APointer to dBSRmat BSR matrix
BPointer to dBSRmat BSR matrix
IsPointer to selected rows
JsPointer to selected columns
mNumber of selected rows
nNumber of selected columns
Returns
FASP_SUCCESS if succeeded, otherwise return error information.
Author
Shiquan Zhang, Xiaozhe Hu
Date
12/25/2010

Modified by Chunsheng Feng, Xiaoqiang Yue on 05/23/2012

Definition at line 332 of file BlaSparseBSR.c.

◆ fasp_dbsr_getdiag()

void fasp_dbsr_getdiag ( INT  n,
const 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 1641 of file BlaSparseBSR.c.

◆ fasp_dbsr_getdiaginv()

dvector fasp_dbsr_getdiaginv ( const 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 543 of file BlaSparseBSR.c.

◆ fasp_dbsr_merge_col()

INT fasp_dbsr_merge_col ( dBSRmat A)

Check and merge some same col index in one row.

Parameters
APointer to the original dBSRmat matrix
Returns
The new merged dCSRmat matrix
Author
Chunsheng Feng
Date
30/07/2017

Definition at line 2223 of file BlaSparseBSR.c.

◆ fasp_dbsr_perm()

dBSRmat fasp_dbsr_perm ( const dBSRmat A,
const INT P 
)

Apply permutation of A, i.e. Aperm=PAP' by the orders given in P.

Parameters
APointer to the original dBSRmat matrix
PPointer to the given ordering
Returns
The new ordered dBSRmat matrix if succeed, NULL if fail
Author
Zheng Li
Date
24/9/2015
Note
P[i] = k means k-th row and column become i-th row and column!

Definition at line 2106 of file BlaSparseBSR.c.

◆ fasp_dbsr_trans()

INT fasp_dbsr_trans ( const 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 246 of file BlaSparseBSR.c.