EVSL
1.1.0
EigenValues Slicing Library
|
Sparse matrix routines. More...
#include <string.h>
#include "def.h"
#include "blaslapack.h"
#include "struct.h"
#include "internal_proto.h"
Go to the source code of this file.
Functions | |
void | csrcsc (int OUTINDEX, const int nrow, const int ncol, int job, double *a, int *ja, int *ia, double *ao, int *jao, int *iao) |
convert csr to csc Assume input csr is 0-based index output csc 0/1 index specified by OUTINDEX * More... | |
void | sortrow (csrMat *A) |
Sort each row of a csr by increasing column order By double transposition. More... | |
void | csr_resize (int nrow, int ncol, int nnz, csrMat *csr) |
memory allocation for csr matrix More... | |
void | free_csr (csrMat *csr) |
memory deallocation for csr matrix More... | |
void | csr_copy (csrMat *A, csrMat *B, int allocB) |
copy a csr matrix A into B alloB: 0: will not allocate memory for B (have been alloced outside) 1: will allocate memory for B (same size as A) More... | |
void | free_coo (cooMat *coo) |
memory deallocation for coo matrix More... | |
int | cooMat_to_csrMat (int cooidx, cooMat *coo, csrMat *csr) |
convert coo to csr More... | |
void | dcsrmv (char trans, int nrow, int ncol, double *a, int *ia, int *ja, double *x, double *y) |
csr matrix matvec or transpose matvec, (ia, ja, a) form More... | |
void | matvec_csr (double *x, double *y, void *data) |
matvec for a CSR matrix, y = A*x. void *data points to csrMat, compatible form with EVSLMatvec (see struct.h) More... | |
void | matadd_insert (double t, csrMat *A, csrMat *C, int i, int *k, int *j, int *map) |
inline function used by matadd insert an element pointed by j of A (times t) to location k in C (row i) More... | |
int | matadd (double alp, double bet, csrMat *A, csrMat *B, csrMat *C, int *mapA, int *mapB) |
matrix addition C = alp * A + bet * B More... | |
int | speye (int n, csrMat *A) |
return an identity matrix of dimension n More... | |
void | diagScalCoo (cooMat *A, double *d) |
void | diagScalCsr (csrMat *A, double *d) |
void | extrDiagCsr (csrMat *B, double *d) |
void | triuCsr (csrMat *A, csrMat *U) |
Sparse matrix routines.
Definition in file spmat.c.
convert coo to csr
Definition at line 135 of file spmat.c.
References _csrMat::a, csr_resize(), _csrMat::ia, _cooMat::ir, _csrMat::ja, _cooMat::jc, _cooMat::ncols, _cooMat::nnz, _cooMat::nrows, sortrow(), and _cooMat::vv.
Referenced by evsl_coo2csr(), and main().
copy a csr matrix A into B alloB: 0: will not allocate memory for B (have been alloced outside) 1: will allocate memory for B (same size as A)
Definition at line 106 of file spmat.c.
References _csrMat::a, csr_resize(), _csrMat::ia, _csrMat::ja, _csrMat::ncols, and _csrMat::nrows.
Referenced by main().
void csr_resize | ( | int | nrow, |
int | ncol, | ||
int | nnz, | ||
csrMat * | csr | ||
) |
memory allocation for csr matrix
Definition at line 79 of file spmat.c.
References _csrMat::a, _csrMat::ia, _csrMat::ja, Malloc, _csrMat::ncols, _csrMat::nrows, and _csrMat::owndata.
Referenced by cooMat_to_csrMat(), csr_copy(), matadd(), speye(), and triuCsr().
void csrcsc | ( | int | OUTINDEX, |
const int | nrow, | ||
const int | ncol, | ||
int | job, | ||
double * | a, | ||
int * | ja, | ||
int * | ia, | ||
double * | ao, | ||
int * | jao, | ||
int * | iao | ||
) |
void dcsrmv | ( | char | trans, |
int | nrow, | ||
int | ncol, | ||
double * | a, | ||
int * | ia, | ||
int * | ja, | ||
double * | x, | ||
double * | y | ||
) |
csr matrix matvec or transpose matvec, (ia, ja, a) form
Definition at line 199 of file spmat.c.
Referenced by matvec_csr().
void diagScalCoo | ( | cooMat * | A, |
double * | d | ||
) |
Definition at line 374 of file spmat.c.
References _cooMat::ir, _cooMat::jc, _cooMat::nnz, and _cooMat::vv.
void diagScalCsr | ( | csrMat * | A, |
double * | d | ||
) |
Definition at line 390 of file spmat.c.
References _csrMat::a, _csrMat::ia, _csrMat::ja, and _csrMat::nrows.
Referenced by main().
void extrDiagCsr | ( | csrMat * | B, |
double * | d | ||
) |
Definition at line 406 of file spmat.c.
References _csrMat::a, _csrMat::ia, _csrMat::ja, and _csrMat::nrows.
Referenced by main().
void free_coo | ( | cooMat * | coo | ) |
memory deallocation for coo matrix
Definition at line 126 of file spmat.c.
References _cooMat::ir, _cooMat::jc, and _cooMat::vv.
Referenced by main().
void free_csr | ( | csrMat * | csr | ) |
memory deallocation for csr matrix
Definition at line 91 of file spmat.c.
References _csrMat::a, _csrMat::ia, _csrMat::ja, and _csrMat::owndata.
Referenced by evsl_free_csr(), main(), and SetupASIGMABSolDirect().
matrix addition C = alp * A + bet * B
[in] | alp | |
[in] | bet | |
[in] | A | |
[in] | B | |
[out] | C |
[out] | mapA | (of size nnzA or null), mapB (of size nnzB or null) if not null, on output mapA contains the location of each nonzero of A in the CSR matrix C, i.e. mapA[i] is the position of the corresponding entry in C.ja and C.a for entry in A.ja[i] and A.a[i] |
[out] | mapB | the same as mapA |
Definition at line 307 of file spmat.c.
References _csrMat::a, csr_resize(), _csrMat::ia, _csrMat::ja, matadd_insert(), _csrMat::ncols, _csrMat::nrows, and Realloc.
Referenced by SetupASIGMABSolDirect().
inline function used by matadd insert an element pointed by j of A (times t) to location k in C (row i)
Definition at line 266 of file spmat.c.
References _csrMat::a, _csrMat::ia, and _csrMat::ja.
Referenced by matadd().
void matvec_csr | ( | double * | x, |
double * | y, | ||
void * | data | ||
) |
matvec for a CSR matrix, y = A*x. void *data points to csrMat, compatible form with EVSLMatvec (see struct.h)
Definition at line 247 of file spmat.c.
References _csrMat::a, dcsrmv(), _csrMat::ia, _csrMat::ja, _csrMat::ncols, and _csrMat::nrows.
Referenced by SetAMatrix(), and SetBMatrix().
void sortrow | ( | csrMat * | A | ) |
Sort each row of a csr by increasing column order By double transposition.
Definition at line 56 of file spmat.c.
References _csrMat::a, csrcsc(), _csrMat::ia, _csrMat::ja, Malloc, _csrMat::ncols, and _csrMat::nrows.
Referenced by cooMat_to_csrMat().
int speye | ( | int | n, |
csrMat * | A | ||
) |
return an identity matrix of dimension n
Definition at line 357 of file spmat.c.
References _csrMat::a, csr_resize(), _csrMat::ia, and _csrMat::ja.
Referenced by SetupASIGMABSolDirect().
Definition at line 424 of file spmat.c.
References _csrMat::a, CHKERR, csr_resize(), EVSL_Int, EVSL_Unsigned, _csrMat::ia, _csrMat::ja, _csrMat::ncols, and _csrMat::nrows.