lizfcm/notes/Nov-27.org

406 B

xk+1 = D-1(b - (L + U) x^k) xk + 1 → Ax^k

  loop while (err > tol && iter < maxiter) {
    for (int i = 0; i < n; i++) {
      sum = b[i];
      for (int j = 0; j < i; j++) {
        sum = sum - a[i][x] * x_0[i];
      }
      for (int j = i; j < n; j++) {
        sum = sum + a[i][j] * x_0[j];
      }
      x_1[i] = sum / a[i][i];
    }

    err = 0.0;
  }