From 515ebee32b1a40a7822f98e965bb8b81651f8b5e Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Mon, 14 Apr 2014 10:26:07 +0200 Subject: [PATCH] LA: vector storage copy zero-length subset should skip instead of fail --- .../LinearAlgebra/Storage/VectorStorage.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Numerics/LinearAlgebra/Storage/VectorStorage.cs b/src/Numerics/LinearAlgebra/Storage/VectorStorage.cs index ff924a63..7f54486d 100644 --- a/src/Numerics/LinearAlgebra/Storage/VectorStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/VectorStorage.cs @@ -278,6 +278,11 @@ namespace MathNet.Numerics.LinearAlgebra.Storage throw new ArgumentNullException("target"); } + if (count == 0) + { + return; + } + ValidateSubVectorRange(target, sourceIndex, targetIndex, count); CopySubVectorToUnchecked(target, sourceIndex, targetIndex, count, skipClearing); } @@ -318,6 +323,11 @@ namespace MathNet.Numerics.LinearAlgebra.Storage throw new ArgumentNullException("target"); } + if (columnCount == 0) + { + return; + } + ValidateSubRowRange(target, rowIndex, sourceColumnIndex, targetColumnIndex, columnCount); CopyToSubRowUnchecked(target, rowIndex, sourceColumnIndex, targetColumnIndex, columnCount, skipClearing); } @@ -343,6 +353,11 @@ namespace MathNet.Numerics.LinearAlgebra.Storage throw new ArgumentNullException("target"); } + if (rowCount == 0) + { + return; + } + ValidateSubColumnRange(target, columnIndex, sourceRowIndex, targetRowIndex, rowCount); CopyToSubColumnUnchecked(target, columnIndex, sourceRowIndex, targetRowIndex, rowCount, skipClearing); }