1. Home >
  2. Apps >
  3. Groups >

Sparse Matrix

Question asked by rama_krish627 in #Coffee Room on Nov 18, 2008
rama_krish627
rama_krish627 路 Nov 18, 2008
Rank D2 - MASTER
Hi
Can any one tell me how to represent a Sparse Matrix using arrays.
and also how to add two sparse matrices.😲 Posted in: #Coffee Room
manupep
manupep 路 Nov 18, 2008
Rank D3 - MASTER
sparse matrix is a matrix contain large no of elements but most of them are zeros("0") . So inorder to save the memory utilization we are not storing the zeros, only othr elements. Any sparse matrix has only 3 colums . but the row number depends on the number of non-zero elements.

format is



-------------------------------
eg:

3 0
0 8 reprents in sparse form as

0 0 3
1 1 8

I cant explain the whole procedure of adding becz i'min office now

first you make sure that order of 3 matx are same. then sameposition elements should be added and make the resultant. I think u can able to make the logic.
komputergeek
komputergeek 路 Nov 19, 2008
Rank C2 - EXPERT
//Addition

k=n2;
for(i=0;iThis is just a logic.I haven't compiled the code.So expect errors in it 馃槑
Let me know if it works.
niraj.kumar
niraj.kumar 路 Nov 20, 2008
Rank D1 - MASTER
just want to add ... the purpose of sparse matrix is 2 save memory and it is used when you have few information is a big space. So to preserve the memory we use sparse matrix
rama_krish627
rama_krish627 路 Nov 21, 2008
Rank D2 - MASTER
ok fine I understood what it is.

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up