Question: Coordinate list format (COO format) for sparse matrices stores a sequence of nonzero ele- ments as triples (row number, column number, value of the element).

 Coordinate list format (COO format) for sparse matrices stores a sequence

Coordinate list format (COO format) for sparse matrices stores a sequence of nonzero ele- ments as triples (row number, column number, value of the element). Two more compact representations of sparse matrices are known as Compressed Sparse Row (CSR) and Com pressed Sparse Column (CSC). The first, CSR, eliminates repeated row numbers of the COQO format, the second, CSC, eliminates the same column numbers in the COO format. Both use three one-dimensional arrays, R, C and V. For a matrix A v1 0 0 V2 U) 3 0 0 0 v its CSR representation is row index R:[2,4,7,8 column index C: 1,4,2,4,1,3,4,4 value array V:[v1, U2, V3, vA, v5, v6, vr, v8] Consecutive elements of K show the number of nonzero elements in the first row of A, in the first two rows of A, and so on. The column index C and the value array V store the column index (in A) and the value of consecutive nonzero elements, in the row order The CSC representation is similar, and for the above matrix A is: column index C: [2,3,4,8 row index R:[1,3,2,3,1,2,3,4 value array V: V1, v5, V3, Vs, U2, v4, V7, vs Write a Fortran subroutine CSRorCSC (R, C, V,n,nz) which converts the CSR representation of a sparse matrix to its CSC representation. Write also a Fortran program which enters a sparse matrix (in the COO format) and creates its CSR representation, invokes the CSRorCSC subroutine and outputs the result. Hint: A straightforward approach first expands the CSR format to the COO format, reorders the elements and compresses the column index to its CSC representation (stored in arrays R, an Note: The CSRorCSC subroutine can also be used for the conversion of the CSC format to its CSR equivalent. Coordinate list format (COO format) for sparse matrices stores a sequence of nonzero ele- ments as triples (row number, column number, value of the element). Two more compact representations of sparse matrices are known as Compressed Sparse Row (CSR) and Com pressed Sparse Column (CSC). The first, CSR, eliminates repeated row numbers of the COQO format, the second, CSC, eliminates the same column numbers in the COO format. Both use three one-dimensional arrays, R, C and V. For a matrix A v1 0 0 V2 U) 3 0 0 0 v its CSR representation is row index R:[2,4,7,8 column index C: 1,4,2,4,1,3,4,4 value array V:[v1, U2, V3, vA, v5, v6, vr, v8] Consecutive elements of K show the number of nonzero elements in the first row of A, in the first two rows of A, and so on. The column index C and the value array V store the column index (in A) and the value of consecutive nonzero elements, in the row order The CSC representation is similar, and for the above matrix A is: column index C: [2,3,4,8 row index R:[1,3,2,3,1,2,3,4 value array V: V1, v5, V3, Vs, U2, v4, V7, vs Write a Fortran subroutine CSRorCSC (R, C, V,n,nz) which converts the CSR representation of a sparse matrix to its CSC representation. Write also a Fortran program which enters a sparse matrix (in the COO format) and creates its CSR representation, invokes the CSRorCSC subroutine and outputs the result. Hint: A straightforward approach first expands the CSR format to the COO format, reorders the elements and compresses the column index to its CSC representation (stored in arrays R, an Note: The CSRorCSC subroutine can also be used for the conversion of the CSC format to its CSR equivalent

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!