Browse Source

LA: Generic Vector: Extract BCL interfaces to partial class

pull/98/head
Christoph Ruegg 14 years ago
parent
commit
e5bed3c158
  1. 67
      src/Numerics/LinearAlgebra/Complex/SparseVector.cs
  2. 67
      src/Numerics/LinearAlgebra/Complex32/SparseVector.cs
  3. 67
      src/Numerics/LinearAlgebra/Double/SparseVector.cs
  4. 260
      src/Numerics/LinearAlgebra/Generic/Vector.BCL.cs
  5. 300
      src/Numerics/LinearAlgebra/Generic/Vector.cs
  6. 67
      src/Numerics/LinearAlgebra/Single/SparseVector.cs
  7. 6
      src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs
  8. 53
      src/Numerics/LinearAlgebra/Storage/SparseVectorStorage.cs
  9. 1
      src/Numerics/Numerics.csproj
  10. 3
      src/Portable/Portable.csproj
  11. 2
      src/UnitTests/LinearAlgebraTests/Complex/VectorTests.cs
  12. 2
      src/UnitTests/LinearAlgebraTests/Complex32/VectorTests.cs
  13. 2
      src/UnitTests/LinearAlgebraTests/Double/VectorTests.cs
  14. 2
      src/UnitTests/LinearAlgebraTests/Single/VectorTests.cs

67
src/Numerics/LinearAlgebra/Complex/SparseVector.cs

@ -1225,73 +1225,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
#endregion
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">
/// An object to compare with this object.
/// </param>
/// <returns>
/// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(Vector<Complex> other)
{
// Reject equality when the argument is null or has a different length.
if (other == null)
{
return false;
}
if (Count != other.Count)
{
return false;
}
// Accept if the argument is the same object as this.
if (ReferenceEquals(this, other))
{
return true;
}
var otherSparse = other as SparseVector;
if (otherSparse == null)
{
return base.Equals(other);
}
int i = 0, j = 0;
while (i < _storage.ValueCount || j < otherSparse._storage.ValueCount)
{
if (j >= otherSparse._storage.ValueCount || i < _storage.ValueCount && _storage.Indices[i] < otherSparse._storage.Indices[j])
{
if (_storage.Values[i++] != Complex.Zero)
{
return false;
}
continue;
}
if (i >= _storage.ValueCount || j < otherSparse._storage.ValueCount && otherSparse._storage.Indices[j] < _storage.Indices[i])
{
if (otherSparse._storage.Values[j++] != Complex.Zero)
{
return false;
}
continue;
}
if (!_storage.Values[i].AlmostEqual(otherSparse._storage.Values[j]))
{
return false;
}
i++;
j++;
}
return true;
}
/// <summary>
/// Returns an <see cref="IEnumerator{T}"/> that contains the position and value of the element.
/// </summary>

67
src/Numerics/LinearAlgebra/Complex32/SparseVector.cs

@ -1225,73 +1225,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
#endregion
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">
/// An object to compare with this object.
/// </param>
/// <returns>
/// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(Vector<Complex32> other)
{
// Reject equality when the argument is null or has a different length.
if (other == null)
{
return false;
}
if (Count != other.Count)
{
return false;
}
// Accept if the argument is the same object as this.
if (ReferenceEquals(this, other))
{
return true;
}
var otherSparse = other as SparseVector;
if (otherSparse == null)
{
return base.Equals(other);
}
int i = 0, j = 0;
while (i < _storage.ValueCount || j < otherSparse._storage.ValueCount)
{
if (j >= otherSparse._storage.ValueCount || i < _storage.ValueCount && _storage.Indices[i] < otherSparse._storage.Indices[j])
{
if (_storage.Values[i++] != Complex32.Zero)
{
return false;
}
continue;
}
if (i >= _storage.ValueCount || j < otherSparse._storage.ValueCount && otherSparse._storage.Indices[j] < _storage.Indices[i])
{
if (otherSparse._storage.Values[j++] != Complex32.Zero)
{
return false;
}
continue;
}
if (!_storage.Values[i].AlmostEqual(otherSparse._storage.Values[j]))
{
return false;
}
i++;
j++;
}
return true;
}
/// <summary>
/// Returns an <see cref="IEnumerator{T}"/> that contains the position and value of the element.
/// </summary>

67
src/Numerics/LinearAlgebra/Double/SparseVector.cs

