spmv_rsegdiag.h

00001 
00006 #if !defined(INC_SPMV_ROW_SEG_DIAG_H)
00007 #define INC_SPMV_ROW_SEG_DIAG_H
00008 
00009 #if !defined(INC_SPMV_H)
00010 typedef struct tagSparseMatrixCSR SparseMatrixCSR;
00011 #endif
00012 
00013 typedef struct tagSparseMatrixSegDiag
00014 {
00015   int start_pos, end_pos;   /* starting and ending row (col) position */
00016   int block_size;       /* diagonal unrolling factor */
00017   int n_diags;          /* no. of diagonals in this segment */
00018 
00019   /* assert: n_full*block_size + n_left == end_pos-start_pos+1 */
00020   int n_full;           /* # of full block rows */
00021   int n_left;           /* # of leftover rows */
00022 
00023   int *ind;         /* starting source (dest) vector index for each diagonal */
00024   double *val;          /* laid out by diagonal segments of length block_size */
00025 
00026   int *ind_left;
00027   double *val_left;
00028 } SparseMatrixSegDiag;
00029 
00030 typedef struct tagSparseMatrixRowSegDiag
00031 {
00032   int m, n;
00033   int nnz;
00034 
00035   int n_segs;
00036   SparseMatrixSegDiag *Segs;
00037 
00038 } SparseMatrixRowSegDiag;
00039 
00040 /* --------------------------------------------------------- */
00041 typedef void (*SPMV_DIAG_FP) (int, int, const int *,
00042                   const double *, const double *, double *);
00043 
00044 #define MAX_DIAGS 32
00045 extern SPMV_DIAG_FP spmvRSegDiagRoutines[MAX_DIAGS];
00046 /* --------------------------------------------------------- */
00047 
00048 extern void spmv_identify_rsegdiags (const SparseMatrixCSR * A,
00049                      double min_threshold,
00050                      double max_threshold, int *p_n_diags,
00051                      int **p_diag_inds);
00052 
00053 extern void spmv_convert_csr2rsegdiag (const SparseMatrixCSR * A,
00054                        int n_diags, const int *diag_inds,
00055                        int max_block_size,
00056                        SparseMatrixRowSegDiag * D);
00057 
00058 extern void spmv_convert_csr2rsegdiag_runs (const SparseMatrixCSR * A,
00059                         int min_run_len,
00060                         int max_block_size,
00061                         SparseMatrixRowSegDiag * D,
00062                         SparseMatrixCSR * A_left);
00063 
00064 extern void spmv_alloc_segdiag (SparseMatrixSegDiag * S,
00065                 int i_start, int num_rows, int b,
00066                 int n_diags);
00067 
00068 extern void spmv_alloc_rsegdiag (SparseMatrixRowSegDiag * D,
00069                  int m, int n, int n_segs);
00070 extern void spmv_destroy_rsegdiag (SparseMatrixRowSegDiag * D);
00071 
00072 extern void spmv_rsegdiag (const SparseMatrixRowSegDiag * D,
00073                const double *x, double *y);
00074 
00075 #endif
00076 
00077 /*
00078  *  $Log: spmv_rsegdiag.h,v $
00079  *  Revision 1.1.1.1  2005/06/29 22:07:52  rvuduc
00080  *  Initial import
00081  *
00082  *
00083  *  eof
00084  */

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