void CopySubMatrixTo(DiagonalMatrixStorage <T> target,
                             int sourceRowIndex, int targetRowIndex, int rowCount,
                             int sourceColumnIndex, int targetColumnIndex, int columnCount)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            if (ReferenceEquals(this, target))
            {
                throw new NotSupportedException();
            }

            if (sourceRowIndex - sourceColumnIndex != targetRowIndex - targetColumnIndex)
            {
                if (Data.Any(x => !_zero.Equals(x)))
                {
                    throw new NotSupportedException();
                }

                target.Clear(targetRowIndex, rowCount, targetColumnIndex, columnCount);
                return;
            }

            ValidateSubMatrixRange(target,
                                   sourceRowIndex, targetRowIndex, rowCount,
                                   sourceColumnIndex, targetColumnIndex, columnCount);

            var beginInclusive = Math.Max(sourceRowIndex, sourceColumnIndex);
            var endExclusive   = Math.Min(sourceRowIndex + rowCount, sourceColumnIndex + columnCount);

            if (endExclusive > beginInclusive)
            {
                var beginTarget = Math.Max(targetRowIndex, targetColumnIndex);
                Array.Copy(Data, beginInclusive, target.Data, beginTarget, endExclusive - beginInclusive);
            }
        }
        void CopySubMatrixToUnchecked(DiagonalMatrixStorage <T> target,
                                      int sourceRowIndex, int targetRowIndex, int rowCount,
                                      int sourceColumnIndex, int targetColumnIndex, int columnCount)
        {
            if (sourceRowIndex - sourceColumnIndex != targetRowIndex - targetColumnIndex)
            {
                if (Data.Any(x => !Zero.Equals(x)))
                {
                    throw new NotSupportedException();
                }

                target.Clear(targetRowIndex, rowCount, targetColumnIndex, columnCount);
                return;
            }

            var beginInclusive = Math.Max(sourceRowIndex, sourceColumnIndex);
            var endExclusive   = Math.Min(sourceRowIndex + rowCount, sourceColumnIndex + columnCount);

            if (endExclusive > beginInclusive)
            {
                var beginTarget = Math.Max(targetRowIndex, targetColumnIndex);
                Array.Copy(Data, beginInclusive, target.Data, beginTarget, endExclusive - beginInclusive);
            }
        }