private double[] GetRHS(double[] OpAffine, BlockMsrMatrix M) { List <int> Rows2Keep = new List <int>(); for (int iRow = 0; iRow < M.RowPartitioning.LocalLength; iRow++) { int Row = iRow + M.RowPartitioning.i0; Debug.Assert(M.RowPartitioning.IsInLocalRange(Row)); if (M.GetNoOfNonZerosPerRow(Row) != 0) { Rows2Keep.Add(iRow); } } var rArr = Rows2Keep.ToArray(); List <double> RHS = new List <double>(); for (int i = 0; i < rArr.Length; i++) { RHS.Add(OpAffine[rArr[i]]); } return(RHS.ToArray()); }