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
Implementation of Stack :- Stacks can be executed in the 2 ways: a)  Arrays b)  Linked List

Explain in brief about the Container An entity which holds finitely many other entities. Just as containers such as boxes, baskets, bags, pails, cans, drawers, and so for

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 zeroe

. Create a decision table that describes the movement of inventory

data structure for multiqueue

how to convert 12 hour format into 24 hour format using c program

You will write functions for both addition and subtraction of two numbers encoded in your data structure. These functions should not be hard to write. Remember how you add and subt

In a doubly linked list, also called as 2 way list, each node is divided into 3 parts. The first part is called previous pointer field. It contains the address of the preceding

What is Efficiency of algorithm? Efficiency of an algorithm can be precisely explained and investigated with mathematical rigor.  There are two types of algorithm efficiency

Explain th term input and output-  Pseudocode Input and output indicated by the use of terms input number, print total, output total, print "result is" x and so on.