@ -1277,73 +1277,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double
#endregion
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">
/// An object to compare with this object.
/// </param>
/// <returns>
/// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(Vector<double> other)
{
// Reject equality when the argument is null or has a different length.
if (other == null)
{
return false;
}
if (Count != other.Count)
{
return false;
}
// Accept if the argument is the same object as this.
if (ReferenceEquals(this, other))
{
return true;
}
var otherSparse = other as SparseVector;
if (otherSparse == null)
{
return base.Equals(other);
}
int i = 0, j = 0;
while (i < _storage.ValueCount || j < otherSparse._storage.ValueCount)
{
if (j >= otherSparse._storage.ValueCount || i < _storage.ValueCount && _storage.Indices[i] < otherSparse._storage.Indices[j])
{
if (_storage.Values[i++] != 0d)
{
return false;
}
continue;
}
if (i >= _storage.ValueCount || j < otherSparse._storage.ValueCount && otherSparse._storage.Indices[j] < _storage.Indices[i])
{
if (otherSparse._storage.Values[j++] != 0d)
{
return false;
}
continue;
}
if (!_storage.Values[i].AlmostEqual(otherSparse._storage.Values[j]))
{
return false;
}
i++;
j++;
}
return true;
}
/// <summary>
/// Returns an <see cref="IEnumerator{T}"/> that contains the position and value of the element.
/// </summary>

260
src/Numerics/LinearAlgebra/Generic/Vector.BCL.cs

@ -0,0 +1,260 @@
// <copyright file="Vector.BCL.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2010 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using System.Collections;
using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Generic
{
public abstract partial class Vector<T> :
#if PORTABLE
IList, IList<T>
#else
IList, IList<T>, ICloneable
#endif
{
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns>
/// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>.
/// </returns>
public bool Equals(Vector<T> other)
{
return other != null && Storage.Equals(other.Storage);
}
/// <summary>
/// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
/// </summary>
/// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj)
{
var other = obj as Vector<T>;
return other != null && Storage.Equals(other.Storage);
}
/// <summary>
/// Returns a hash code for this instance.
/// </summary>
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// </returns>
public override int GetHashCode()
{
return Storage.GetHashCode();
}
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return ToString(null, null);
}
#if !PORTABLE
#region ICloneable
/// <summary>
/// Creates a new object that is a copy of the current instance.
/// </summary>
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
object ICloneable.Clone()
{
return Clone();
}
#endregion
#endif
int IList<T>.IndexOf(T item)
{
for (int i = 0; i < Count; ++i)
{
if (this[i].Equals(item))
return i;
}
return -1;
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
bool ICollection<T>.IsReadOnly
{
get { return false; }
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
// Do NOT convert this loop to LINQ (since LINQ would redirect to this very method)!
foreach (var x in this)
{
if (x.Equals(item))
return true;
}
return false;
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
Storage.CopySubVectorTo(new DenseVectorStorage<T>(array.Length, array), 0, arrayIndex, Count);
}
bool IList.IsReadOnly
{
get { return false; }
}
bool IList.IsFixedSize
{
get { return true; }
}
object IList.this[int index]
{
get { return Storage[index]; }
set { Storage[index] = (T)value; }
}
int IList.IndexOf(object value)
{
if (!(value is T))
{
return -1;
}
return ((IList<T>)this).IndexOf((T)value);
}
bool IList.Contains(object value)
{
if (!(value is T))
{
return false;
}
return ((ICollection<T>)this).Contains((T)value);
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
bool ICollection.IsSynchronized
{
get { return false; }
}
object ICollection.SyncRoot
{
get { return null; }
}
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
if (array.Rank != 1)
{
throw new ArgumentException(Resources.ArgumentSingleDimensionArray, "array");
}
Storage.CopySubVectorTo(new DenseVectorStorage<T>(array.Length, (T[])array), 0, index, Count);
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
/// </returns>
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

300
src/Numerics/LinearAlgebra/Generic/Vector.cs

@ -3,7 +3,9 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2010 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
@ -12,8 +14,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -41,11 +45,11 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
/// </summary>
/// <typeparam name="T">Supported data types are double, single, <see cref="Complex"/>, and <see cref="Complex32"/>.</typeparam>
[Serializable]
public abstract class Vector<T> :
public abstract partial class Vector<T> :
#if PORTABLE
IFormattable, IEnumerable<T>, IEquatable<Vector<T>>, IList, IList<T>
IFormattable, IEnumerable<T>, IEquatable<Vector<T>>
#else
IFormattable, IEnumerable<T>, IEquatable<Vector<T>>, IList, IList<T>, ICloneable
IFormattable, IEnumerable<T>, IEquatable<Vector<T>>
#endif
where T : struct, IEquatable<T>, IFormattable
{
@ -1348,44 +1352,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
#endregion
#region Implemented Interfaces
#if !PORTABLE
#region ICloneable
/// <summary>
/// Creates a new object that is a copy of the current instance.
/// </summary>
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
object ICloneable.Clone()
{
return Clone();
}
#endregion
#endif
#region IEnumerable
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
/// </returns>
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
#endregion
#region IEnumerable<T>
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
@ -1400,8 +1366,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
}
}
#endregion
/// <summary>
/// Returns an <see cref="IEnumerator{T}"/> that contains the position and value of the element.
/// </summary>
@ -1424,52 +1388,8 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
}
}
#region IEquatable<Vector>
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">
/// An object to compare with this object.
/// </param>
/// <returns>
/// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>.
/// </returns>
public virtual bool Equals(Vector<T> other)
{
// Reject equality when the argument is null or has a different length.
if (other == null)
{
return false;
}
if (Count != other.Count)
{
return false;
}
// Accept if the argument is the same object as this.
if (ReferenceEquals(this, other))
{
return true;
}
// If all else fails, perform element wise comparison.
for (var index = 0; index < Count; index++)
{
if (!this[index].Equals(other[index]))
{
return false;
}
}
return true;
}
#endregion
#region IFormattable
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
@ -1511,211 +1431,5 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
return stringBuilder.ToString();
}
#endregion
#region IList
bool IList.IsReadOnly
{
get { return false; }
}
bool IList.IsFixedSize
{
get { return true; }
}
object IList.this[int index]
{
get { return Storage[index]; }
set { Storage[index] = (T)value; }
}
int IList.IndexOf(object value)
{
if (!(value is T))
{
return -1;
}
return ((IList<T>)this).IndexOf((T)value);
}
bool IList.Contains(object value)
{
if (!(value is T))
{
return false;
}
return ((ICollection<T>)this).Contains((T)value);
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
#endregion
#region ICollection
bool ICollection.IsSynchronized
{
get { return false; }
}
object ICollection.SyncRoot
{
get { return null; }
}
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
if (array.Rank != 1)
{
throw new ArgumentException(Resources.ArgumentSingleDimensionArray, "array");
}
Storage.CopySubVectorTo(new DenseVectorStorage<T>(array.Length, (T[])array), 0, index, Count);
}
#endregion
#region ICollection<T>
bool ICollection<T>.IsReadOnly
{
get { return false; }
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
// Do NOT convert this loop to LINQ (since LINQ would redirect to this very method)!
foreach (var x in this)
{
if (x.Equals(item))
return true;
}
return false;
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
Storage.CopySubVectorTo(new DenseVectorStorage<T>(array.Length, array), 0, arrayIndex, Count);
}
#endregion
#region IList<T>
int IList<T>.IndexOf(T item)
{
for (int i = 0; i < Count; ++i)
{
if (this[i].Equals(item))
return i;
}
return -1;
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
#endregion
#endregion
#region System.Object overrides
/// <summary>
/// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
/// </summary>
/// <param name="obj">
/// The <see cref="System.Object"/> to compare with this instance.
/// </param>
/// <returns>
/// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj)
{
return Equals(obj as Vector<T>);
}
/// <summary>
/// Returns a hash code for this instance.
/// </summary>
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// </returns>
public override int GetHashCode()
{
var hashNum = Math.Min(Count, 20);
long hash = 0;
for (var i = 0; i < hashNum; i++)
{
#if PORTABLE
hash ^= Precision.DoubleToInt64Bits(this[i].GetHashCode());
#else
hash ^= BitConverter.DoubleToInt64Bits(this[i].GetHashCode());
#endif
}
return BitConverter.ToInt32(BitConverter.GetBytes(hash), 4);
}
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return ToString(null, null);
}
#endregion
}
}

