Jacobi iterative algorithm