Sparse Matrix Storage Lecture #3 EEE 574 Dr. Dan Tylavsky
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Apply BRR(C)O/U to the following matrix
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –It is common to take advantage of symmetry when storing numerically symmetric and incidence symmetric. –When matrices are not symmetric. Any complete representation (i.e., RR(C)U/O) can be used to store asymmetric matrices. –Let’s look at some additional complete storage schemes.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Knuth’s Storage: Used when fast access to elements by row and column is needed. Store indices to each element. Link row elements. Link column elements. Store initial row and column pointers.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Modified Knuth’s Storage: Less storage, but longer time needed for index determination. –Use Knuth’s method with the following changes. Eliminate RIndx & CIndx Arrays Replace row (col.) end link with negative row (col.) indices
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –To find (3,1) element: Scan Row 3 and list locations of all elements. Scan column 1 and list locations of all elements. The location which occurs in both lists must be A(3,1); otherwise the (3,1) entry is a zero.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –To find indices of Scan row associated with -23 until neg. row index occurs. Scan column associated with -23 until neg. col index occurs.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Teams: What is the (4,5) element of this matrix.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Teams: What are the row and column indices of the entry.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Teams: Construct the sparse matrix from the following (Modified Knuth) sparse storage scheme.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Comparison of Static and Dynamic Matrix Sotrage Schemes. Static - Number and location of nonzeros is known apriori. (Data structure set in symbolic program seg.) Dynamic - Number and location of non-zeros is a numerical function of the matrix data or is time varying.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky Advantages of Static and Dynamic Matrix Storage Static 1) Simple storage schemes. 2) Symbolic & numerical processing done separately. 3) Separable symbolic and numerical processing leads to code simpler to create, debug, maintain. Dynamic 1) Can be used where sparsity pattern is a function of numerical content. factorization of indefinite matrices. 2) Can be used where sparsity pattern is a function of time. evolution of a network topology under switching conditions.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky Disadvantages of Static and Dynamic Matrix Storage Static 1) Must know apriori: # of non-zero elements. Position of non-zero elements. Dynamic 1) Intertwining of numerical and symbolic segments leads to complex code creation, debugging and maintenance.
The End
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Teams: What is the (4,5) element of this matrix.
Sparse Matrix Storage © Copyright 1999 Daniel Tylavsky –Teams: Construct the sparse matrix from the following (Modified Knuth) sparse storage scheme.