diff --git a/src/Numerics/LinearAlgebra/Generic/Vector.Operators.cs b/src/Numerics/LinearAlgebra/Generic/Vector.Operators.cs
new file mode 100644
index 00000000..c551a6ea
--- /dev/null
+++ b/src/Numerics/LinearAlgebra/Generic/Vector.Operators.cs
@@ -0,0 +1,349 @@
+//
+// 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;
+using System.Runtime.CompilerServices;
+
+namespace MathNet.Numerics.LinearAlgebra.Generic
+{
+ public abstract partial class Vector
+ {
+ ///
+ /// Returns a Vector containing the same values of .
+ ///
+ /// This method is included for completeness.
+ /// The vector to get the values from.
+ /// A vector containing the same values as .
+ /// If is .
+ public static Vector operator +(Vector rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ return rightSide.Clone();
+ }
+
+ ///
+ /// Returns a Vector containing the negated values of .
+ ///
+ /// The vector to get the values from.
+ /// A vector containing the negated values as .
+ /// If is .
+ public static Vector operator -(Vector rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ return rightSide.Negate();
+ }
+
+ ///
+ /// Adds two Vectors together and returns the results.
+ ///
+ /// One of the vectors to add.
+ /// The other vector to add.
+ /// The result of the addition.
+ /// If and are not the same size.
+ /// If or is .
+ public static Vector operator +(Vector leftSide, Vector rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.Add(rightSide);
+ }
+
+ ///
+ /// Adds a scalar to each element of a vector.
+ ///
+ /// The vector to add to.
+ /// The scalar value to add.
+ /// The result of the addition.
+ /// If is .
+ public static Vector operator +(Vector leftSide, T rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.Add(rightSide);
+ }
+
+ ///
+ /// Adds a scalar to each element of a vector.
+ ///
+ /// The scalar value to add.
+ /// The vector to add to.
+ /// The result of the addition.
+ /// If is .
+ public static Vector operator +(T leftSide, Vector rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ return rightSide.Add(leftSide);
+ }
+
+ ///
+ /// Subtracts two Vectors and returns the results.
+ ///
+ /// The vector to subtract from.
+ /// The vector to subtract.
+ /// The result of the subtraction.
+ /// If and are not the same size.
+ /// If or is .
+ public static Vector operator -(Vector leftSide, Vector rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.Subtract(rightSide);
+ }
+
+ ///
+ /// Subtracts a scalar from each element of a vector.
+ ///
+ /// The vector to subtract from.
+ /// The scalar value to subtract.
+ /// The result of the subtraction.
+ /// If is .
+ public static Vector operator -(Vector leftSide, T rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.Subtract(rightSide);
+ }
+
+ ///
+ /// Substracts each element of a vector from a scalar.
+ ///
+ /// The scalar value to subtract from.
+ /// The vector to subtract.
+ /// The result of the subtraction.
+ /// If is .
+ public static Vector operator -(T leftSide, Vector rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ return rightSide.SubtractFrom(leftSide);
+ }
+
+ ///
+ /// Multiplies a vector with a scalar.
+ ///
+ /// The vector to scale.
+ /// The scalar value.
+ /// The result of the multiplication.
+ /// If is .
+ public static Vector operator *(Vector leftSide, T rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.Multiply(rightSide);
+ }
+
+ ///
+ /// Multiplies a vector with a scalar.
+ ///
+ /// The scalar value.
+ /// The vector to scale.
+ /// The result of the multiplication.
+ /// If is .
+ public static Vector operator *(T leftSide, Vector rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ return rightSide.Multiply(leftSide);
+ }
+
+ ///
+ /// Computes the dot product between two Vectors.
+ ///
+ /// The left row vector.
+ /// The right column vector.
+ /// The dot product between the two vectors.
+ /// If and are not the same size.
+ /// If or is .
+ public static T operator *(Vector leftSide, Vector rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.DotProduct(rightSide);
+ }
+
+ ///
+ /// Divides a scalar with a vector.
+ ///
+ /// The scalar to divide.
+ /// The vector.
+ /// The result of the division.
+ /// If is .
+ public static Vector operator /(T leftSide, Vector rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ return rightSide.DevideByThis(leftSide);
+ }
+
+ ///
+ /// Divides a vector with a scalar.
+ ///
+ /// The vector to divide.
+ /// The scalar value.
+ /// The result of the division.
+ /// If is .
+ public static Vector operator /(Vector leftSide, T rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.Divide(rightSide);
+ }
+
+ ///
+ /// Pointwise divides two Vectors.
+ ///
+ /// The vector to divide.
+ /// The other vector.
+ /// The result of the division.
+ /// If and are not the same size.
+ /// If is .
+ public static Vector operator /(Vector leftSide, Vector rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.PointwiseDivide(rightSide);
+ }
+
+ ///
+ /// Computes the modulus of each element of the vector of the given divisor.
+ ///
+ /// The vector whose elements we want to compute the modulus of.
+ /// The divisor to use.
+ /// The result of the calculation
+ /// If is .
+ public static Vector operator %(Vector leftSide, T rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.Modulus(rightSide);
+ }
+
+ ///
+ /// Computes the modulus of the given dividend of each element of the vector.
+ ///
+ /// The dividend we want to compute the modulus of.
+ /// The vector whose elements we want to use as divisor.
+ /// The result of the calculation
+ /// If is .
+ public static Vector operator %(T leftSide, Vector rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ return rightSide.ModulusByThis(leftSide);
+ }
+
+ ///
+ /// Computes the pointwise modulus of each element of two vectors.
+ ///
+ /// The vector whose elements we want to compute the modulus of.
+ /// The divisor to use.
+ /// The result of the calculation
+ /// If and are not the same size.
+ /// If is .
+ public static Vector operator %(Vector leftSide, Vector rightSide)
+ {
+ if (leftSide == null)
+ {
+ throw new ArgumentNullException("leftSide");
+ }
+
+ return leftSide.PointwiseModulus(rightSide);
+ }
+
+ [SpecialName]
+ public static Vector op_DotMultiply(Vector x, Vector y)
+ {
+ return x.PointwiseMultiply(y);
+ }
+
+ [SpecialName]
+ public static Vector op_DotDivide(Vector x, Vector y)
+ {
+ return x.PointwiseDivide(y);
+ }
+
+ [SpecialName]
+ public static Vector op_DotPercent(Vector x, Vector y)
+ {
+ return x.PointwiseModulus(y);
+ }
+ }
+}
diff --git a/src/Numerics/LinearAlgebra/Generic/Vector.cs b/src/Numerics/LinearAlgebra/Generic/Vector.cs
index b133d5e3..ccdc7d25 100644
--- a/src/Numerics/LinearAlgebra/Generic/Vector.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Vector.cs
@@ -28,17 +28,15 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-using System.Runtime.CompilerServices;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime;
+using MathNet.Numerics.LinearAlgebra.Storage;
+using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Generic
{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Runtime;
- using Properties;
- using Storage;
-
///
/// Defines the generic class for Vector classes.
///
@@ -993,317 +991,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
return OuterProduct(this, v);
}
- ///
- /// Returns a Vector containing the same values of .
- ///
- /// This method is included for completeness.
- /// The vector to get the values from.
- /// A vector containing the same values as .
- /// If is .
- public static Vector operator +(Vector rightSide)
- {
- if (rightSide == null)
- {
- throw new ArgumentNullException("rightSide");
- }
-
- return rightSide.Clone();
- }
-
- ///
- /// Returns a Vector containing the negated values of .
- ///
- /// The vector to get the values from.
- /// A vector containing the negated values as .
- /// If is .
- public static Vector operator -(Vector rightSide)
- {
- if (rightSide == null)
- {
- throw new ArgumentNullException("rightSide");
- }
-
- return rightSide.Negate();
- }
-
- ///
- /// Adds two Vectors together and returns the results.
- ///
- /// One of the vectors to add.
- /// The other vector to add.
- /// The result of the addition.
- /// If and are not the same size.
- /// If or is .
- public static Vector operator +(Vector leftSide, Vector rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.Add(rightSide);
- }
-
- ///
- /// Adds a scalar to each element of a vector.
- ///
- /// The vector to add to.
- /// The scalar value to add.
- /// The result of the addition.
- /// If is .
- public static Vector operator +(Vector leftSide, T rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.Add(rightSide);
- }
-
- ///
- /// Adds a scalar to each element of a vector.
- ///
- /// The scalar value to add.
- /// The vector to add to.
- /// The result of the addition.
- /// If is .
- public static Vector operator +(T leftSide, Vector rightSide)
- {
- if (rightSide == null)
- {
- throw new ArgumentNullException("rightSide");
- }
-
- return rightSide.Add(leftSide);
- }
-
- ///
- /// Subtracts two Vectors and returns the results.
- ///
- /// The vector to subtract from.
- /// The vector to subtract.
- /// The result of the subtraction.
- /// If and are not the same size.
- /// If or is .
- public static Vector operator -(Vector leftSide, Vector rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.Subtract(rightSide);
- }
-
- ///
- /// Subtracts a scalar from each element of a vector.
- ///
- /// The vector to subtract from.
- /// The scalar value to subtract.
- /// The result of the subtraction.
- /// If is .
- public static Vector operator -(Vector leftSide, T rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.Subtract(rightSide);
- }
-
- ///
- /// Substracts each element of a vector from a scalar.
- ///
- /// The scalar value to subtract from.
- /// The vector to subtract.
- /// The result of the subtraction.
- /// If is .
- public static Vector operator -(T leftSide, Vector rightSide)
- {
- if (rightSide == null)
- {
- throw new ArgumentNullException("rightSide");
- }
-
- return rightSide.SubtractFrom(leftSide);
- }
-
- ///
- /// Multiplies a vector with a scalar.
- ///
- /// The vector to scale.
- /// The scalar value.
- /// The result of the multiplication.
- /// If is .
- public static Vector operator *(Vector leftSide, T rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.Multiply(rightSide);
- }
-
- ///
- /// Multiplies a vector with a scalar.
- ///
- /// The scalar value.
- /// The vector to scale.
- /// The result of the multiplication.
- /// If is .
- public static Vector operator *(T leftSide, Vector rightSide)
- {
- if (rightSide == null)
- {
- throw new ArgumentNullException("rightSide");
- }
-
- return rightSide.Multiply(leftSide);
- }
-
- ///
- /// Computes the dot product between two Vectors.
- ///
- /// The left row vector.
- /// The right column vector.
- /// The dot product between the two vectors.
- /// If and are not the same size.
- /// If or is .
- public static T operator *(Vector leftSide, Vector rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.DotProduct(rightSide);
- }
-
- ///
- /// Divides a scalar with a vector.
- ///
- /// The scalar to divide.
- /// The vector.
- /// The result of the division.
- /// If is .
- public static Vector operator /(T leftSide, Vector rightSide)
- {
- if (rightSide == null)
- {
- throw new ArgumentNullException("rightSide");
- }
-
- return rightSide.DevideByThis(leftSide);
- }
-
- ///
- /// Divides a vector with a scalar.
- ///
- /// The vector to divide.
- /// The scalar value.
- /// The result of the division.
- /// If is .
- public static Vector operator /(Vector leftSide, T rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.Divide(rightSide);
- }
-
- ///
- /// Pointwise divides two Vectors.
- ///
- /// The vector to divide.
- /// The other vector.
- /// The result of the division.
- /// If and are not the same size.
- /// If is .
- public static Vector operator /(Vector leftSide, Vector rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.PointwiseDivide(rightSide);
- }
-
- ///
- /// Computes the modulus of each element of the vector of the given divisor.
- ///
- /// The vector whose elements we want to compute the modulus of.
- /// The divisor to use.
- /// The result of the calculation
- /// If is .
- public static Vector operator %(Vector leftSide, T rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.Modulus(rightSide);
- }
-
- ///
- /// Computes the modulus of the given dividend of each element of the vector.
- ///
- /// The dividend we want to compute the modulus of.
- /// The vector whose elements we want to use as divisor.
- /// The result of the calculation
- /// If is .
- public static Vector operator %(T leftSide, Vector rightSide)
- {
- if (rightSide == null)
- {
- throw new ArgumentNullException("rightSide");
- }
-
- return rightSide.ModulusByThis(leftSide);
- }
-
- ///
- /// Computes the pointwise modulus of each element of two vectors.
- ///
- /// The vector whose elements we want to compute the modulus of.
- /// The divisor to use.
- /// The result of the calculation
- /// If and are not the same size.
- /// If is .
- public static Vector operator %(Vector leftSide, Vector rightSide)
- {
- if (leftSide == null)
- {
- throw new ArgumentNullException("leftSide");
- }
-
- return leftSide.PointwiseModulus(rightSide);
- }
-
- [SpecialName]
- public static Vector op_DotMultiply(Vector x, Vector y)
- {
- return x.PointwiseMultiply(y);
- }
-
- [SpecialName]
- public static Vector op_DotDivide(Vector x, Vector y)
- {
- return x.PointwiseDivide(y);
- }
-
- [SpecialName]
- public static Vector op_DotPercent(Vector x, Vector y)
- {
- return x.PointwiseModulus(y);
- }
-
///
/// Computes the p-Norm.
///
diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj
index 3c10771b..86ade787 100644
--- a/src/Numerics/Numerics.csproj
+++ b/src/Numerics/Numerics.csproj
@@ -109,7 +109,9 @@
+
+