Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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).

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions