Add implementation for cached matrix solver.