/// <summary> /// returns the number of non-zero elements in the matrix on the current MPI process. /// </summary> /// <returns></returns> static public int GetTotalNoOfNonZerosPerProcess(this IMutableMatrixEx M) { int odnz = 0; var rowPart = M.RowPartitioning; int i0 = (int)rowPart.i0; for (int i = (int)(rowPart.i0 + rowPart.LocalLength - 1); i >= i0; i--) { odnz += M.GetNoOfNonZerosPerRow(i); } return(odnz); }
/// <summary> /// returns the maximum (over all locally stored rows) number of off-diagonal non-zero entries per row /// </summary> /// <returns></returns> static public int GetMaxNoOfNonZerosPerRow(this IMutableMatrixEx M) { int r = 0; var _RowPartiton = M.RowPartitioning; int i0 = (int)_RowPartiton.i0; for (int i = (int)(_RowPartiton.i0 + _RowPartiton.LocalLength - 1); i >= i0; i--) { r = Math.Max(M.GetNoOfNonZerosPerRow(i), r); } return(r); }