add caching matrix solver
add some comments