By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,222 Members | 1,395 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,222 IT Pros & Developers. It's quick & easy.

implemeting sparse and non-sparse matrixes

P: 8
hello to all.. i have a realy tough assignment which requires me to add, substract, multiply, and get inverse of non-sparse and sparse matrixes..

in a more clear way it wants me to to the operations listed above between two sparse, or non-sparse or a sparse and a non-sparse matrix..

for the operations an the matrixes of same kind, say sparse matrix, it seems rather easy .. but what makes me cobfuse is how to operate a sparse with a non-sparse..

and of course for both which data structure is the best? list, vector, array,.... ?

i will be very appreciated with any kind of help..

thanks..
Dec 7 '07 #1
Share this Question
Share on Google+
4 Replies


BigDaddyLH
Expert 100+
P: 1,216
but what makes me cobfuse is how to operate a sparse with a non-sparse..

and of course for both which data structure is the best? list, vector, array,.... ?
For your first point, does this give you any ideas?
Expand|Select|Wrap|Line Numbers
  1. interface Maxtrix {...}
  2.  
  3. class SparseMatrix implements Matrix {...}
  4.  
  5. class NonSparseMatrix implements Matrix{...}
As for implementing a SparseMatrix, was there no discussion in your class? May I suggest something that rhymes with bugle?
Dec 7 '07 #2

Expert 100+
P: 849
The standard data structure for matrices is a 2D array. You could probably use Vectors or ArrayLists without much trouble, but LinkedLists are not recommended because having to linearly access every element is going to kill your code's efficiency.

Do you understand how these operations are performed outside of a computer and can you write the algorithms to do so in psuedocode? If so, you can translate them into code from there.

EDIT: Ninja'd. Those would probably work too...
Dec 7 '07 #3

P: 8

As for implementing a SparseMatrix, was there no discussion in your class? May I suggest something that rhymes with bugle?
what dou you mean with the sentences i quoted.. ? at school it is never given a discussion how to solve assignments and in class we only focus on the strucuture or data structures rather than for implementation of what they are best suitable..

and what means "something taht rhymes with bugle"?
Dec 7 '07 #4

Expert 10K+
P: 11,448
and what means "something taht rhymes with bugle"?
Anglo Saxons can't rhyme but my guess is 'google' ;-)

kind regards,

Jos
Dec 7 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.