473,372 Members | 1,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

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 2043
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

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

Similar topics

5
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence...
3
by: Mario | last post by:
Hello, I couldn't find a solution to the following problem (tried google and dejanews), maybe I'm using the wrong keywords? Is there a way to open a file (a linux fifo pipe actually) in...
25
by: Yves Glodt | last post by:
Hello, if I do this: for row in sqlsth: ________pkcolumns.append(row.strip()) ________etc without a prior:
32
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
14
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
11
by: ypjofficial | last post by:
Hello All, So far I have been reading that in case of a polymorphic class ( having at least one virtual function in it), the virtual function call get resolved at run time and during that the...
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
0
by: amitvps | last post by:
Secure Socket Layer is very important and useful for any web application but it brings some problems too with itself. Handling navigation between secure and non-secure pages is one of the cumbersome...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.