67
src/Numerics/LinearAlgebra/Single/SparseVector.cs

@ -1275,73 +1275,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single
#endregion
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">
/// An object to compare with this object.
/// </param>
/// <returns>
/// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(Vector<float> other)
{
// Reject equality when the argument is null or has a different length.
if (other == null)
{
return false;
}
if (Count != other.Count)
{
return false;
}
// Accept if the argument is the same object as this.
if (ReferenceEquals(this, other))
{
return true;
}
var otherSparse = other as SparseVector;
if (otherSparse == null)
{
return base.Equals(other);
}
int i = 0, j = 0;
while (i < _storage.ValueCount || j < otherSparse._storage.ValueCount)
{
if (j >= otherSparse._storage.ValueCount || i < _storage.ValueCount && _storage.Indices[i] < otherSparse._storage.Indices[j])
{
if (_storage.Values[i++] != 0f)
{
return false;
}
continue;
}
if (i >= _storage.ValueCount || j < otherSparse._storage.ValueCount && otherSparse._storage.Indices[j] < _storage.Indices[i])
{
if (otherSparse._storage.Values[j++] != 0f)
{
return false;
}
continue;
}
if (!_storage.Values[i].AlmostEqual(otherSparse._storage.Values[j]))
{
return false;
}
i++;
j++;
}
return true;
}
/// <summary>
/// Returns an <see cref="IEnumerator{T}"/> that contains the position and value of the element.
/// </summary>

