sarah said:
I'm trying to program a c++ matrix. can anybody help me?
Don't do this unless you are going for the educational experience. There are
many matrix libraries out there that you can use. It's by and large a waste
of resources to redo this. Also, it is _very_ hard to come up that can
compete with what is out there.
If you want to do this just because you want to learn, by all means, go
ahead. Start by writing some specs. Things to consider:
a) Do you want a linear algebra class or just a 2D-array like data
structure? (I will assume linear algebra from now on.)
b) Do you want a template or should it be just doubles?
c) Make a list of algorithms that you need to support eventually, e.g.:
- coefficient access
- operator<< and operator>>
- +, -, *
- row-reduction
- inversion
- block-matrix composition, extraction
- determinant
- transpose
- row/column extractors
(in this case, you should consider a companion class for vectors)
Before even starting to code your matrix class, write some test code, say
for operator<< and operator>>. Then implement your matrix class and make it
pass the tests.
Now add test code for addition. Implement addition in your class and make it
pass the test.
Go down your list and write some tests and then make your implementation
pass those tests.
If you run into problems, post a more specific question.
how can i attach the file to be programmed with this post?
Code to be discusses is just text and goes directly into the post.
Attachments are not needed.
Best
Kai-Uwe Bux