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.
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)
.
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*").
pa5.zip
that contains
just Vector.hpp
and Matrix.hpp
using Autolab.
Since you have been provided with documented skeletons of the two classes, your documentation will not be assessed.
Copyright 2020