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

BLAS2 operations for dCSRmat matrices. More...

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

Go to the source code of this file.

Functions

INT fasp_blas_dcsr_add (dCSRmat *A, const REAL alpha, dCSRmat *B, const REAL beta, dCSRmat *C)
 compute C = alpha*A + beta*B in CSR format More...
 
void fasp_blas_dcsr_axm (dCSRmat *A, const REAL alpha)
 Multiply a sparse matrix A in CSR format by a scalar alpha. More...
 
void fasp_blas_dcsr_mxv (dCSRmat *A, REAL *x, REAL *y)
 Matrix-vector multiplication y = A*x. More...
 
void fasp_blas_dcsr_mxv_agg (dCSRmat *A, REAL *x, REAL *y)
 Matrix-vector multiplication y = A*x, where the entries of A are all ones. More...
 
void fasp_blas_dcsr_aAxpy (const REAL alpha, dCSRmat *A, REAL *x, REAL *y)
 Matrix-vector multiplication y = alpha*A*x + y. More...
 
void fasp_blas_dcsr_aAxpy_agg (const REAL alpha, dCSRmat *A, REAL *x, REAL *y)
 Matrix-vector multiplication y = alpha*A*x + y (the entries of A are all ones) More...
 
REAL fasp_blas_dcsr_vmv (dCSRmat *A, REAL *x, REAL *y)
 vector-Matrix-vector multiplication alpha = y'*A*x More...
 
void fasp_blas_dcsr_mxm (dCSRmat *A, dCSRmat *B, dCSRmat *C)
 Sparse matrix multiplication C=A*B. More...
 
void fasp_blas_dcsr_rap (dCSRmat *R, dCSRmat *A, dCSRmat *P, dCSRmat *RAP)
 Triple sparse matrix multiplication B=R*A*P. More...
 
void fasp_blas_dcsr_rap_agg (dCSRmat *R, dCSRmat *A, dCSRmat *P, dCSRmat *RAP)
 Triple sparse matrix multiplication B=R*A*P. More...
 
void fasp_blas_dcsr_rap_agg1 (dCSRmat *R, dCSRmat *A, dCSRmat *P, dCSRmat *B)
 Triple sparse matrix multiplication B=R*A*P (nonzero entries of R and P are ones) More...
 
void fasp_blas_dcsr_ptap (dCSRmat *Pt, dCSRmat *A, dCSRmat *P, dCSRmat *Ac)
 Triple sparse matrix multiplication B=P'*A*P. More...
 
void fasp_blas_dcsr_rap4 (dCSRmat *R, dCSRmat *A, dCSRmat *P, dCSRmat *B, INT *icor_ysk)
 Triple sparse matrix multiplication B=R*A*P. More...
 
void fasp_blas_dcsr_bandwith (dCSRmat *A, INT *bndwith)
 Get bandwith of matrix. More...
 

Detailed Description

BLAS2 operations for dCSRmat matrices.

Note
Sparse functions usually contain three runs. The three runs are all the same but thy serve different purpose.

Example: If you do c=a+b:

  • first do a dry run to find the number of non-zeroes in the result and form ic;
  • allocate space (memory) for jc and form this one;
  • if you only care about a "boolean" result of the addition, you stop here;
  • you call another routine, which uses ic and jc to perform the addition.

Definition in file blas_csr.c.

Function Documentation

void fasp_blas_dcsr_aAxpy ( const REAL  alpha,
dCSRmat A,
REAL x,
REAL y 
)

Matrix-vector multiplication y = alpha*A*x + y.

Parameters
alphaREAL factor alpha
APointer to dCSRmat matrix A
xPointer to array x
yPointer to array y
Author
Chensong Zhang
Date
07/01/2009

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

Definition at line 479 of file blas_csr.c.

void fasp_blas_dcsr_aAxpy_agg ( const REAL  alpha,
dCSRmat A,
REAL x,
REAL y 
)

Matrix-vector multiplication y = alpha*A*x + y (the entries of A are all ones)

Parameters
alphaREAL factor alpha
APointer to dCSRmat matrix A
xPointer to array x
yPointer to array y
Author
Xiaozhe Hu
Date
02/22/2011

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

Definition at line 593 of file blas_csr.c.

void fasp_blas_dcsr_add ( dCSRmat A,
const REAL  alpha,
dCSRmat B,
const REAL  beta,
dCSRmat C 
)

compute C = alpha*A + beta*B in CSR format

Parameters
APointer to dCSRmat matrix
alphaREAL factor alpha
BPointer to dCSRmat matrix
betaREAL factor beta
CPointer to dCSRmat matrix
Returns
FASP_SUCCESS if succeed, ERROR if not
Author
Xiaozhe Hu
Date
11/07/2009

Modified by Chunsheng Feng, Zheng Li on 06/29/2012

Definition at line 48 of file blas_csr.c.

void fasp_blas_dcsr_axm ( dCSRmat A,
const REAL  alpha 
)

Multiply a sparse matrix A in CSR format by a scalar alpha.

Parameters
APointer to dCSRmat matrix A
alphaREAL factor alpha
Author
Chensong Zhang
Date
07/01/2009

Modified by Chunsheng Feng, Zheng Li on 06/29/2012

Definition at line 201 of file blas_csr.c.

fasp_blas_dcsr_bandwith ( dCSRmat A,
INT bndwith 
)

Get bandwith of matrix.

Parameters
Apointer to the dCSRmat matrix
bndwithpointer to the bandwith
Author
Zheng Li
Date
03/22/2015