6
src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs

@ -277,11 +277,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage
public override bool Equals(MatrixStorage<T> other)
{
// Reject equality when the argument is null or has a different shape.
if (other == null)
{
return false;
}
if (ColumnCount != other.ColumnCount || RowCount != other.RowCount)
if (other == null || ColumnCount != other.ColumnCount || RowCount != other.RowCount)
{
return false;
}

53
src/Numerics/LinearAlgebra/Storage/SparseVectorStorage.cs

@ -180,6 +180,59 @@ namespace MathNet.Numerics.LinearAlgebra.Storage
}
}
public override bool Equals(VectorStorage<T> other)
{
// Reject equality when the argument is null or has a different shape.
if (other == null || Length != other.Length)
{
return false;
}
// Accept if the argument is the same object as this.
if (ReferenceEquals(this, other))
{
return true;
}
var otherSparse = other as SparseVectorStorage<T>;
if (otherSparse == null)
{
return base.Equals(other);
}
int i = 0, j = 0;
while (i < ValueCount || j < otherSparse.ValueCount)
{
if (j >= otherSparse.ValueCount || i < ValueCount && Indices[i] < otherSparse.Indices[j])
{
if (!_zero.Equals(Values[i++]))
{
return false;
}
continue;
}
if (i >= ValueCount || j < otherSparse.ValueCount && otherSparse.Indices[j] < Indices[i])
{
if (!_zero.Equals(otherSparse.Values[j++]))
{
return false;
}
continue;
}
if (!Values[i].Equals(otherSparse.Values[j]))
{
return false;
}
i++;
j++;
}
return true;
}
/// <remarks>Parameters assumed to be validated already.</remarks>
public override void CopyTo(VectorStorage<T> target, bool skipClearing = false)
{

1
src/Numerics/Numerics.csproj

@ -104,6 +104,7 @@
<Compile Include="Constants.cs" />
<Compile Include="Control.cs" />
<Compile Include="Complex32.cs" />
<Compile Include="LinearAlgebra\Generic\Vector.BCL.cs" />
<Compile Include="SpecialFunctions\Evaluate.cs" />
<Compile Include="SpecialFunctions\ModifiedStruve.cs" />
<Compile Include="SpecialFunctions\ModifiedBessel.cs" />

3
src/Portable/Portable.csproj

@ -747,6 +747,9 @@
<Compile Include="..\Numerics\LinearAlgebra\Generic\Solvers\StopCriterium\StopLevel.cs">
<Link>LinearAlgebra\Generic\Solvers\StopCriterium\StopLevel.cs</Link>
</Compile>
<Compile Include="..\Numerics\LinearAlgebra\Generic\Vector.BCL.cs">
<Link>LinearAlgebra\Generic\Vector.BCL.cs</Link>
</Compile>
<Compile Include="..\Numerics\LinearAlgebra\Generic\Vector.cs">
<Link>LinearAlgebra\Generic\Vector.cs</Link>
</Compile>

2
src/UnitTests/LinearAlgebraTests/Complex/VectorTests.cs

@ -230,7 +230,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex
public void CanGetHashCode()
{
var vector = CreateVector(new[] { new Complex(1, 1), new Complex(2, 1), new Complex(3, 1), new Complex(4, 1), new Complex(5, 1) });
Assert.AreEqual(1104007323, vector.GetHashCode());
Assert.AreEqual(-344264403, vector.GetHashCode());
}
/// <summary>

2
src/UnitTests/LinearAlgebraTests/Complex32/VectorTests.cs

@ -230,7 +230,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32
public void CanGetHashCode()
{
var vector = CreateVector(new[] { new Complex32(1, 1), new Complex32(2, 1), new Complex32(3, 1), new Complex32(4, 1), new Complex32(5, 1) });
Assert.AreEqual(-1042380805, vector.GetHashCode());
Assert.AreEqual(-26300510, vector.GetHashCode());
}
/// <summary>

2
src/UnitTests/LinearAlgebraTests/Double/VectorTests.cs

@ -228,7 +228,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double
public void CanGetHashCode()
{
var vector = CreateVector(new double[] { 1, 2, 3, 4 });
Assert.AreEqual(2096640, vector.GetHashCode());
Assert.AreEqual(-1140355183, vector.GetHashCode());
}
/// <summary>

2
src/UnitTests/LinearAlgebraTests/Single/VectorTests.cs

@ -228,7 +228,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single
public void CanGetHashCode()
{
var vector = CreateVector(new float[] { 1, 2, 3, 4 });
Assert.AreEqual(2093056, vector.GetHashCode());
Assert.AreEqual(-642805871, vector.GetHashCode());
}
/// <summary>

Loading…
Cancel
Save