Sparse Matrix /*******************************************************************************/ #include<stdio.h> void read_sparsemat(int mat_normal[100][100],int r,int c) { int i=0,j=0; for(i=0;i<r;i++) { for(j=0;j<c;j++) { scanf("%d",&mat_normal[i][j]); } } } void print_sparsemat(int mat_normal[100][100],int r,int c) { int i=0,j=0; for(i=0;i<r;i++) { printf("\n"); for(j=0;j<c;j++) { printf("%d ",mat_normal[i][j]); } } } void print_tuple(int mat_tup[100][3],int tr) { int i,j; printf("\nrows--- columns--- values"); for(i=0;i<tr;i++) { printf("\n"); for(j=0;j<3;j++) { printf("%d\t",mat_tup[i][j]); } } } int conv_tuple(int mat_normal[100][100],int r,int c,int mat_tup[100][3]) { //sparse to Tuple Form Conversion
Comments
Post a Comment