Definition at line 1999 of file blas_csr.c.

void fasp_blas_dcsr_mxm ( dCSRmat A,
dCSRmat B,
dCSRmat C 
)

Sparse matrix multiplication C=A*B.

Parameters
APointer to the dCSRmat matrix A
BPointer to the dCSRmat matrix B
CPointer to dCSRmat matrix equal to A*B
Author
Xiaozhe Hu
Date
11/07/2009
Note
This fct will be replaced! –Chensong

Definition at line 759 of file blas_csr.c.

void fasp_blas_dcsr_mxv ( dCSRmat A,
REAL x,
REAL y 
)

Matrix-vector multiplication y = A*x.

Parameters
APointer to dCSRmat matrix A
xPointer to array x
yPointer to array y
Author
Chensong Zhang
Date
07/01/2009

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

Definition at line 225 of file blas_csr.c.

void fasp_blas_dcsr_mxv_agg ( dCSRmat A,
REAL x,
REAL y 
)

Matrix-vector multiplication y = A*x, where the entries of A are all ones.

Parameters
APointer to dCSRmat matrix A
xPointer to array x
yPointer to array y
Author
Xiaozhe Hu
Date
02/22/2011

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

Definition at line 423 of file blas_csr.c.

void fasp_blas_dcsr_ptap ( dCSRmat Pt,
dCSRmat A,
dCSRmat P,
dCSRmat Ac 
)

Triple sparse matrix multiplication B=P'*A*P.

Parameters
PtPointer to the restriction matrix
APointer to the fine coefficient matrix
PPointer to the prolongation matrix
AcPointer to the coarse coefficient matrix (output)
Author
Ludmil Zikatanov, Chensong Zhang
Date
05/10/2010

Modified by Chunsheng Feng, Zheng Li on 10/19/2012

Note
Driver to compute triple matrix product P'*A*P using ltz CSR format. In ltx format: ia[0]=1, ja[0] and a[0] are used as usual. When called from Fortran, ia[0], ja[0] and a[0] will be just ia(1),ja(1),a(1). For the indices, ia_ltz[k] = ia_usual[k]+1, ja_ltz[k] = ja_usual[k]+1, a_ltz[k] = a_usual[k].

Definition at line 1596 of file blas_csr.c.

void fasp_blas_dcsr_rap ( dCSRmat R,
dCSRmat A,
dCSRmat P,
dCSRmat RAP 
)

Triple sparse matrix multiplication B=R*A*P.

Parameters
RPointer to the dCSRmat matrix R
APointer to the dCSRmat matrix A
PPointer to the dCSRmat matrix P
RAPPointer to dCSRmat matrix equal to R*A*P
Author
Xuehai Huang, Chensong Zhang
Date
05/10/2010

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

Note
Ref. R.E. Bank and C.C. Douglas. SMMP: Sparse Matrix Multiplication Package. Advances in Computational Mathematics, 1 (1993), pp. 127-137.

Definition at line 866 of file blas_csr.c.

void fasp_blas_dcsr_rap4 ( dCSRmat R,
dCSRmat A,
dCSRmat P,
dCSRmat B,
INT icor_ysk 
)

Triple sparse matrix multiplication B=R*A*P.

Parameters
Rpointer to the dCSRmat matrix
Apointer to the dCSRmat matrix
Ppointer to the dCSRmat matrix
Bpointer to dCSRmat matrix equal to R*A*P
icor_yskpointer to the array
Author
Feng Chunsheng, Yue Xiaoqiang
Date
08/02/2011
Note
Ref. R.E. Bank and C.C. Douglas. SMMP: Sparse Matrix Multiplication Package. Advances in Computational Mathematics, 1 (1993), pp. 127-137.

Definition at line 1698 of file blas_csr.c.

void fasp_blas_dcsr_rap_agg ( dCSRmat R,
dCSRmat A,
dCSRmat P,
dCSRmat RAP 
)

Triple sparse matrix multiplication B=R*A*P.

Parameters
RPointer to the dCSRmat matrix R
APointer to the dCSRmat matrix A
PPointer to the dCSRmat matrix P
RAPPointer to dCSRmat matrix equal to R*A*P
Author
Xiaozhe Hu
Date
05/10/2010

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

Note
Ref. R.E. Bank and C.C. Douglas. SMMP: Sparse Matrix Multiplication Package. Advances in Computational Mathematics, 1 (1993), pp. 127-137.

Definition at line 1148 of file blas_csr.c.

void fasp_blas_dcsr_rap_agg1 ( dCSRmat R,
dCSRmat A,
dCSRmat P,
dCSRmat B 
)

Triple sparse matrix multiplication B=R*A*P (nonzero entries of R and P are ones)

Parameters
RPointer to the dCSRmat matrix R
APointer to the dCSRmat matrix A
PPointer to the dCSRmat matrix P
BPointer to dCSRmat matrix equal to R*A*P
Author
Xiaozhe Hu
Date
02/21/2011
Note
Ref. R.E. Bank and C.C. Douglas. SMMP: Sparse Matrix Multiplication Package. Advances in Computational Mathematics, 1 (1993), pp. 127-137.

Definition at line 1413 of file blas_csr.c.

REAL fasp_blas_dcsr_vmv ( dCSRmat A,
REAL x,
REAL y 
)

vector-Matrix-vector multiplication alpha = y'*A*x

Parameters
APointer to dCSRmat matrix A
xPointer to array x
yPointer to array y
Author
Chensong Zhang
Date
07/01/2009

Definition at line 704 of file blas_csr.c.