Well, this one has me stumped- I have code that... well, works. Other than some segfault. Using Code::Blocks, I managed to determine that the segfault happens when a constructor for the class Matrix is called.
Except in no case of the function set_matrix is that constructor called.
Worse yet, the segfault happens upon the exit of the constructor- the rest of it works fine. I honestly have no idea what is going on here. The issue is when I call graph.set_matrix(Matrix). The odd part is, the constructor where the segfault is happening (in the constructor for Matrix when passed another Matrix object) doesn't cause a segfault in normal applications- hell, it works fine. So the constructor isn't the issue. Only the function call causes the fault- and I can't discern why the function is even calling the constructor.
Thanks for being rude, but the problem is resolved- I'm just going to install an external library that would do a better job.
And I know how to use a debugger. It hit the segfault at the end of the constructor- it never reached the assignment operand. Sorry that I haven't been doing this for 20 years and know the ins and outs of every single debugger. No need to be so rude about it.
Using the power invested into my debugger, I bestow upon you the line number 63 of the third code section above. That's what's causing your segfault. A bit short on time though so haven't looked at why. I'll leave that to you. ;)
Yeah, I realized that for what I'm doing, there are already much better libraries out there. Eigen, for instance, has the exact thing I was looking for- the ability to create a matrix where the dimensions aren't known on compile time, but can be set when created. Sure, I could just dynamically allocate, but that tends to be much sloppier. So, I'll be sticking with Eigen for the matrix stuff- hopefully they include things such as kernels and dimensions of said kernels.