Updated methods - check for matrix type, check if cached inverse belongs to source matrix