diff --git a/src/Numerics/LinearAlgebra/Complex/SparseVector.cs b/src/Numerics/LinearAlgebra/Complex/SparseVector.cs index 4869d296..f568e086 100644 --- a/src/Numerics/LinearAlgebra/Complex/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Complex/SparseVector.cs @@ -1357,9 +1357,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex Array.Resize(ref _nonZeroIndices, size); } - // Move all values (with an position larger than index) in the value array + // Move all values (with a position larger than index) in the value array // to the next position - // Move all values (with an position larger than index) in the columIndices + // Move all values (with a position larger than index) in the columIndices // array to the next position for (var i = NonZerosCount - 1; i > itemIndex - 1; i--) { @@ -1386,7 +1386,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex NonZerosCount -= 1; - // Check if the storage needs to be shrink. This is reasonable to do if + // Check whether we need to shrink the arrays. This is reasonable to do if // there are a lot of non-zero elements and storage is two times bigger if ((NonZerosCount > 1024) && (NonZerosCount < _nonZeroIndices.Length / 2)) { diff --git a/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs b/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs index 80b6339b..b03a3be8 100644 --- a/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs @@ -1387,9 +1387,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 Array.Resize(ref _nonZeroIndices, size); } - // Move all values (with an position larger than index) in the value array + // Move all values (with a position larger than index) in the value array // to the next position - // Move all values (with an position larger than index) in the columIndices + // Move all values (with a position larger than index) in the columIndices // array to the next position for (var i = NonZerosCount - 1; i > itemIndex - 1; i--) { @@ -1416,7 +1416,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 NonZerosCount -= 1; - // Check if the storage needs to be shrink. This is reasonable to do if + // Check whether we need to shrink the arrays. This is reasonable to do if // there are a lot of non-zero elements and storage is two times bigger if ((NonZerosCount > 1024) && (NonZerosCount < _nonZeroIndices.Length / 2)) { diff --git a/src/Numerics/LinearAlgebra/Double/SparseVector.cs b/src/Numerics/LinearAlgebra/Double/SparseVector.cs index 709c224e..81afccc6 100644 --- a/src/Numerics/LinearAlgebra/Double/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Double/SparseVector.cs @@ -405,7 +405,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double var otherValue = otherSparse._nonZeroValues[j]; if (otherValue != 0.0) { - InsertAtUnchecked(i++, otherSparse._nonZeroIndices[j], otherValue); + InsertAtIndexUnchecked(i++, otherSparse._nonZeroIndices[j], otherValue); } j++; } @@ -551,7 +551,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double var otherValue = otherSparse._nonZeroValues[j]; if (otherValue != 0.0) { - InsertAtUnchecked(i++, otherSparse._nonZeroIndices[j], -otherValue); + InsertAtIndexUnchecked(i++, otherSparse._nonZeroIndices[j], -otherValue); } j++; } @@ -1371,7 +1371,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double // Item already exist at itemIndex if (value == 0.0) { - RemoveAtUnchecked(itemIndex); + RemoveAtIndexUnchecked(itemIndex); } else { @@ -1382,12 +1382,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double { if (value != 0.0) { - InsertAtUnchecked(~itemIndex, index, value); + InsertAtIndexUnchecked(~itemIndex, index, value); } } } - private void InsertAtUnchecked(int itemIndex, int index, double value) + private void InsertAtIndexUnchecked(int itemIndex, int index, double value) { // Check if the storage needs to be increased if ((NonZerosCount == _nonZeroValues.Length) && (NonZerosCount < Count)) @@ -1398,9 +1398,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double Array.Resize(ref _nonZeroIndices, size); } - // Move all values (with an position larger than index) in the value array + // Move all values (with a position larger than index) in the value array // to the next position - // Move all values (with an position larger than index) in the columIndices + // Move all values (with a position larger than index) in the columIndices // array to the next position for (var i = NonZerosCount - 1; i > itemIndex - 1; i--) { @@ -1416,7 +1416,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double NonZerosCount += 1; } - private void RemoveAtUnchecked(int itemIndex) + private void RemoveAtIndexUnchecked(int itemIndex) { // Value is zero. Let's delete it from Values and Indices array for (var i = itemIndex + 1; i < NonZerosCount; i++) @@ -1427,7 +1427,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double NonZerosCount -= 1; - // Check if the storage needs to be shrink. This is reasonable to do if + // Check whether we need to shrink the arrays. This is reasonable to do if // there are a lot of non-zero elements and storage is two times bigger if ((NonZerosCount > 1024) && (NonZerosCount < _nonZeroIndices.Length / 2)) { diff --git a/src/Numerics/LinearAlgebra/Single/SparseVector.cs b/src/Numerics/LinearAlgebra/Single/SparseVector.cs index 7b1c4e32..8fa7cd46 100644 --- a/src/Numerics/LinearAlgebra/Single/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Single/SparseVector.cs @@ -1431,9 +1431,9 @@ namespace MathNet.Numerics.LinearAlgebra.Single Array.Resize(ref _nonZeroIndices, size); } - // Move all values (with an position larger than index) in the value array + // Move all values (with a position larger than index) in the value array // to the next position - // Move all values (with an position larger than index) in the columIndices + // Move all values (with a position larger than index) in the columIndices // array to the next position for (var i = NonZerosCount - 1; i > itemIndex - 1; i--) { @@ -1460,7 +1460,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single NonZerosCount -= 1; - // Check if the storage needs to be shrink. This is reasonable to do if + // Check whether we need to shrink the arrays. This is reasonable to do if // there are a lot of non-zero elements and storage is two times bigger if ((NonZerosCount > 1024) && (NonZerosCount < _nonZeroIndices.Length / 2)) { diff --git a/src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs b/src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs index de2ef219..92b08994 100644 --- a/src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs @@ -84,11 +84,6 @@ namespace MathNet.Numerics.LinearAlgebra.Storage return; } - if (target == null) - { - throw new ArgumentNullException("target"); - } - if (Length != target.Length) { var message = string.Format(Resources.ArgumentMatrixDimensions2, Length, target.Length); @@ -118,11 +113,6 @@ namespace MathNet.Numerics.LinearAlgebra.Storage void CopySubVectorTo(DenseVectorStorage target, int sourceIndex, int targetIndex, int count) { - if (target == null) - { - throw new ArgumentNullException("target"); - } - if (ReferenceEquals(this, target)) { throw new NotSupportedException(); diff --git a/src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs b/src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs index 84d29680..50b77f7b 100644 --- a/src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs @@ -114,8 +114,8 @@ namespace MathNet.Numerics.LinearAlgebra.Storage Array.Resize(ref ColumnIndices, (int)size); } - // Move all values (with an position larger than index) in the value array to the next position - // move all values (with an position larger than index) in the columIndices array to the next position + // Move all values (with a position larger than index) in the value array to the next position + // move all values (with a position larger than index) in the columIndices array to the next position Array.Copy(Values, index, Values, index + 1, ValueCount - index); Array.Copy(ColumnIndices, index, ColumnIndices, index + 1, ValueCount - index); @@ -143,8 +143,8 @@ namespace MathNet.Numerics.LinearAlgebra.Storage /// WARNING: This method is not thread safe. Use "lock" with it and be sure to avoid deadlocks void RemoveAtIndexUnchecked(int itemIndex, int row) { - // Move all values (with an position larger than index) in the value array to the previous position - // move all values (with an position larger than index) in the columIndices array to the previous position + // Move all values (with a position larger than index) in the value array to the previous position + // move all values (with a position larger than index) in the columIndices array to the previous position Array.Copy(Values, itemIndex + 1, Values, itemIndex, ValueCount - itemIndex - 1); Array.Copy(ColumnIndices, itemIndex + 1, ColumnIndices, itemIndex, ValueCount - itemIndex - 1); @@ -156,7 +156,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage ValueCount -= 1; - // Check if the storage needs to be shrink. This is reasonable to do if + // Check whether we need to shrink the arrays. This is reasonable to do if // there are a lot of non-zero elements and storage is two times bigger if ((ValueCount > 1024) && (ValueCount < Values.Length / 2)) { @@ -241,8 +241,8 @@ namespace MathNet.Numerics.LinearAlgebra.Storage if (count > 0) { - // Move all values (with an position larger than index) in the value array to the previous position - // move all values (with an position larger than index) in the columIndices array to the previous position + // Move all values (with a position larger than index) in the value array to the previous position + // move all values (with a position larger than index) in the columIndices array to the previous position Array.Copy(Values, first + count, Values, first, ValueCount - first - count); Array.Copy(ColumnIndices, first + count, ColumnIndices, first, ValueCount - first - count); @@ -256,7 +256,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage } } - // Check if the storage needs to be shrink. This is reasonable to do if + // Check whether we need to shrink the arrays. This is reasonable to do if // there are a lot of non-zero elements and storage is two times bigger if ((ValueCount > 1024) && (ValueCount < Values.Length / 2)) {