Browse Source

LA: Fix arg validation bug in routine to copy a vector into a sub-row of a matrix

optimization-1
Christoph Ruegg 13 years ago
parent
commit
a803ebf44b
  1. 2
      src/Numerics/LinearAlgebra/Builder.cs
  2. 2
      src/Numerics/LinearAlgebra/Storage/VectorStorage.cs
  3. 10
      src/Numerics/LinearAlgebra/Vector.cs

2
src/Numerics/LinearAlgebra/Builder.cs

@ -1005,7 +1005,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
public Vector<T> SparseVectorOfIndexedEnumerable(int length, IEnumerable<Tuple<int, T>> enumerable)
public Vector<T> SparseVectorOfIndexed(int length, IEnumerable<Tuple<int, T>> enumerable)
{
return SparseVector(SparseVectorStorage<T>.OfIndexedEnumerable(length, enumerable));
}

2
src/Numerics/LinearAlgebra/Storage/VectorStorage.cs

@ -318,7 +318,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage
throw new ArgumentNullException("target");
}
ValidateSubRowRange(target, rowIndex, targetColumnIndex, sourceColumnIndex, columnCount);
ValidateSubRowRange(target, rowIndex, sourceColumnIndex, targetColumnIndex, columnCount);
CopyToSubRowUnchecked(target, rowIndex, sourceColumnIndex, targetColumnIndex, columnCount, skipClearing);
}

10
src/Numerics/LinearAlgebra/Vector.cs

@ -58,7 +58,7 @@ namespace MathNet.Numerics.LinearAlgebra
Count = storage.Length;
}
public static readonly Builder<T> Builder = BuilderInstance<T>.Instance;
public static readonly Builder<T> Build = BuilderInstance<T>.Instance;
/// <summary>
/// Gets the raw vector data storage.
@ -141,8 +141,8 @@ namespace MathNet.Numerics.LinearAlgebra
public Matrix<T> CreateMatrix(int rows, int columns)
{
return Storage.IsDense
? Builder.DenseMatrix(rows, columns)
: Builder.SparseMatrix(rows, columns);
? Build.DenseMatrix(rows, columns)
: Build.SparseMatrix(rows, columns);
}
/// <summary>
@ -153,8 +153,8 @@ namespace MathNet.Numerics.LinearAlgebra
public Vector<T> CreateVector(int size)
{
return Storage.IsDense
? Builder.DenseVector(size)
: Builder.SparseVector(size);
? Build.DenseVector(size)
: Build.SparseVector(size);
}
/// <summary>

Loading…
Cancel
Save