Fast Auxiliary Space Preconditioning 2.7.7 Aug/28/2022
Loading...
Searching...
No Matches
BlaSpmvCSR.c File Reference

Linear algebraic 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

SHORT fasp_blas_dcsr_add (const dCSRmat *A, const REAL alpha, const 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 (const dCSRmat *A, const REAL *x, REAL *y)
 Matrix-vector multiplication y = A*x. More...
 
void fasp_blas_dcsr_mxv_agg (const dCSRmat *A, const REAL *x, REAL *y)
 Matrix-vector multiplication y = A*x (nonzeros of A = 1) More...
 
void fasp_blas_dcsr_aAxpy (const REAL alpha, const dCSRmat *A, const REAL *x, REAL *y)
 Matrix-vector multiplication y = alpha*A*x + y. More...
 
void fasp_blas_ldcsr_aAxpy (const REAL alpha, const dCSRmat *A, const LONGREAL *x, REAL *y)
 Matrix-vector multiplication y = alpha*A*x + y. More...
 
void fasp_blas_dcsr_aAxpy_agg (const REAL alpha, const dCSRmat *A, const REAL *x, REAL *y)
 Matrix-vector multiplication y = alpha*A*x + y (nonzeros of A = 1) More...
 
REAL fasp_blas_dcsr_vmv (const dCSRmat *A, const REAL *x, const REAL *y)
 vector-Matrix-vector multiplication alpha = y'*A*x More...
 
void fasp_blas_dcsr_mxm (const dCSRmat *A, const dCSRmat *B, dCSRmat *C)
 Sparse matrix multiplication C=A*B. More...
 
void fasp_blas_dcsr_rap (const dCSRmat *R, const dCSRmat *A, const dCSRmat *P, dCSRmat *RAP)
 Triple sparse matrix multiplication B=R*A*P. More...
 
void fasp_blas_dcsr_rap_agg (const dCSRmat *R, const dCSRmat *A, const dCSRmat *P, dCSRmat *RAP)
 Triple sparse matrix multiplication B=R*A*P (nonzeros of R, P = 1) More...
 
void fasp_blas_dcsr_rap_agg1 (const dCSRmat *R, const dCSRmat *A, const dCSRmat *P, dCSRmat *B)
 Triple sparse matrix multiplication B=R*A*P (nonzeros of R, P = 1) More...
 
void fasp_blas_dcsr_ptap (const dCSRmat *Pt, const dCSRmat *A, const dCSRmat *P, dCSRmat *Ac)
 Triple sparse matrix multiplication B=P'*A*P. More...
 
dCSRmat fasp_blas_dcsr_rap2 (INT *ir, INT *jr, REAL *r, INT *ia, INT *ja, REAL *a, INT *ipt, INT *jpt, REAL *pt, INT n, INT nc, INT *maxrpout, INT *ipin, INT *jpin)
 Compute R*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...
 

Variables

unsigned long total_alloc_mem
 
unsigned long total_alloc_count
 

Detailed Description

Linear algebraic operations for dCSRmat matrices.

Note
This file contains Level-1 (Bla) functions. It requires: AuxArray.c, AuxMemory.c, AuxThreads.c, BlaSparseCSR.c, BlaSparseUtil.c, and BlaArray.c
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 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.

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 BlaSpmvCSR.c.

Function Documentation

◆ fasp_blas_dcsr_aAxpy()

void fasp_blas_dcsr_aAxpy ( const REAL  alpha,
const dCSRmat A,
const 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 494 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_aAxpy_agg()

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

Matrix-vector multiplication y = alpha*A*x + y (nonzeros of A = 1)

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 727 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_add()

SHORT fasp_blas_dcsr_add ( const dCSRmat A,
const REAL  alpha,
const 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 60 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_axm()

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 220 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_mxm()

void fasp_blas_dcsr_mxm ( const dCSRmat A,
const 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
Warning
This fct will be replaced! –Chensong

Definition at line 893 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_mxv()

void fasp_blas_dcsr_mxv ( const dCSRmat A,
const 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 242 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_mxv_agg()

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

Matrix-vector multiplication y = A*x (nonzeros of A = 1)

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 438 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_ptap()

void fasp_blas_dcsr_ptap ( const dCSRmat Pt,
const dCSRmat A,
const 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 1745 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_rap()

void fasp_blas_dcsr_rap ( const dCSRmat R,
const dCSRmat A,
const 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 999 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_rap2()

dCSRmat fasp_blas_dcsr_rap2 ( INT ir,
INT jr,
REAL r,
INT ia,
INT ja,
REAL a,
INT ipt,
INT jpt,
REAL pt,
INT  n,
INT  nc,
INT maxrpout,
INT ipin,
INT jpin 
)

Compute R*A*P.

Author
Ludmil Zikatanov
Date
04/08/2010
Note
It uses dCSRmat only. The functions called from here are in sparse_util.c. Not used for the moment!

Definition at line 1855 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_rap4()

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 1954 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_rap_agg()

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

Triple sparse matrix multiplication B=R*A*P (nonzeros of R, P = 1)

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

Definition at line 1276 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_rap_agg1()

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

Triple sparse matrix multiplication B=R*A*P (nonzeros of R, P = 1)

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 1539 of file BlaSpmvCSR.c.

◆ fasp_blas_dcsr_vmv()

REAL fasp_blas_dcsr_vmv ( const dCSRmat A,
const REAL x,
const 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 839 of file BlaSpmvCSR.c.

◆ fasp_blas_ldcsr_aAxpy()

void fasp_blas_ldcsr_aAxpy ( const REAL  alpha,
const dCSRmat A,
const LONGREAL 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 TingLai on 08/01/2022

Definition at line 609 of file BlaSpmvCSR.c.

Variable Documentation

◆ total_alloc_count

unsigned long total_alloc_count
extern

Total number of allocatations

◆ total_alloc_mem

unsigned long total_alloc_mem
extern

Total allocated memory