Browse Source

Fixed bug pointed out by Andriy Bratiychuk

la-knuth
Marcus Cuda 17 years ago
parent
commit
3420d73995
  1. 2
      src/Numerics/LinearAlgebra/Double/DenseVector.cs
  2. 19
      src/UnitTests/LinearAlgebraTests/Double/DenseVectorTests.cs

2
src/Numerics/LinearAlgebra/Double/DenseVector.cs

@ -289,7 +289,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
CommonParallel.For(
0,
this.Data.Length,
index => this[index] = this.Data[index]);
index => target[index] = this.Data[index]);
}
else
{

19
src/UnitTests/LinearAlgebraTests/Double/DenseVectorTests.cs

@ -252,5 +252,24 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double
Assert.AreEqual(_data[i] / 2.0, vector[i]);
}
}
[Test]
[MultipleAsserts]
public void CanCopyToNonDenseVector()
{
var vector = new DenseVector(_data);
var other = new UserDefinedVector(_data.Length);
vector.CopyTo(other, 1,1,2);
Assert.AreEqual(vector[1], other[1]);
Assert.AreEqual(vector[2], other[2]);
vector.CopyTo(other);
for(var i = 0; i < vector.Count; i++)
{
Assert.AreEqual(vector[i], other[i]);
}
}
}
}

Loading…
Cancel
Save