How to speed up my sparse matrix solver?
问题 I'm writing a sparse matrix solver using the Gauss-Seidel method. By profiling, I've determined that about half of my program's time is spent inside the solver. The performance-critical part is as follows: size_t ic = d_ny + 1, iw = d_ny, ie = d_ny + 2, is = 1, in = 2 * d_ny + 1; for (size_t y = 1; y < d_ny - 1; ++y) { for (size_t x = 1; x < d_nx - 1; ++x) { d_x[ic] = d_b[ic] - d_w[ic] * d_x[iw] - d_e[ic] * d_x[ie] - d_s[ic] * d_x[is] - d_n[ic] * d_x[in]; ++ic; ++iw; ++ie; ++is; ++in; } ic +=