MatLab
To begin, this project requires knowledge of matrices and operations on matrices. So it would be best to review your knowledge of matrices before starting this project. While there isn’t much many difficult matrix operations to do, there are a few that should be looked at: transpose, matrix multiplication, identity matrix, and triangles. The internet is always a good source of information.
There is no input for this project which is a good thing. There doesn’t need to be a focus on reading and writing data. This however puts a bigger emphasis on unit tests since they will be the only way to verify that the code works correctly. Since “typically” most people have a small set of unit tests and a large input file with all of the real testing done by running this through. So it is highly advisable to write more tests than are necessary. Testing edge cases such as a matrix of 1X1 is advisable, matrices with more columns than rows, more rows than columns and square matrices are the best tests that should be run on each function.
The best place to start other than a review of matrices would be to read up on the MatLab documentation on their website since the goal is to reverse engineer the functions of MatLab. MatLab has many examples and the way that they are to be used.
See this for an example on matrix multiplication.
See diag for an example on the function diag.
There are many more functions are described in the MatLab documentation and should be followed more closely than what some other sources say because of the reverse engineering aspect of this project.
Most of the functions are not really able to be improved upon in time complexity beyond N*N do to the nature of matrices. There are a some that don’t run in N*N but for the most part there isn’t a lot to do to optimize it. One of the things to take notice of is that it is possible to copy code over when dealing with some matrix operations. And by changing the rows and columns around then it is possible to do this copying. But it should be taken notice that by doing so it is easily possible to start accessing data from memory that you should not be accessing and get junk values.
As noted, this project is not isn’t to difficult in terms of algorithm design. But it is the getting use to dealing with vectors and how a vector of vectors works and dealing with typedefs and name spaces, and the operator definitions. Which I might add, in the unit tests, “using namespace ml” will make it compile more sweetly and let the operators work.