refactor so core algorithm is agnostic to matrix data structure, now supplied by linear system solver