diff --git a/lib/linalg/Matrix.cpp b/lib/linalg/Matrix.cpp index c3c06b61e..1932e1440 100644 --- a/lib/linalg/Matrix.cpp +++ b/lib/linalg/Matrix.cpp @@ -1839,24 +1839,18 @@ Matrix::rescale_rows_max() for (int i = 0; i < d_num_rows; i++) { // Find the row's max absolute value. - double local_max = fabs(item(i, 0)); + double row_max = fabs(item(i, 0)); for (int j = 1; j < d_num_cols; j++) { - if (fabs(item(i, j)) > local_max) - local_max = fabs(item(i, j)); + if (fabs(item(i, j)) > row_max) + row_max = fabs(item(i, j)); } - // Get the max of all processes, if applicable. - double global_max = local_max; - if (d_num_procs > 1) - MPI_Allreduce(&local_max, &global_max, 1, MPI_DOUBLE, MPI_MAX, - MPI_COMM_WORLD); - // Rescale every row entry, if max nonzero. - if (global_max > 1.0e-14) + if (row_max > 1.0e-14) { for (int j = 0; j < d_num_cols; j++) - item(i, j) /= global_max; + item(i, j) /= row_max; } } }