The specialized Thomas algorithm (Project 1)

Operation Floating Point
Memory Reads \( 6(N-2) \)
Memory Writes \( 2(N-2) \)
Additions \( 2(N-2) \)
Divisions \( 2(N-2) \)

      // Forward substitution cannot be vectorized
      for (int i = 2; i < n; i++) b[i] = b[i] + b[i-1]/d[i-1];
      // Backward substitution  cannot be vectorized
      solution[n-1] = b[n-1]/d[n-1];
      for (int i = n-2; i > 0; i--) solution[i] = (b[i]+solution[i+1])/d[i];