Cached solve()

Functions to cache solve() computation on matrices.