As you can see I'm clearly changing an element of the matrix but this will not throw a "compile-time" error as I'm not changing any of the classes members. However I wish it would bring up some kind of compiler error. How can I do this?
operator() const; should not return a reference to one of it's doubles; just make it return a normal double (a copy, as firedraco said.) Then create another operator() that isn't const that returns a reference to it's double.