Fixed the problem with gauss-jacobi...
Lesson learned: Don't listen to the book for algorithm derivations