BeBOP Optimized Sparse Kernel Interface Library
1.0.1h
|
00001 00009 #if !defined(INCLUDE_SPMV_GCB_H) 00010 #define INCLUDE_SPMV_GCB_H 00011 00012 typedef struct tagSparseMatrixGeneralCSR SparseMatrixGeneralCSR; 00013 00014 typedef enum 00015 { gcsrTypeBlockRows, gcsrTypeSparseRows } gcsr_type; 00016 00017 struct tagSparseMatrixGeneralCSR 00018 { 00019 gcsr_type type; /* type of block this is */ 00020 00021 int row; /* first row in this block */ 00022 int col_min; /* min column index for this block */ 00023 int m; /* # of rows in this block */ 00024 int n; /* maximum width of this block */ 00025 int nnz; /* total # of non-zeros in this block */ 00026 00027 int *row_ptr; /* row pointers to columns of each row (m+1) */ 00028 int *col_ind; /* column indices within each row (nnz) */ 00029 double *val; /* data values (nnz) */ 00030 00031 /* blocks are linked in a list */ 00032 SparseMatrixGeneralCSR *next; 00033 00034 /* variable fields, depending on type */ 00035 int *row_ind; 00036 }; 00037 00038 typedef struct tagSparseMatrixCacheBlockedGCSR 00039 { 00040 int m, n; /* total matrix dimensions */ 00041 int nnz; /* total # of non-zeros */ 00042 00043 int num_blocks; 00044 SparseMatrixGeneralCSR *mats; /* matrix sub-blocks (num_blocks) */ 00045 } SparseMatrixCacheBlockedGCSR; 00046 00047 extern void convert_csr2cbgcsr (int R, int C, 00048 int m, int n, const int *ptr, const int *ind, 00049 const double *val, 00050 SparseMatrixCacheBlockedGCSR * B); 00051 /* 00052 * convert_csr2cbgcsr( R, C, m, n, ptr, ind, val, B ); 00053 * 00054 * Given an m x n CSR sparse matrix (ptr, ind, val), 00055 * converts it to R x C cache blocked matrix B. 00056 */ 00057 00058 extern void destroy_cbgcsr (SparseMatrixCacheBlockedGCSR * B); 00059 00060 extern void spmv_cbgcsr (const SparseMatrixCacheBlockedGCSR * B, 00061 const double *x, double *y); 00062 /* computes y += B*x */ 00063 00064 #endif 00065 00066 /* 00067 * $Log: spmv_gencb.h,v $ 00068 * Revision 1.1.1.1 2005/06/29 22:07:51 rvuduc 00069 * Initial import 00070 * 00071 * 00072 * eof 00073 */