Sparse linear solvers in C?

I'm working on translating a discontinuous Galerkin code from MATLAB to C and I'm at the final point where I need to solve a sparse system. I've taken a course in C before but I'm very rusty and wasn't all that good to begin with.

I've used LAPACK before but was wondering if there are better options out there. My professor uses PetSc but I was looking at the documentation and have no idea how to install it let alone use it. The "tutorial" section on the ANL site is written at a pretty high level already.

Also, for sparse solvers in C, is there a "special way" that the array has to be stored? Or can I just input my arrays as is into the solver and get the solution?

Here's a plot of the matrix structure

• Unfortunately not. I've uploaded a plot of the matrix structure to the original post Nov 19, 2013 at 18:17
• @hardmath Please stop perpetuating that misconception. The "banded solvers" are for bands that are within a constant of the diagonal, where as PDE bands are a mesh-dependent distance from the diagonal. Using a banded solver for a PDE problem gives much worse performance and asymptotics than multifrontal methods, though (algebraic) multigrid may be better yet. This topic has been covered repeatedly on this site, e.g., scicomp.stackexchange.com/q/866 scicomp.stackexchange.com/a/869 scicomp.stackexchange.com/a/880 . Nov 20, 2013 at 6:24
• PETSc has a MATLAB interface, which may or may not be useful to you, depending on why you're converting the code to C. Nov 20, 2013 at 9:45
• @hardmath Yes, and if the OP looks for "banded storage", they'll end up with totally inappropriate methods. The good methods for the OP's problem (a PDE in more than one dimension) do not "take advantage" of banding. Nov 20, 2013 at 15:20
• @JedBrown: If it suits you, I've deleted my Comments. I wanted to elicit what kind of sparsity user1799323 is working with. Bear in mind the his elegant graphic was posted in response to my Comment.
– hardmath
Nov 20, 2013 at 15:49