SpM Handbook 1.2.4
|
Matrix-Vector and matrix-matrix product routines. More...
Files | |
file | c_spm_matrixvector.c |
file | s_spm_matrixvector.c |
file | z_spm_matrixvector.c |
file | d_spm_matrixvector.c |
Functions | |
int | spm_sspmv (spm_trans_t trans, float alpha, const spmatrix_t *A, const float *x, spm_int_t incx, float beta, float *y, spm_int_t incy) |
compute the matrix-vector product: | |
int | spm_sspmm (spm_side_t side, spm_trans_t transA, spm_trans_t transB, spm_int_t K, float alpha, const spmatrix_t *A, const float *B, spm_int_t ldb, float beta, float *C, spm_int_t ldc) |
Compute a matrix-matrix product. | |
int | spm_dspmv (spm_trans_t trans, double alpha, const spmatrix_t *A, const double *x, spm_int_t incx, double beta, double *y, spm_int_t incy) |
compute the matrix-vector product: | |
int | spm_dspmm (spm_side_t side, spm_trans_t transA, spm_trans_t transB, spm_int_t K, double alpha, const spmatrix_t *A, const double *B, spm_int_t ldb, double beta, double *C, spm_int_t ldc) |
Compute a matrix-matrix product. | |
int | spm_cspmv (spm_trans_t trans, spm_complex32_t alpha, const spmatrix_t *A, const spm_complex32_t *x, spm_int_t incx, spm_complex32_t beta, spm_complex32_t *y, spm_int_t incy) |
compute the matrix-vector product: | |
int | spm_cspmm (spm_side_t side, spm_trans_t transA, spm_trans_t transB, spm_int_t K, spm_complex32_t alpha, const spmatrix_t *A, const spm_complex32_t *B, spm_int_t ldb, spm_complex32_t beta, spm_complex32_t *C, spm_int_t ldc) |
Compute a matrix-matrix product. | |
int | spm_zspmv (spm_trans_t trans, spm_complex64_t alpha, const spmatrix_t *A, const spm_complex64_t *x, spm_int_t incx, spm_complex64_t beta, spm_complex64_t *y, spm_int_t incy) |
compute the matrix-vector product: | |
int | spm_zspmm (spm_side_t side, spm_trans_t transA, spm_trans_t transB, spm_int_t K, spm_complex64_t alpha, const spmatrix_t *A, const spm_complex64_t *B, spm_int_t ldb, spm_complex64_t beta, spm_complex64_t *C, spm_int_t ldc) |
Compute a matrix-matrix product. | |
Matrix-Vector and matrix-matrix product routines.
int spm_sspmv | ( | spm_trans_t | trans, |
float | alpha, | ||
const spmatrix_t * | A, | ||
const float * | x, | ||
spm_int_t | incx, | ||
float | beta, | ||
float * | y, | ||
spm_int_t | incy | ||
) |
compute the matrix-vector product:
A is a SpmSymmetric spm, alpha and beta are scalars, and x and y are vectors, and A a symm.
[in] | trans | TODO |
[in] | alpha | alpha specifies the scalar alpha |
[in] | A | The SpmSymmetric spm. |
[in] | x | The vector x. |
[in] | incx | The vector x. |
[in] | beta | beta specifies the scalar beta |
[in,out] | y | The vector y. |
[in] | incy | The vector y. |
SPM_SUCCESS | if the y vector has been computed succesfully, |
SPM_ERR_BADPARAMETER | otherwise. |
Definition at line 1245 of file s_spm_matrixvector.c.
References spmatrix_s::mtxtype, spmatrix_s::nexp, s_spmm_build_Btmp(), s_spmm_build_Ctmp(), s_spmReduceRHS(), spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, SpmDistByRow, SpmGeneral, SpmLeft, and SpmNoTrans.
Referenced by spmMatVec().
int spm_sspmm | ( | spm_side_t | side, |
spm_trans_t | transA, | ||
spm_trans_t | transB, | ||
spm_int_t | K, | ||
float | alpha, | ||
const spmatrix_t * | A, | ||
const float * | B, | ||
spm_int_t | ldb, | ||
float | beta, | ||
float * | C, | ||
spm_int_t | ldc | ||
) |
Compute a matrix-matrix product.
C = alpha * op(A) * op(B) + beta * C or C = alpha * op(B) * op(A) + beta * C
where A is a sparse matrix, B and C two dense matrices. And op(A), op(B) are one of:
op( A ) = A or op( A ) = A' or op( A ) = conjg( A' )
alpha and beta are scalars.
[in] | side | Specifies whether A * B is computed or B * A
|
[in] | transA | Specifies whether the sparse matrix A is not transposed, transposed or conjugate transposed:
|
[in] | transB | Specifies whether the dense matrix B is not transposed, transposed or conjugate transposed:
|
[in] | K | If side == SpmLeft, specifies the number of columns of the matrices op(B) and C. If side == SpmRight, specifies the number of rows of the matrices op(B) and C. |
[in] | alpha | alpha specifies the scalar alpha. |
[in] | A | The sparse matrix A |
[in] | B | The matrix B of size: ldb-by-Bn, with Bn = (K, A->m or A->n) based on the configuration of side, transA and transB. |
[in] | ldb | The leading dimension of the matrix B. ldb >= (A->m, A->n or K) based on the configuration of side, transA, and transB |
[in] | beta | beta specifies the scalar beta. |
[in,out] | C | The matrix C of size ldc-by-Cn with Bn = (K, A->m or A->n) based on the configuration of side, transA and transB. |
[in] | ldc | The leading dimension of the matrix C. ldc >= (A->m, A->n or K) based on the configuration of side, transA, and transB |
Left | NoTrans | NoTrans | A->n by K | A->m by K | Left | NoTrans | [Conj]Trans | K by A->n | A->m by K | Left | [Conj]Trans | NoTrans | A->m by K | A->n by K | Left | [Conj]Trans | [Conj]Trans | K by A->m | A->n by K | Right | NoTrans | NoTrans | K by A->m | K by A->n | Right | NoTrans | [Conj]Trans | A->m by K | K by A->n | Right | [Conj]Trans | NoTrans | K by A->n | K by A->m | Right | [Conj]Trans | [Conj]Trans | A->n by K | K by A->m |
SPM_SUCCESS | if the y vector has been computed successfully, |
SPM_ERR_BADPARAMETER | otherwise. |
Definition at line 1111 of file s_spm_matrixvector.c.
References LAPACKE_slascl_work, spmatrix_s::mtxtype, spmatrix_s::nexp, s_spmm_build_Btmp(), s_spmm_build_Ctmp(), s_spmReduceRHS(), SPM_ERR_BADPARAMETER, SPM_ERR_INTERNAL, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, SpmDistByRow, SpmGeneral, SpmLeft, and SpmNoTrans.
Referenced by s_spmCheckAxb(), s_spmGenRHS(), and spmMatMat().
int spm_dspmv | ( | spm_trans_t | trans, |
double | alpha, | ||
const spmatrix_t * | A, | ||
const double * | x, | ||
spm_int_t | incx, | ||
double | beta, | ||
double * | y, | ||
spm_int_t | incy | ||
) |
compute the matrix-vector product:
A is a SpmSymmetric spm, alpha and beta are scalars, and x and y are vectors, and A a symm.
[in] | trans | TODO |
[in] | alpha | alpha specifies the scalar alpha |
[in] | A | The SpmSymmetric spm. |
[in] | x | The vector x. |
[in] | incx | The vector x. |
[in] | beta | beta specifies the scalar beta |
[in,out] | y | The vector y. |
[in] | incy | The vector y. |
SPM_SUCCESS | if the y vector has been computed succesfully, |
SPM_ERR_BADPARAMETER | otherwise. |
Definition at line 1245 of file d_spm_matrixvector.c.
References d_spmm_build_Btmp(), d_spmm_build_Ctmp(), d_spmReduceRHS(), spmatrix_s::mtxtype, spmatrix_s::nexp, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, SpmDistByRow, SpmGeneral, SpmLeft, and SpmNoTrans.
Referenced by spmMatVec().
int spm_dspmm | ( | spm_side_t | side, |
spm_trans_t | transA, | ||
spm_trans_t | transB, | ||
spm_int_t | K, | ||
double | alpha, | ||
const spmatrix_t * | A, | ||
const double * | B, | ||
spm_int_t | ldb, | ||
double | beta, | ||
double * | C, | ||
spm_int_t | ldc | ||
) |
Compute a matrix-matrix product.
C = alpha * op(A) * op(B) + beta * C or C = alpha * op(B) * op(A) + beta * C
where A is a sparse matrix, B and C two dense matrices. And op(A), op(B) are one of:
op( A ) = A or op( A ) = A' or op( A ) = conjg( A' )
alpha and beta are scalars.
[in] | side | Specifies whether A * B is computed or B * A
|
[in] | transA | Specifies whether the sparse matrix A is not transposed, transposed or conjugate transposed:
|
[in] | transB | Specifies whether the dense matrix B is not transposed, transposed or conjugate transposed:
|
[in] | K | If side == SpmLeft, specifies the number of columns of the matrices op(B) and C. If side == SpmRight, specifies the number of rows of the matrices op(B) and C. |
[in] | alpha | alpha specifies the scalar alpha. |
[in] | A | The sparse matrix A |
[in] | B | The matrix B of size: ldb-by-Bn, with Bn = (K, A->m or A->n) based on the configuration of side, transA and transB. |
[in] | ldb | The leading dimension of the matrix B. ldb >= (A->m, A->n or K) based on the configuration of side, transA, and transB |
[in] | beta | beta specifies the scalar beta. |
[in,out] | C | The matrix C of size ldc-by-Cn with Bn = (K, A->m or A->n) based on the configuration of side, transA and transB. |
[in] | ldc | The leading dimension of the matrix C. ldc >= (A->m, A->n or K) based on the configuration of side, transA, and transB |
Left | NoTrans | NoTrans | A->n by K | A->m by K | Left | NoTrans | [Conj]Trans | K by A->n | A->m by K | Left | [Conj]Trans | NoTrans | A->m by K | A->n by K | Left | [Conj]Trans | [Conj]Trans | K by A->m | A->n by K | Right | NoTrans | NoTrans | K by A->m | K by A->n | Right | NoTrans | [Conj]Trans | A->m by K | K by A->n | Right | [Conj]Trans | NoTrans | K by A->n | K by A->m | Right | [Conj]Trans | [Conj]Trans | A->n by K | K by A->m |
SPM_SUCCESS | if the y vector has been computed successfully, |
SPM_ERR_BADPARAMETER | otherwise. |
Definition at line 1111 of file d_spm_matrixvector.c.
References d_spmm_build_Btmp(), d_spmm_build_Ctmp(), d_spmReduceRHS(), LAPACKE_dlascl_work, spmatrix_s::mtxtype, spmatrix_s::nexp, SPM_ERR_BADPARAMETER, SPM_ERR_INTERNAL, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, SpmDistByRow, SpmGeneral, SpmLeft, and SpmNoTrans.
Referenced by d_spmCheckAxb(), d_spmGenRHS(), and spmMatMat().
int spm_cspmv | ( | spm_trans_t | trans, |
spm_complex32_t | alpha, | ||
const spmatrix_t * | A, | ||
const spm_complex32_t * | x, | ||
spm_int_t | incx, | ||
spm_complex32_t | beta, | ||
spm_complex32_t * | y, | ||
spm_int_t | incy | ||
) |
compute the matrix-vector product:
A is a SpmHermitian spm, alpha and beta are scalars, and x and y are vectors, and A a symm.
[in] | trans | TODO |
[in] | alpha | alpha specifies the scalar alpha |
[in] | A | The SpmHermitian spm. |
[in] | x | The vector x. |
[in] | incx | The vector x. |
[in] | beta | beta specifies the scalar beta |
[in,out] | y | The vector y. |
[in] | incy | The vector y. |
SPM_SUCCESS | if the y vector has been computed succesfully, |
SPM_ERR_BADPARAMETER | otherwise. |
Definition at line 1245 of file c_spm_matrixvector.c.
References c_spmm_build_Btmp(), c_spmm_build_Ctmp(), c_spmReduceRHS(), CBLAS_SADDR, spmatrix_s::mtxtype, spmatrix_s::nexp, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, SpmDistByRow, SpmGeneral, SpmLeft, and SpmNoTrans.
Referenced by spmMatVec().
int spm_cspmm | ( | spm_side_t | side, |
spm_trans_t | transA, | ||
spm_trans_t | transB, | ||
spm_int_t | K, | ||
spm_complex32_t | alpha, | ||
const spmatrix_t * | A, | ||
const spm_complex32_t * | B, | ||
spm_int_t | ldb, | ||
spm_complex32_t | beta, | ||
spm_complex32_t * | C, | ||
spm_int_t | ldc | ||
) |
Compute a matrix-matrix product.
C = alpha * op(A) * op(B) + beta * C or C = alpha * op(B) * op(A) + beta * C
where A is a sparse matrix, B and C two dense matrices. And op(A), op(B) are one of:
op( A ) = A or op( A ) = A' or op( A ) = conjg( A' )
alpha and beta are scalars.
[in] | side | Specifies whether A * B is computed or B * A
|
[in] | transA | Specifies whether the sparse matrix A is not transposed, transposed or conjugate transposed:
|
[in] | transB | Specifies whether the dense matrix B is not transposed, transposed or conjugate transposed:
|
[in] | K | If side == SpmLeft, specifies the number of columns of the matrices op(B) and C. If side == SpmRight, specifies the number of rows of the matrices op(B) and C. |
[in] | alpha | alpha specifies the scalar alpha. |
[in] | A | The sparse matrix A |
[in] | B | The matrix B of size: ldb-by-Bn, with Bn = (K, A->m or A->n) based on the configuration of side, transA and transB. |
[in] | ldb | The leading dimension of the matrix B. ldb >= (A->m, A->n or K) based on the configuration of side, transA, and transB |
[in] | beta | beta specifies the scalar beta. |
[in,out] | C | The matrix C of size ldc-by-Cn with Bn = (K, A->m or A->n) based on the configuration of side, transA and transB. |
[in] | ldc | The leading dimension of the matrix C. ldc >= (A->m, A->n or K) based on the configuration of side, transA, and transB |
Left | NoTrans | NoTrans | A->n by K | A->m by K | Left | NoTrans | [Conj]Trans | K by A->n | A->m by K | Left | [Conj]Trans | NoTrans | A->m by K | A->n by K | Left | [Conj]Trans | [Conj]Trans | K by A->m | A->n by K | Right | NoTrans | NoTrans | K by A->m | K by A->n | Right | NoTrans | [Conj]Trans | A->m by K | K by A->n | Right | [Conj]Trans | NoTrans | K by A->n | K by A->m | Right | [Conj]Trans | [Conj]Trans | A->n by K | K by A->m |
SPM_SUCCESS | if the y vector has been computed successfully, |
SPM_ERR_BADPARAMETER | otherwise. |
Definition at line 1111 of file c_spm_matrixvector.c.
References c_spmm_build_Btmp(), c_spmm_build_Ctmp(), c_spmReduceRHS(), LAPACKE_clascl_work, spmatrix_s::mtxtype, spmatrix_s::nexp, SPM_ERR_BADPARAMETER, SPM_ERR_INTERNAL, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, SpmDistByRow, SpmGeneral, SpmLeft, and SpmNoTrans.
Referenced by c_spmCheckAxb(), c_spmGenRHS(), and spmMatMat().
int spm_zspmv | ( | spm_trans_t | trans, |
spm_complex64_t | alpha, | ||
const spmatrix_t * | A, | ||
const spm_complex64_t * | x, | ||
spm_int_t | incx, | ||
spm_complex64_t | beta, | ||
spm_complex64_t * | y, | ||
spm_int_t | incy | ||
) |
compute the matrix-vector product:
A is a SpmHermitian spm, alpha and beta are scalars, and x and y are vectors, and A a symm.
[in] | trans | TODO |
[in] | alpha | alpha specifies the scalar alpha |
[in] | A | The SpmHermitian spm. |
[in] | x | The vector x. |
[in] | incx | The vector x. |
[in] | beta | beta specifies the scalar beta |
[in,out] | y | The vector y. |
[in] | incy | The vector y. |
SPM_SUCCESS | if the y vector has been computed succesfully, |
SPM_ERR_BADPARAMETER | otherwise. |
Definition at line 1245 of file z_spm_matrixvector.c.
References CBLAS_SADDR, spmatrix_s::mtxtype, spmatrix_s::nexp, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, SpmDistByRow, SpmGeneral, SpmLeft, SpmNoTrans, z_spmm_build_Btmp(), z_spmm_build_Ctmp(), and z_spmReduceRHS().
Referenced by spmMatVec().
int spm_zspmm | ( | spm_side_t | side, |
spm_trans_t | transA, | ||
spm_trans_t | transB, | ||
spm_int_t | K, | ||
spm_complex64_t | alpha, | ||
const spmatrix_t * | A, | ||
const spm_complex64_t * | B, | ||
spm_int_t | ldb, | ||
spm_complex64_t | beta, | ||
spm_complex64_t * | C, | ||
spm_int_t | ldc | ||
) |
Compute a matrix-matrix product.
C = alpha * op(A) * op(B) + beta * C or C = alpha * op(B) * op(A) + beta * C
where A is a sparse matrix, B and C two dense matrices. And op(A), op(B) are one of:
op( A ) = A or op( A ) = A' or op( A ) = conjg( A' )
alpha and beta are scalars.
[in] | side | Specifies whether A * B is computed or B * A
|
[in] | transA | Specifies whether the sparse matrix A is not transposed, transposed or conjugate transposed:
|
[in] | transB | Specifies whether the dense matrix B is not transposed, transposed or conjugate transposed:
|
[in] | K | If side == SpmLeft, specifies the number of columns of the matrices op(B) and C. If side == SpmRight, specifies the number of rows of the matrices op(B) and C. |
[in] | alpha | alpha specifies the scalar alpha. |
[in] | A | The sparse matrix A |
[in] | B | The matrix B of size: ldb-by-Bn, with Bn = (K, A->m or A->n) based on the configuration of side, transA and transB. |
[in] | ldb | The leading dimension of the matrix B. ldb >= (A->m, A->n or K) based on the configuration of side, transA, and transB |
[in] | beta | beta specifies the scalar beta. |
[in,out] | C | The matrix C of size ldc-by-Cn with Bn = (K, A->m or A->n) based on the configuration of side, transA and transB. |
[in] | ldc | The leading dimension of the matrix C. ldc >= (A->m, A->n or K) based on the configuration of side, transA, and transB |
Left | NoTrans | NoTrans | A->n by K | A->m by K | Left | NoTrans | [Conj]Trans | K by A->n | A->m by K | Left | [Conj]Trans | NoTrans | A->m by K | A->n by K | Left | [Conj]Trans | [Conj]Trans | K by A->m | A->n by K | Right | NoTrans | NoTrans | K by A->m | K by A->n | Right | NoTrans | [Conj]Trans | A->m by K | K by A->n | Right | [Conj]Trans | NoTrans | K by A->n | K by A->m | Right | [Conj]Trans | [Conj]Trans | A->n by K | K by A->m |
SPM_SUCCESS | if the y vector has been computed successfully, |
SPM_ERR_BADPARAMETER | otherwise. |
Definition at line 1111 of file z_spm_matrixvector.c.
References LAPACKE_zlascl_work, spmatrix_s::mtxtype, spmatrix_s::nexp, SPM_ERR_BADPARAMETER, SPM_ERR_INTERNAL, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, SpmDistByRow, SpmGeneral, SpmLeft, SpmNoTrans, z_spmm_build_Btmp(), z_spmm_build_Ctmp(), and z_spmReduceRHS().
Referenced by spmMatMat(), z_spmCheckAxb(), and z_spmGenRHS().