Recognition and computations of matrix rings