ASSIGNMENT: MATRIX AND VECTOR CLASSES TOTAL MARKS: 50%
Objectives
1. To understand and demonstrate your ability to use classes, their constructors, and operator overloading in C++.
Matrix and Vector Classes
In this assignment, you will create Vector and Matrix classes, which can carry out basic array and 2D-array functionalities and the mathematical operations we expect from such objects. Additionally, you can add more advanced features.
- First, you must create the two classes in question and set up their data structure (privately).
- Write suitable constructors and destructors. You are asked to use the constructors you learned about, such as default, parametrised, copy and move.
- Create some sort of access operators: how would you solve that for the matrix?
- Advanced: Create a VectorView class to read individual rows of the matrix. Use this class to recreate the [ ][ ] syntax of standard multidimensional arrays.
- Create .size() and .resize() methods.
- Make some convenient filling functions, such as zero to zero, or the identity.
- Add other functions you feel your objects should have, such as .norm( ) and .transpose( ).
- Now it is time to overload the various arithmetic operators, +, -, * (/). How does this work with combined expressions? (a+b)*c
Deliverables:
You should submit your project as a Zip file on CANVAS. I am expecting
your project organised in multiple files for clarity, i.e., lib_matrix.hpp, lib_matrix.cpp, lib_vector.hpp,lib_vector.cpp, lib_vectorview.hpp,
lib_vectorview.cpp and main.cpp.
Once you have completed and tested your project on Replit, you can download your entire project as a Zip file, as shown in the following example:
No report is necessary, but the code must have comments to help it be readable.