void CopyTo(DenseColumnMajorMatrixStorage <T> target, bool skipClearing) { if (RowCount != target.RowCount || ColumnCount != target.ColumnCount) { var message = string.Format(Resources.ArgumentMatrixDimensions2, RowCount + "x" + ColumnCount, target.RowCount + "x" + target.ColumnCount); throw new ArgumentException(message, "target"); } if (!skipClearing) { target.Clear(); } if (ValueCount != 0) { for (int row = 0; row < RowCount; row++) { var startIndex = RowPointers[row]; var endIndex = row < RowPointers.Length - 1 ? RowPointers[row + 1] : ValueCount; for (var j = startIndex; j < endIndex; j++) { target.At(row, ColumnIndices[j], Values[j]); } } } }
void CopyToUnchecked(DenseColumnMajorMatrixStorage <T> target, bool skipClearing) { if (!skipClearing) { target.Clear(); } if (ValueCount != 0) { for (int row = 0; row < RowCount; row++) { var startIndex = RowPointers[row]; var endIndex = RowPointers[row + 1]; for (var j = startIndex; j < endIndex; j++) { target.At(row, ColumnIndices[j], Values[j]); } } } }