JMU CS488 - Computer Graphics Applications
Help Policies Solutions Study-Aids Syllabus Tools
Programming Assignment 5


1 Overview

Your Matrix and Vector classes from programming assignment 4 are adequate but will be somewhat difficult to work with for the rest of the semester. In particular, until you become familiar with computer graphics, you are likely to make mistakes involving the dimensionality of various vectors and matrices and your current implementation of these classes will not "catch" those mistakes at compile-time. Hence, the purpose of this assignment is to use templates to create Vector and Matrix objects that can be checked for dimensional mismatches at compile-time.

This assignment is about templates in C++. It does not use any new topics from our study of vector/matrix arithmetic.

2 Detailed Specification

The specifications for the classes in this assignment are available as "skeletons". That is, you are being provided with partial implementations of the classes that do not contain bodies. Your final implementation must conform to the documentation in these skeletons.

Note that the Matrix template now uses statically allocated memory rather than dynamically allocated memory (since the size of the Matrix is known at compile time).

Also note that the Matrix template now includes a setValues(Matrix) method that should be used in operator=(Matrix).

3 A Development Strategy

You should be able to copy a significant amount of code from your solutions to programming assignment 4 into the skeletons.

4 Compile-Time Testing

In addition to the run-time tests, you must ensure that dimensional mismatches are caught at compile-time. For example, given the declarations and initializations:
      Matrix<2,2> A;      
      Matrix<2,3> B;

      A = {5,1,
           8,9};

      B = {2,7,0,
           3,4,6};
  

The operation B*A should generate a compile-time error (something like "No match for operator*").

5 Submission

You must submit a file named pa5.zip that contains just Vector.hpp and Matrix.hpp using Autolab.

6 Grading

Points will be awarded as follows:

Since you have been provided with documented skeletons of the two classes, your documentation will not be assessed.

7 If You Have Trouble Compiling Aginst the Official Tests

You should try to test your code on your own. However, if you have trouble compiling against the official tests when submitting, you can use the following tests to see what's going on.

8 If You Have Trouble With the Determinant

You should try and implement the code necessary to calculate the determinant on your own, but, because of the recursive nature of the calculation and the way we are using templates, you may have trouble. If you do, after a sufficient amount of struggling, you may use the following implementation.

Copyright 2020