+ diff < 2*tolerance);
+
+
+pcgm_simple = simple_preconditioned_cgm(A, M, b, x0, tolerance, max_iterations);
+diff = norm(pcgm_simple - pcgm, 'inf');
+
+unit_test_equals("PCGM agrees with Simple PCGM when M != I", ...
+ true, ...
+ diff < 2*tolerance);
+
+
+# Test again Octave's pcg() function.
+for n = [ 5, 10, 25, 50, 100 ]
+ A = random_positive_definite_matrix(5, 1000);
+ C = random_positive_definite_matrix(5, 1000);
+ M = C*C';
+
+ # Assumed by Octave's implementation when you don't supply a
+ # preconditioner.
+ x0 = zeros(5, 1);
+ b = unifrnd(-1000, 1000, 5, 1);
+ [o_x, o_flag, o_relres, o_iter] = pcg(A, b, tolerance, max_iterations, C, C');
+ [x, k] = preconditioned_conjugate_gradient_method(A,
+ M,
+ b,
+ x0,
+ tolerance,
+ max_iterations);
+ diff = norm(o_x - x, 'inf');
+ msg = sprintf("Our PCGM agrees with Octave's, n=%d.", n);
+ unit_test_equals(msg, true, diff < 2*tolerance);
+end