Representation of a sparse matrix, Data Structure & Algorithms

Let us assume a sparse matrix from storage view point. Assume that the entire sparse matrix is stored. Then, a significant amount of memory that stores the matrix consists of zeroes. It is nothing but wastage of memory. In real life, such wastage might count to megabytes. Thus, an efficient method of storing sparse matrices ought to be looked into.

Figure illustrates a sparse matrix of order 7 × 6.

 

 

0

 

1

 

2

 

3

 

4

 

5

 

0

 

0

 

0

 

0

 

5

 

0

 

0

 

1

 

0

 

4

 

0

 

0

 

0

 

0

 

2

 

0

 

0

 

0

 

0

 

9

 

0

 

3

 

0

 

3

 

0

 

2

 

0

 

0

 

4

 

1

 

0

 

2

 

0

 

0

 

0

 

5

 

0

 

0

 

0

 

0

 

0

 

0

 

6

 

0

 

0

 

8

 

0

 

0

 

0

 

Figure: Representation of a sparse matrix of order 7 × 6

A general way of representing non zero elements of any sparse matrix is the 3-tuple form. The primary row of sparse matrix always indicates the number of columns, the number of rows, & number of non zero elements in the matrix. The number seven represents the entire number of rows sparse matrix. Alike, in the matrix the number six represents the total number of columns. The number eight represents the overall number of non zero elements in the matrix. Each of non zero element is stored from the second row, along the 1st & 2nd elements of the row, mentioning the row number & column number respectively wherein the element is present in the original matrix. In this row the 3rd element stores the actual value of the non zero element. For instance, the 3- tuple representation of the matrix of Figure is illustrated in Figure

1382_Representation of a sparse matrix.png

Figure: tuple representation of above figure

The following program 1 accepts a matrix as input that is sparse & prints the corresponding 3-tuple representations.

Posted Date: 4/4/2013 6:34:22 AM | Location : United States







Related Discussions:- Representation of a sparse matrix, Assignment Help, Ask Question on Representation of a sparse matrix, Get Answer, Expert's Help, Representation of a sparse matrix Discussions

Write discussion on Representation of a sparse matrix
Your posts are moderated
Related Questions
When there is requirement to access records sequentially by some key value and also to access records directly by the similar key value, the collection of records may be organized

Q. A linear array A is given with lower bound as 1. If address of A[25] is 375 and A[30] is 390, then find address of A[16].

Using stacks, write an algorithm to determine whether the infix expression has balanced parenthesis or not Algorithm parseparens This algorithm reads a source program and

Q. Describe the term hashing. Explain any two usually used hash functions. Explain one method of collision resolution.

In file access: what is the difference between serial, sequential and indexed sequential searching


#quCreate a flowchart to show the process that will allow the implementation of Queue, Enqueue, and Dequeue operations.estion..

Q. Compare and contrast various sorting techniques or methods with respect to the memory space and the computing time.

Have you ever thought about the handling of our files in operating system? Why do we contain a hierarchical file system? How do files saved & deleted under hierarchical directories

Q. By making use of stacks, write an algorithm to determine whether the infix expression has balanced parenthesis or not.