CS2141 Program Four

Due: 30 July 2010, at 11:59pm

As discussed elsewhere, matrices are used in a wide range of domains. For Program Three, you developed a martix capable of dealing with doubles, but what happens if you want to store long ints? Or bigints? Or complex numbers?

For this program, you'll be adapting your code from Program Three to take advantage of C++'s templating capabilities.

Goals

The goals of this assignment are:

Notice! This can be a very difficult assignment. Start early, and break your work into pieces so it's easier to handle.

Problem Description

For this project, you'll be upgrading your Martix class to use templating. Once you're done, you should be able to create a Matrix storing data of any type for which basic arthimetic and comparison are defined. We will be testing this using the Complex number class created in class.

As with Program Three, main() will be provided for you. The Complex class is also provided.

Input

There is no need for you to implement input as part of your matrix class, though you will not be penalized for doing so.

Ouput

The output should work as before, outputing values as appropriate to their type. (You can assume that << will deal correctly with outputing whatever type is provided.)

Code Requirements

Martix Class

The Matrix class should use templates to implement all of the functionality listed in Program 3, but it should also have the ability to contain any of the following types of values:

Main

int main() is provided for you in the file main.cpp. You should not make any changes to this file. It should, in fact, be possible for the grader to compile your program with a different version of main.cpp and have the new program compile and run.

Makefile

You will provide a Makefile that we can use to compile and run your program. It needs to include the rules for default, clean, and run (see the example here for details). Note that you will need to include main.cpp and complex.cpp in the Makefile.

Provided Code

A good deal of ready-made code can be found here including main.cpp, the Complex number class, and a makefile. Feel free to use these instead of writing your own.

If you with, you may also use the version of the Matrix class provided as the solution to Program 3 as the basis for your templated class. Note that unless your implementation has bugs, it is almost certainly easier to adapt your own code.

Source Files and Headers

The main function is, of course, implemented in main.cpp. Your class should be implemented in Matrix.h. (Remember that templates must be completely defined in a single file.) Other classes or functions should have appropriate header and source files.

Other Guidelines

Only the following functions and classes may be used (remember to add using namespace std;) though they are not required:

Hopefully Helpful Hints

Have fun, and remember that all the usual rules regarding cheating and cooperation are in full effect for this program.