Linear algebra for structured sparse matrices