Implement matrix inverse with solution cache