I am new to solving PDEs, but have been looking at different implementations of finite difference and finite volume schemes. One thing I have noticed in different implementations is that some implementations use sparse matrices while other implementations--of the same algorithms--use basic loops.
I can understand that for some solvers, using a matrix is necessary, such as implicit solvers that have a linear solve step. Also, some of the confusion may stem from the fact that elliptic pdes are presented first. Since linear elliptic pdes are solved using differentiation matrices, this might explain some the attention on sparse matrices.
I was trying to understand which approach was more efficient--sparse matrices or basic loops? If the goal of practicing writing PDE solvers is to subsequently write codes for real problems, then I would like to learn best practices for writing efficient solvers.
Can anyone tell me which method, sparse matrices or loops, is more efficient method when dealing with larger problems with fine discretizations? Of larger problems we run into issues like breaking up the problem into separate pieces that can be parallelized. We also run into memory issues, etc. I have not seen any of these issues addressed in the simple demos I have found.
I am not sure if the specific language makes a difference, but I generally write in Julia.