diff --git a/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs b/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs
index 3cd7d430..04f87fe8 100644
--- a/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs
+++ b/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs
@@ -365,6 +365,36 @@ namespace MathNet.Numerics.LinearAlgebra.Double
return result;
}
+ ///
+ /// Negates each element of this matrix.
+ ///
+ public virtual void Negate()
+ {
+ Multiply(-1);
+ }
+
+ ///
+ /// Negate each element of this matrix and place the results into the result matrix.
+ ///
+ /// The result of the negation.
+ /// If the result matrix is .
+ /// if the result matrix's dimensions are not the same as this matrix.
+ public virtual void Negate(Matrix result)
+ {
+ if (result == null)
+ {
+ throw new ArgumentNullException("result");
+ }
+
+ if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
+ {
+ throw new ArgumentException(Resources.ArgumentMatrixDimensions);
+ }
+
+ CopyTo(result);
+ result.Negate();
+ }
+
///
/// Adds two matrices together and returns the results.
///
@@ -398,6 +428,22 @@ namespace MathNet.Numerics.LinearAlgebra.Double
return ret;
}
+ ///
+ /// Returns a Matrix containing the same values of rightSide.
+ ///
+ /// The matrix to get the values from.
+ /// A matrix containing a the same values as .
+ /// If is .
+ public static Matrix operator +(Matrix rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ return rightSide.Clone();
+ }
+
///
/// Subtracts two matrices together and returns the results.
///
@@ -431,6 +477,24 @@ namespace MathNet.Numerics.LinearAlgebra.Double
return ret;
}
+ ///
+ /// Negates each element of the matrix.
+ ///
+ /// The matrix to negate.
+ /// A matrix containing the negated values.
+ /// If is .
+ public static Matrix operator -(Matrix rightSide)
+ {
+ if (rightSide == null)
+ {
+ throw new ArgumentNullException("rightSide");
+ }
+
+ Matrix ret = rightSide.Clone();
+ ret.Negate();
+ return ret;
+ }
+
///
/// Multiplies a Matrix by a constant and returns the result.
///