Updating matrix operations to multidimensional arrays.