469,270 Members | 1,732 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

implemeting sparse and non-sparse matrixes

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
4 1812
BigDaddyLH
1,216 Expert 1GB
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
Laharl
849 Expert 512MB
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

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
JosAH
11,448 Expert 8TB
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.

Similar topics

3 posts views Thread by Mario | last post: by
25 posts views Thread by Yves Glodt | last post: by
32 posts views Thread by Adrian Herscu | last post: by
8 posts views Thread by Bern McCarty | last post: by
14 posts views Thread by Patrick Kowalzick | last post: by
399 posts views Thread by =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.