spmv_ubcsr.h

00001 /*
00002  *  file :  spmv_ubcsr.h
00003  *  desc :  Row-unaligned block compressed sparse row format.
00004  */
00005 
00006 #if !defined(INC_SPMV_UBCSR_H)
00007 #define INC_SPMV_UBCSR_H
00008 
00009 #if !defined(INC_SPMV_H)
00010 typedef struct tagSparseMatrixCSR SparseMatrixCSR;
00011 #endif
00012 
00013 #if !defined(INC_SPMV_VBR_H)
00014 typedef struct tagSparseMatrixVBR SparseMatrixVBR;
00015 #endif
00016 
00017 /*  
00018  *  Sparse matrix in row-unaligned blocked CSR storage.
00019  *  
00020  *  Note: Value blocks are stored in row-major order.
00021  *
00022  *  Data structure invariants:
00023  *     nnz == 0  ==>  b_row_ptr[0] = 0, all other pointer fields are NULL.
00024  */
00025 typedef struct tagSparseMatrixUBCSR
00026 {
00027   int m, n;         /* true dimensions */
00028   int nnz;          /* true # of non-zeros (not incl. explicit zeros) */
00029   int r, c;         /* register block size */
00030   int num_blocks;       /* number of stored blocks */
00031 
00032   int bm;           /* # of block rows */
00033   int *b_row_ptr;       /* block row starts; ceil(m/r)+1==bm+1 entries */
00034   int *b_row_ind;       /* block row indices; ceil(m/r)==bm entries */
00035   int *b_col_ind;       /* block column indices; num_blocks entries */
00036   double *b_val;        /* block values; nnz entries */
00037 
00038   int is_symm;          /* 1 <==> matrix is symmetric */
00039 } SparseMatrixUBCSR;
00040 
00041 
00042 typedef void (*SPMV_UBCSR_FP) (int bm, const int *ptr,
00043                    const int *row_ind, const int *col_ind,
00044                    const double *val, const double *x, double *y);
00045 
00046 #define UBCSR_MAX_ROWS  10
00047 #define UBCSR_MAX_COLS  10
00048 
00049 extern SPMV_UBCSR_FP spmvUBlkCSRRoutines[];
00050 
00051 extern void spmv_convert_vbr2ubcsr (const SparseMatrixVBR * A,
00052                     int r, int c, SparseMatrixUBCSR * B1,
00053                     SparseMatrixCSR * B2);
00054     /*
00055      *  spmv_convert_vbr2ubcsr( A, B1, B2 );
00056      *
00057      *  Compute the decomposition A = B1 + B2, where A is a given
00058      *  VBR matrix, B1 is a row-unaligned blocked matrix in r x c
00059      *  UBCSR format, and B2 is a CSR matrix.
00060      */
00061 
00062 extern void spmv_alloc_ubcsr (SparseMatrixUBCSR * A, int r, int c, int m,
00063                   int n, int mb, int nblocks);
00064 extern void spmv_destroy_ubcsr (SparseMatrixUBCSR * A);
00065 
00066 extern void spmv_ubcsr (const SparseMatrixUBCSR * A,
00067             const double *x, double *y);
00068 
00069 #endif
00070 
00071 /* eof */

Generated on Wed Sep 19 16:41:18 2007 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.4.6