diff --git a/src/Numerics/LinearAlgebra/Generic/Matrix.BCL.cs b/src/Numerics/LinearAlgebra/Generic/Matrix.BCL.cs
new file mode 100644
index 00000000..0fab08ab
--- /dev/null
+++ b/src/Numerics/LinearAlgebra/Generic/Matrix.BCL.cs
@@ -0,0 +1,104 @@
+//
+// 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-2013 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.
+//
+
+using System;
+
+namespace MathNet.Numerics.LinearAlgebra.Generic
+{
+ public abstract partial class Matrix
+ {
+ ///
+ /// Indicates whether the current object is equal to another object of the same type.
+ ///
+ ///
+ /// An object to compare with this object.
+ ///
+ ///
+ /// true if the current object is equal to the parameter; otherwise, false.
+ ///
+ public bool Equals(Matrix other)
+ {
+ return other != null && Storage.Equals(other.Storage);
+ }
+
+ ///
+ /// Determines whether the specified is equal to this instance.
+ ///
+ /// The to compare with this instance.
+ ///
+ /// true if the specified is equal to this instance; otherwise, false.
+ ///
+ public override bool Equals(object obj)
+ {
+ var other = obj as Matrix;
+ return other != null && Storage.Equals(other.Storage);
+ }
+
+ ///
+ /// Returns a hash code for this instance.
+ ///
+ ///
+ /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
+ ///
+ public override int GetHashCode()
+ {
+ return Storage.GetHashCode();
+ }
+
+ ///
+ /// Returns a that represents this instance.
+ ///
+ ///
+ /// A that represents this instance.
+ ///
+ public override string ToString()
+ {
+ return ToString(null, null);
+ }
+
+#if !PORTABLE
+
+ ///
+ /// Creates a new object that is a copy of the current instance.
+ ///
+ ///
+ /// A new object that is a copy of this instance.
+ ///
+ object ICloneable.Clone()
+ {
+ return Clone();
+ }
+
+#endif
+
+
+
+ }
+}
diff --git a/src/Numerics/LinearAlgebra/Generic/Matrix.cs b/src/Numerics/LinearAlgebra/Generic/Matrix.cs
index 4e72bca2..835cff56 100644
--- a/src/Numerics/LinearAlgebra/Generic/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Matrix.cs
@@ -47,10 +47,9 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
/// Supported data types are double, single, , and .
[Serializable]
public abstract partial class Matrix :
-#if PORTABLE
IFormattable, IEquatable>
-#else
- IFormattable, IEquatable>, ICloneable
+#if !PORTABLE
+ , ICloneable
#endif
where T : struct, IEquatable, IFormattable
{
@@ -293,19 +292,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
return result;
}
-#if !PORTABLE
- ///
- /// Creates a new object that is a copy of the current instance.
- ///
- ///
- /// A new object that is a copy of this instance.
- ///
- object ICloneable.Clone()
- {
- return Clone();
- }
-#endif
-
///
/// Copies the elements of this matrix to the given matrix.
///
@@ -1453,17 +1439,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
return Storage.ToRowMajorArray();
}
- ///
- /// Returns a that represents this instance.
- ///
- ///
- /// A that represents this instance.
- ///
- public override string ToString()
- {
- return ToString(null);
- }
-
///
/// Returns a that represents this instance.
///
@@ -1498,43 +1473,5 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
return stringBuilder.ToString();
}
-
- ///
- /// Returns a hash code for this instance.
- ///
- ///
- /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
- ///
- public override int GetHashCode()
- {
- return Storage.GetHashCode();
- }
-
- ///
- /// Indicates whether the current object is equal to another object of the same type.
- ///
- ///
- /// An object to compare with this object.
- ///
- ///
- /// true if the current object is equal to the parameter; otherwise, false.
- ///
- public bool Equals(Matrix other)
- {
- return other != null && Storage.Equals(other.Storage);
- }
-
- ///
- /// Determines whether the specified is equal to this instance.
- ///
- /// The to compare with this instance.
- ///
- /// true if the specified is equal to this instance; otherwise, false.
- ///
- public override bool Equals(object obj)
- {
- var other = obj as Matrix;
- return other != null && Storage.Equals(other.Storage);
- }
}
}
diff --git a/src/Numerics/LinearAlgebra/Generic/Vector.BCL.cs b/src/Numerics/LinearAlgebra/Generic/Vector.BCL.cs
index 8b3d5d1a..6ed83203 100644
--- a/src/Numerics/LinearAlgebra/Generic/Vector.BCL.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Vector.BCL.cs
@@ -36,14 +36,8 @@ using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Generic
{
- public abstract partial class Vector :
-#if PORTABLE
- IList, IList
-#else
- IList, IList, ICloneable
-#endif
+ public abstract partial class Vector
{
-
///
/// Indicates whether the current object is equal to another object of the same type.
///
@@ -107,8 +101,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
#if !PORTABLE
- #region ICloneable
-
///
/// Creates a new object that is a copy of the current instance.
///
@@ -120,8 +112,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
return Clone();
}
- #endregion
-
#endif
int IList.IndexOf(T item)
@@ -268,7 +258,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
IEnumerator IEnumerable.GetEnumerator()
{
- return GetEnumerator();
+ return Storage.Enumerate().GetEnumerator();
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Generic/Vector.cs b/src/Numerics/LinearAlgebra/Generic/Vector.cs
index d3c6deb2..87c63371 100644
--- a/src/Numerics/LinearAlgebra/Generic/Vector.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Vector.cs
@@ -28,9 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
+
namespace MathNet.Numerics.LinearAlgebra.Generic
{
using System;
+ using System.Collections;
using System.Collections.Generic;
using System.Runtime;
using System.Text;
@@ -43,7 +45,10 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
/// Supported data types are double, single, , and .
[Serializable]
public abstract partial class Vector :
- IFormattable, IEnumerable, IEquatable>
+ IFormattable, IEnumerable, IEquatable>, IList, IList
+#if !PORTABLE
+ , ICloneable
+#endif
where T : struct, IEquatable, IFormattable
{
///
diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj
index b2423852..a1507c2e 100644
--- a/src/Numerics/Numerics.csproj
+++ b/src/Numerics/Numerics.csproj
@@ -105,6 +105,7 @@
+
diff --git a/src/Portable/Portable.csproj b/src/Portable/Portable.csproj
index 7deff81e..69ffe879 100644
--- a/src/Portable/Portable.csproj
+++ b/src/Portable/Portable.csproj
@@ -717,6 +717,9 @@
LinearAlgebra\Generic\Matrix.Arithmetic.cs
+
+ LinearAlgebra\Generic\Matrix.BCL.cs
+
LinearAlgebra\Generic\Matrix.cs