Browse Source

Fix comment grammar, some cosmetics

la-knuth
Christoph Ruegg 14 years ago
parent
commit
7f2b216fe2
  1. 6
      src/Numerics/LinearAlgebra/Complex/SparseVector.cs
  2. 6
      src/Numerics/LinearAlgebra/Complex32/SparseVector.cs
  3. 18
      src/Numerics/LinearAlgebra/Double/SparseVector.cs
  4. 6
      src/Numerics/LinearAlgebra/Single/SparseVector.cs
  5. 10
      src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs
  6. 16
      src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs

6
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))
{

6
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))
{

18
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))
{

6
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))
{

10
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<T> target,
int sourceIndex, int targetIndex, int count)
{
if (target == null)
{
throw new ArgumentNullException("target");
}
if (ReferenceEquals(this, target))
{
throw new NotSupportedException();

16
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
/// <remarks>WARNING: This method is not thread safe. Use "lock" with it and be sure to avoid deadlocks</remarks>
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))
{

Loading…
Cancel
Save