matrix determinant improved speed