In this exercise I am using Visual Studio 2019 and a modified version of the std_lib_facilities header found here.
Chapter 24 // Exercise 8
Animate the Gaussian elimination.
Honestly had no idea what he meant by this. I assumed just show the matrix being modified after each step?
Whilst doing this I had a look back at my slice function and even though it looks different to the one in Matrix.h it actually does the job! I had a google for C++ solutions on Gaussian Elimination and found this:
Which is way less code, however all that subscripting is hard to read. I prefer having the seperate function to scale, get the dot_product etc.; it's easier to read what's happening. Also, having to modify Bjarne's matrix code to work with vectors was an enjoyable challenge. I created some matrices to test with Bjarne's code from exercise 5 and this produces the same output.
I went into these 5 exercises on Gaussian elimination terrified because maths and whereas I still don't fully get what the point of it is, these exercises were a good lesson on not really needing to understand the bigger picture; just verify that the code is doing the correct thing and that I can read and understand the code.
No comments:
Post a Comment