diff --git a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs
index c17c6e66..93ab1d54 100644
--- a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs
@@ -549,18 +549,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Divides each element of the matrix by a scalar and places results into the result matrix.
///
- /// The scalar to divide the matrix with.
+ /// The scalar to divide the matrix with.
/// The matrix to store the result of the division.
- protected override void DoDivide(Complex scalar, Matrix result)
+ protected override void DoDivide(Complex divisor, Matrix result)
{
var denseResult = result as DenseMatrix;
if (denseResult == null)
{
- base.DoDivide(scalar, result);
+ base.DoDivide(divisor, result);
}
else
{
- Control.LinearAlgebraProvider.ScaleArray(1.0/scalar, _values, denseResult._values);
+ Control.LinearAlgebraProvider.ScaleArray(1.0/divisor, _values, denseResult._values);
}
}
@@ -587,16 +587,16 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
- var denseOther = other as DenseMatrix;
+ var denseOther = divisor as DenseMatrix;
var denseResult = result as DenseMatrix;
if (denseOther == null || denseResult == null)
{
- base.DoPointwiseDivide(other, result);
+ base.DoPointwiseDivide(divisor, result);
}
else
{
diff --git a/src/Numerics/LinearAlgebra/Complex/DenseVector.cs b/src/Numerics/LinearAlgebra/Complex/DenseVector.cs
index c562a31f..3ada831e 100644
--- a/src/Numerics/LinearAlgebra/Complex/DenseVector.cs
+++ b/src/Numerics/LinearAlgebra/Complex/DenseVector.cs
@@ -594,17 +594,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Pointwise divide this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise divide this one by.
+ /// The vector to pointwise divide this one by.
/// The vector to store the result of the pointwise division.
///
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
- var denseOther = other as DenseVector;
+ var denseOther = divisor as DenseVector;
var denseResult = result as DenseVector;
if (denseOther == null || denseResult == null)
{
- base.DoPointwiseDivide(other, result);
+ base.DoPointwiseDivide(divisor, result);
}
else
{
diff --git a/src/Numerics/LinearAlgebra/Complex/Matrix.cs b/src/Numerics/LinearAlgebra/Complex/Matrix.cs
index d01ed63c..5841857e 100644
--- a/src/Numerics/LinearAlgebra/Complex/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Matrix.cs
@@ -257,25 +257,25 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Divides each element of the matrix by a scalar and places results into the result matrix.
///
- /// The scalar to divide the matrix with.
+ /// The scalar to divide the matrix with.
/// The matrix to store the result of the division.
- protected override void DoDivide(Complex scalar, Matrix result)
+ protected override void DoDivide(Complex divisor, Matrix result)
{
- DoMultiply(1.0 / scalar, result);
+ DoMultiply(1.0 / divisor, result);
}
///
/// Divides a scalar by each element of the matrix and stores the result in the result matrix.
///
- /// The scalar to add.
+ /// The scalar to add.
/// The matrix to store the result of the division.
- protected override void DoDivideByThis(Complex scalar, Matrix result)
+ protected override void DoDivideByThis(Complex dividend, Matrix result)
{
for (var i = 0; i < RowCount; i++)
{
for (var j = 0; j < ColumnCount; j++)
{
- result.At(i, j, scalar / At(i, j));
+ result.At(i, j, dividend / At(i, j));
}
}
}
@@ -392,27 +392,47 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
for (var j = 0; j < ColumnCount; j++)
{
for (var i = 0; i < RowCount; i++)
{
- result.At(i, j, At(i, j) / other.At(i, j));
+ result.At(i, j, At(i, j) / divisor.At(i, j));
}
}
}
+ ///
+ /// Pointwise modulus this matrix with another matrix and stores the result into the result matrix.
+ ///
+ /// The pointwise denominator matrix to use
+ /// The result of the modulus.
+ protected override void DoPointwiseModulus(Matrix divisor, Matrix result)
+ {
+ throw new NotSupportedException();
+ }
+
///
/// Computes the modulus for each element of the matrix.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// Matrix to store the results in.
protected override void DoModulus(Complex divisor, Matrix result)
{
- throw new NotImplementedException();
+ throw new NotSupportedException();
+ }
+
+ ///
+ /// Computes the modulus for each element of the matrix.
+ ///
+ /// The scalar numerator to use.
+ /// Matrix to store the results in.
+ protected override void DoModulusByThis(Complex dividend, Matrix result)
+ {
+ throw new NotSupportedException();
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs
index eb1596ff..1e1bbdf2 100644
--- a/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs
@@ -1005,9 +1005,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
result.Clear();
@@ -1026,7 +1026,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (!values[j].IsZero())
{
- result.At(i, columnIndices[j], values[j]/other.At(i, columnIndices[j]));
+ result.At(i, columnIndices[j], values[j]/divisor.At(i, columnIndices[j]));
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex/SparseVector.cs b/src/Numerics/LinearAlgebra/Complex/SparseVector.cs
index dc974195..ca233a7d 100644
--- a/src/Numerics/LinearAlgebra/Complex/SparseVector.cs
+++ b/src/Numerics/LinearAlgebra/Complex/SparseVector.cs
@@ -756,11 +756,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Pointwise multiplies this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise multiply with this one.
+ /// The vector to pointwise multiply with this one.
/// The vector to store the result of the pointwise multiplication.
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
- if (ReferenceEquals(this, other))
+ if (ReferenceEquals(this, divisor))
{
for (var i = 0; i < _storage.ValueCount; i++)
{
@@ -772,7 +772,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
for (var i = 0; i < _storage.ValueCount; i++)
{
var index = _storage.Indices[i];
- result.At(index, _storage.Values[i] / other.At(index));
+ result.At(index, _storage.Values[i] / divisor.At(index));
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex/Vector.cs b/src/Numerics/LinearAlgebra/Complex/Vector.cs
index c26df4a7..40320362 100644
--- a/src/Numerics/LinearAlgebra/Complex/Vector.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Vector.cs
@@ -140,27 +140,27 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Divides each element of the vector by a scalar and stores the result in the result vector.
///
- ///
+ ///
/// The scalar to divide with.
///
///
/// The vector to store the result of the division.
///
- protected override void DoDivide(Complex scalar, Vector result)
+ protected override void DoDivide(Complex divisor, Vector result)
{
- DoMultiply(1 / scalar, result);
+ DoMultiply(1 / divisor, result);
}
///
/// Divides a scalar by each element of the vector and stores the result in the result vector.
///
- /// The scalar to divide.
+ /// The scalar to divide.
/// The vector to store the result of the division.
- protected override void DoDivideByThis(Complex scalar, Vector result)
+ protected override void DoDivideByThis(Complex dividend, Vector result)
{
for (var index = 0; index < Count; index++)
{
- result.At(index, scalar / At(index));
+ result.At(index, dividend / At(index));
}
}
@@ -180,22 +180,22 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Pointwise divide this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise divide this one by.
+ /// The vector to pointwise divide this one by.
/// The vector to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
for (var index = 0; index < Count; index++)
{
- result.At(index, At(index) / other.At(index));
+ result.At(index, At(index) / divisor.At(index));
}
}
///
/// Pointwise modulus this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise modulus this one by.
+ /// The vector to pointwise modulus this one by.
/// The result of the modulus.
- protected override void DoPointwiseModulus(Vector other, Vector result)
+ protected override void DoPointwiseModulus(Vector divisor, Vector result)
{
throw new NotSupportedException();
}
@@ -224,7 +224,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Computes the modulus for each element of the vector for the given divisor.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// A vector to store the results in.
protected override void DoModulus(Complex divisor, Vector result)
{
@@ -234,9 +234,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
///
/// Computes the modulus for the given dividend for each element of the vector.
///
- /// The dividend to use.
+ /// The scalar numerator to use.
/// A vector to store the results in.
- protected override void DoModulusByThis(Complex scalar, Vector result)
+ protected override void DoModulusByThis(Complex dividend, Vector result)
{
throw new NotSupportedException();
}
diff --git a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs
index 39167450..b477e6f5 100644
--- a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs
@@ -544,18 +544,18 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Divides each element of the matrix by a scalar and places results into the result matrix.
///
- /// The scalar to divide the matrix with.
+ /// The scalar to divide the matrix with.
/// The matrix to store the result of the division.
- protected override void DoDivide(Complex32 scalar, Matrix result)
+ protected override void DoDivide(Complex32 divisor, Matrix result)
{
var denseResult = result as DenseMatrix;
if (denseResult == null)
{
- base.DoDivide(scalar, result);
+ base.DoDivide(divisor, result);
}
else
{
- Control.LinearAlgebraProvider.ScaleArray(1.0f/scalar, _values, denseResult._values);
+ Control.LinearAlgebraProvider.ScaleArray(1.0f/divisor, _values, denseResult._values);
}
}
@@ -582,16 +582,16 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
- var denseOther = other as DenseMatrix;
+ var denseOther = divisor as DenseMatrix;
var denseResult = result as DenseMatrix;
if (denseOther == null || denseResult == null)
{
- base.DoPointwiseDivide(other, result);
+ base.DoPointwiseDivide(divisor, result);
}
else
{
diff --git a/src/Numerics/LinearAlgebra/Complex32/DenseVector.cs b/src/Numerics/LinearAlgebra/Complex32/DenseVector.cs
index 36e27f00..3cd87efa 100644
--- a/src/Numerics/LinearAlgebra/Complex32/DenseVector.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/DenseVector.cs
@@ -589,17 +589,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Pointwise divide this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise divide this one by.
+ /// The vector to pointwise divide this one by.
/// The vector to store the result of the pointwise division.
///
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
- var denseOther = other as DenseVector;
+ var denseOther = divisor as DenseVector;
var denseResult = result as DenseVector;
if (denseOther == null || denseResult == null)
{
- base.DoPointwiseDivide(other, result);
+ base.DoPointwiseDivide(divisor, result);
}
else
{
diff --git a/src/Numerics/LinearAlgebra/Complex32/Matrix.cs b/src/Numerics/LinearAlgebra/Complex32/Matrix.cs
index 80196c32..224eb290 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Matrix.cs
@@ -230,25 +230,25 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Divides each element of the matrix by a scalar and places results into the result matrix.
///
- /// The scalar to divide the matrix with.
+ /// The scalar to divide the matrix with.
/// The matrix to store the result of the division.
- protected override void DoDivide(Complex32 scalar, Matrix result)
+ protected override void DoDivide(Complex32 divisor, Matrix result)
{
- DoMultiply(1.0f / scalar, result);
+ DoMultiply(1.0f / divisor, result);
}
///
/// Divides a scalar by each element of the matrix and stores the result in the result matrix.
///
- /// The scalar to add.
+ /// The scalar to add.
/// The matrix to store the result of the division.
- protected override void DoDivideByThis(Complex32 scalar, Matrix result)
+ protected override void DoDivideByThis(Complex32 dividend, Matrix result)
{
for (var i = 0; i < RowCount; i++)
{
for (var j = 0; j < ColumnCount; j++)
{
- result.At(i, j, scalar / At(i, j));
+ result.At(i, j, dividend / At(i, j));
}
}
}
@@ -387,27 +387,47 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
for (var j = 0; j < ColumnCount; j++)
{
for (var i = 0; i < RowCount; i++)
{
- result.At(i, j, At(i, j) / other.At(i, j));
+ result.At(i, j, At(i, j) / divisor.At(i, j));
}
}
}
+ ///
+ /// Pointwise modulus this matrix with another matrix and stores the result into the result matrix.
+ ///
+ /// The pointwise denominator matrix to use
+ /// The result of the modulus.
+ protected override void DoPointwiseModulus(Matrix divisor, Matrix result)
+ {
+ throw new NotSupportedException();
+ }
+
///
/// Computes the modulus for each element of the matrix.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// Matrix to store the results in.
protected override void DoModulus(Complex32 divisor, Matrix result)
{
- throw new NotImplementedException();
+ throw new NotSupportedException();
+ }
+
+ ///
+ /// Computes the modulus for each element of the matrix.
+ ///
+ /// The scalar numerator to use.
+ /// Matrix to store the results in.
+ protected override void DoModulusByThis(Complex32 dividend, Matrix result)
+ {
+ throw new NotSupportedException();
}
///
diff --git a/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs
index fdaaf603..40b1210a 100644
--- a/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs
@@ -999,9 +999,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
result.Clear();
@@ -1020,7 +1020,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (!values[j].IsZero())
{
- result.At(i, columnIndices[j], values[j]/other.At(i, columnIndices[j]));
+ result.At(i, columnIndices[j], values[j]/divisor.At(i, columnIndices[j]));
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs b/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs
index c89cc400..bb2a5527 100644
--- a/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs
@@ -751,11 +751,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Pointwise multiplies this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise multiply with this one.
+ /// The vector to pointwise multiply with this one.
/// The vector to store the result of the pointwise multiplication.
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
- if (ReferenceEquals(this, other))
+ if (ReferenceEquals(this, divisor))
{
for (var i = 0; i < _storage.ValueCount; i++)
{
@@ -767,7 +767,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
for (var i = 0; i < _storage.ValueCount; i++)
{
var index = _storage.Indices[i];
- result.At(index, _storage.Values[i] / other.At(index));
+ result.At(index, _storage.Values[i] / divisor.At(index));
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Complex32/Vector.cs b/src/Numerics/LinearAlgebra/Complex32/Vector.cs
index 19109c2e..b39d6c3c 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Vector.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Vector.cs
@@ -135,27 +135,27 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Divides each element of the vector by a scalar and stores the result in the result vector.
///
- ///
+ ///
/// The scalar to divide with.
///
///
/// The vector to store the result of the division.
///
- protected override void DoDivide(Complex32 scalar, Vector result)
+ protected override void DoDivide(Complex32 divisor, Vector result)
{
- DoMultiply(1 / scalar, result);
+ DoMultiply(1 / divisor, result);
}
///
/// Divides a scalar by each element of the vector and stores the result in the result vector.
///
- /// The scalar to divide.
+ /// The scalar to divide.
/// The vector to store the result of the division.
- protected override void DoDivideByThis(Complex32 scalar, Vector result)
+ protected override void DoDivideByThis(Complex32 dividend, Vector result)
{
for (var index = 0; index < Count; index++)
{
- result.At(index, scalar / At(index));
+ result.At(index, dividend / At(index));
}
}
@@ -175,22 +175,22 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Pointwise divide this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise divide this one by.
+ /// The vector to pointwise divide this one by.
/// The vector to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
for (var index = 0; index < Count; index++)
{
- result.At(index, At(index) / other.At(index));
+ result.At(index, At(index) / divisor.At(index));
}
}
///
/// Pointwise modulus this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise modulus this one by.
+ /// The vector to pointwise modulus this one by.
/// The result of the modulus.
- protected override void DoPointwiseModulus(Vector other, Vector result)
+ protected override void DoPointwiseModulus(Vector divisor, Vector result)
{
throw new NotSupportedException();
}
@@ -219,7 +219,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Computes the modulus for each element of the vector for the given divisor.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// A vector to store the results in.
protected override void DoModulus(Complex32 divisor, Vector result)
{
@@ -229,9 +229,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
///
/// Computes the modulus for the given dividend for each element of the vector.
///
- /// The dividend to use.
+ /// The scalar numerator to use.
/// A vector to store the results in.
- protected override void DoModulusByThis(Complex32 scalar, Vector result)
+ protected override void DoModulusByThis(Complex32 dividend, Vector result)
{
throw new NotSupportedException();
}
diff --git a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs
index 146b27ea..3eb8b707 100644
--- a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs
+++ b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs
@@ -630,18 +630,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Divides each element of the matrix by a scalar and places results into the result matrix.
///
- /// The scalar to divide the matrix with.
+ /// The scalar to divide the matrix with.
/// The matrix to store the result of the division.
- protected override void DoDivide(double scalar, Matrix result)
+ protected override void DoDivide(double divisor, Matrix result)
{
var denseResult = result as DenseMatrix;
if (denseResult == null)
{
- base.DoDivide(scalar, result);
+ base.DoDivide(divisor, result);
}
else
{
- Control.LinearAlgebraProvider.ScaleArray(1.0/scalar, _values, denseResult._values);
+ Control.LinearAlgebraProvider.ScaleArray(1.0/divisor, _values, denseResult._values);
}
}
@@ -668,16 +668,16 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
- var denseOther = other as DenseMatrix;
+ var denseOther = divisor as DenseMatrix;
var denseResult = result as DenseMatrix;
if (denseOther == null || denseResult == null)
{
- base.DoPointwiseDivide(other, result);
+ base.DoPointwiseDivide(divisor, result);
}
else
{
@@ -714,6 +714,30 @@ namespace MathNet.Numerics.LinearAlgebra.Double
});
}
+ ///
+ /// Computes the modulus for each element of the matrix.
+ ///
+ /// The scalar numerator to use.
+ /// Matrix to store the results in.
+ protected override void DoModulusByThis(double dividend, Matrix result)
+ {
+ var denseResult = result as DenseMatrix;
+ if (denseResult == null)
+ {
+ base.DoModulusByThis(dividend, result);
+ return;
+ }
+
+ CommonParallel.For(0, _values.Length, 4096, (a, b) =>
+ {
+ var v = denseResult._values;
+ for (int i = a; i < b; i++)
+ {
+ v[i] = dividend%_values[i];
+ }
+ });
+ }
+
///
/// Computes the trace of this matrix.
///
diff --git a/src/Numerics/LinearAlgebra/Double/DenseVector.cs b/src/Numerics/LinearAlgebra/Double/DenseVector.cs
index 83639d21..047b6c21 100644
--- a/src/Numerics/LinearAlgebra/Double/DenseVector.cs
+++ b/src/Numerics/LinearAlgebra/Double/DenseVector.cs
@@ -681,17 +681,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Pointwise divide this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise divide this one by.
+ /// The vector to pointwise divide this one by.
/// The vector to store the result of the pointwise division.
///
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
- var denseOther = other as DenseVector;
+ var denseOther = divisor as DenseVector;
var denseResult = result as DenseVector;
if (denseOther == null || denseResult == null)
{
- base.DoPointwiseDivide(other, result);
+ base.DoPointwiseDivide(divisor, result);
}
else
{
diff --git a/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs
index 191ed633..f40cc167 100644
--- a/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs
+++ b/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs
@@ -28,17 +28,18 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
+using MathNet.Numerics.Distributions;
+using MathNet.Numerics.LinearAlgebra.Generic;
+using MathNet.Numerics.LinearAlgebra.Storage;
+using MathNet.Numerics.Properties;
+using MathNet.Numerics.Threading;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+
namespace MathNet.Numerics.LinearAlgebra.Double
{
- using Distributions;
- using Generic;
- using Properties;
- using Storage;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
-
///
/// A matrix type for diagonal matrices.
///
@@ -1020,28 +1021,49 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Computes the modulus for each element of the matrix.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// Matrix to store the results in.
protected override void DoModulus(double divisor, Matrix result)
{
- var denseResult = result as DiagonalMatrix;
-
- if (denseResult == null)
+ var diagonalResult = result as DiagonalMatrix;
+ if (diagonalResult == null)
{
base.DoModulus(divisor, result);
+ return;
}
- else
- {
- if (!ReferenceEquals(this, result))
- {
- CopyTo(result);
- }
- for (var index = 0; index < _data.Length; index++)
+ CommonParallel.For(0, _data.Length, 4096, (a, b) =>
{
- denseResult._data[index] %= divisor;
- }
+ var r = diagonalResult._data;
+ for (var i = a; i < b; i++)
+ {
+ r[i] = _data[i]%divisor;
+ }
+ });
+ }
+
+ ///
+ /// Computes the modulus for each element of the matrix.
+ ///
+ /// The scalar numerator to use.
+ /// Matrix to store the results in.
+ protected override void DoModulusByThis(double dividend, Matrix result)
+ {
+ var diagonalResult = result as DiagonalMatrix;
+ if (diagonalResult == null)
+ {
+ base.DoModulusByThis(dividend, result);
+ return;
}
+
+ CommonParallel.For(0, _data.Length, 4096, (a, b) =>
+ {
+ var r = diagonalResult._data;
+ for (var i = a; i < b; i++)
+ {
+ r[i] = dividend%_data[i];
+ }
+ });
}
#region Static constructors for special matrices.
diff --git a/src/Numerics/LinearAlgebra/Double/Matrix.cs b/src/Numerics/LinearAlgebra/Double/Matrix.cs
index 328aaa3e..ca203938 100644
--- a/src/Numerics/LinearAlgebra/Double/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Double/Matrix.cs
@@ -220,25 +220,25 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Divides each element of the matrix by a scalar and places results into the result matrix.
///
- /// The scalar to divide the matrix with.
+ /// The scalar to divide the matrix with.
/// The matrix to store the result of the division.
- protected override void DoDivide(double scalar, Matrix result)
+ protected override void DoDivide(double divisor, Matrix result)
{
- DoMultiply(1.0 / scalar, result);
+ DoMultiply(1.0 / divisor, result);
}
///
/// Divides a scalar by each element of the matrix and stores the result in the result matrix.
///
- /// The scalar to add.
+ /// The scalar to add.
/// The matrix to store the result of the division.
- protected override void DoDivideByThis(double scalar, Matrix result)
+ protected override void DoDivideByThis(double dividend, Matrix result)
{
for (var i = 0; i < RowCount; i++)
{
for (var j = 0; j < ColumnCount; j++)
{
- result.At(i, j, scalar / At(i, j));
+ result.At(i, j, dividend / At(i, j));
}
}
}
@@ -357,6 +357,38 @@ namespace MathNet.Numerics.LinearAlgebra.Double
CopyTo(result);
}
+ ///
+ /// Computes the modulus for each element of the matrix.
+ ///
+ /// The scalar denominator to use.
+ /// Matrix to store the results in.
+ protected override void DoModulus(double divisor, Matrix result)
+ {
+ for (var row = 0; row < RowCount; row++)
+ {
+ for (var column = 0; column < ColumnCount; column++)
+ {
+ result.At(row, column, At(row, column)%divisor);
+ }
+ }
+ }
+
+ ///
+ /// Computes the modulus for each element of the matrix.
+ ///
+ /// The scalar numerator to use.
+ /// Matrix to store the results in.
+ protected override void DoModulusByThis(double dividend, Matrix result)
+ {
+ for (var row = 0; row < RowCount; row++)
+ {
+ for (var column = 0; column < ColumnCount; column++)
+ {
+ result.At(row, column, dividend%At(row, column));
+ }
+ }
+ }
+
///
/// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.
///
@@ -368,7 +400,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
for (var i = 0; i < RowCount; i++)
{
- result.At(i, j, At(i, j) * other.At(i, j));
+ result.At(i, j, At(i, j)*other.At(i, j));
}
}
}
@@ -376,31 +408,31 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
for (var j = 0; j < ColumnCount; j++)
{
for (var i = 0; i < RowCount; i++)
{
- result.At(i, j, At(i, j) / other.At(i, j));
+ result.At(i, j, At(i, j)/divisor.At(i, j));
}
}
}
///
- /// Computes the modulus for each element of the matrix.
+ /// Pointwise modulus this matrix with another matrix and stores the result into the result matrix.
///
- /// The divisor to use.
- /// Matrix to store the results in.
- protected override void DoModulus(double divisor, Matrix result)
+ /// The pointwise denominator matrix to use
+ /// The result of the modulus.
+ protected override void DoPointwiseModulus(Matrix divisor, Matrix result)
{
- for (var row = 0; row < RowCount; row++)
+ for (var j = 0; j < ColumnCount; j++)
{
- for (var column = 0; column < ColumnCount; column++)
+ for (var i = 0; i < RowCount; i++)
{
- result.At(row, column, At(row, column) % divisor);
+ result.At(i, j, At(i, j)%divisor.At(i, j));
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Double/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Double/SparseMatrix.cs
index 3351da70..700be355 100644
--- a/src/Numerics/LinearAlgebra/Double/SparseMatrix.cs
+++ b/src/Numerics/LinearAlgebra/Double/SparseMatrix.cs
@@ -998,9 +998,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The matrix to pointwise divide this one by.
/// The matrix to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Matrix other, Matrix result)
+ protected override void DoPointwiseDivide(Matrix divisor, Matrix result)
{
result.Clear();
@@ -1019,7 +1019,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (values[j] != 0d)
{
- result.At(i, columnIndices[j], values[j]/other.At(i, columnIndices[j]));
+ result.At(i, columnIndices[j], values[j]/divisor.At(i, columnIndices[j]));
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Double/SparseVector.cs b/src/Numerics/LinearAlgebra/Double/SparseVector.cs
index b1c02c67..52828aea 100644
--- a/src/Numerics/LinearAlgebra/Double/SparseVector.cs
+++ b/src/Numerics/LinearAlgebra/Double/SparseVector.cs
@@ -787,11 +787,11 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Pointwise multiplies this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise multiply with this one.
+ /// The vector to pointwise multiply with this one.
/// The vector to store the result of the pointwise multiplication.
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
- if (ReferenceEquals(this, other))
+ if (ReferenceEquals(this, divisor))
{
for (var i = 0; i < _storage.ValueCount; i++)
{
@@ -803,7 +803,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
for (var i = 0; i < _storage.ValueCount; i++)
{
var index = _storage.Indices[i];
- result.At(index, _storage.Values[i] / other.At(index));
+ result.At(index, _storage.Values[i] / divisor.At(index));
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Double/Vector.cs b/src/Numerics/LinearAlgebra/Double/Vector.cs
index 3b8ef23d..4de80d00 100644
--- a/src/Numerics/LinearAlgebra/Double/Vector.cs
+++ b/src/Numerics/LinearAlgebra/Double/Vector.cs
@@ -134,27 +134,27 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Divides each element of the vector by a scalar and stores the result in the result vector.
///
- ///
+ ///
/// The scalar to divide with.
///
///
/// The vector to store the result of the division.
///
- protected override void DoDivide(double scalar, Vector result)
+ protected override void DoDivide(double divisor, Vector result)
{
- DoMultiply(1 / scalar, result);
+ DoMultiply(1 / divisor, result);
}
///
/// Divides a scalar by each element of the vector and stores the result in the result vector.
///
- /// The scalar to divide.
+ /// The scalar to divide.
/// The vector to store the result of the division.
- protected override void DoDivideByThis(double scalar, Vector result)
+ protected override void DoDivideByThis(double dividend, Vector result)
{
for (var index = 0; index < Count; index++)
{
- result.At(index, scalar / At(index));
+ result.At(index, dividend / At(index));
}
}
@@ -174,39 +174,26 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Pointwise divide this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise divide this one by.
+ /// The vector to pointwise divide this one by.
/// The vector to store the result of the pointwise division.
- protected override void DoPointwiseDivide(Vector other, Vector result)
+ protected override void DoPointwiseDivide(Vector divisor, Vector result)
{
for (var index = 0; index < Count; index++)
{
- result.At(index, At(index) / other.At(index));
+ result.At(index, At(index) / divisor.At(index));
}
}
///
/// Pointwise modulus this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise modulus this one by.
+ /// The vector to pointwise modulus this one by.
/// The result of the modulus.
- protected override void DoPointwiseModulus(Vector other, Vector result)
- {
- for (var index = 0; index < Count; index++)
- {
- result.At(index, At(index) % other.At(index));
- }
- }
-
- ///
- /// Computes the modulus for the given dividend for each element of the vector.
- ///
- /// The dividend to use.
- /// A vector to store the results in.
- protected override void DoModulusByThis(double scalar, Vector result)
+ protected override void DoPointwiseModulus(Vector divisor, Vector result)
{
for (var index = 0; index < Count; index++)
{
- result.At(index, scalar % At(index));
+ result.At(index, At(index) % divisor.At(index));
}
}
@@ -234,7 +221,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
///
/// Computes the modulus for each element of the vector for the given divisor.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// A vector to store the results in.
protected override void DoModulus(double divisor, Vector result)
{
@@ -244,6 +231,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double
}
}
+ ///
+ /// Computes the modulus for the given dividend for each element of the vector.
+ ///
+ /// The scalar numerator to use.
+ /// A vector to store the results in.
+ protected override void DoModulusByThis(double dividend, Vector result)
+ {
+ for (var index = 0; index < Count; index++)
+ {
+ result.At(index, dividend%At(index));
+ }
+ }
+
///
/// Returns the value of the absolute minimum element.
///
diff --git a/src/Numerics/LinearAlgebra/Generic/Matrix.Arithmetic.cs b/src/Numerics/LinearAlgebra/Generic/Matrix.Arithmetic.cs
index 1d7a99a2..48734d47 100644
--- a/src/Numerics/LinearAlgebra/Generic/Matrix.Arithmetic.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Matrix.Arithmetic.cs
@@ -147,24 +147,31 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
/// Divides each element of the matrix by a scalar and places results into the result matrix.
///
- /// The scalar to divide the matrix with.
+ /// The scalar denominator to use.
/// The matrix to store the result of the division.
- protected abstract void DoDivide(T scalar, Matrix result);
+ protected abstract void DoDivide(T divisor, Matrix result);
///
/// Divides a scalar by each element of the matrix and stores the result in the result matrix.
///
- /// The scalar to divide.
+ /// The scalar numerator to use.
/// The matrix to store the result of the division.
- protected abstract void DoDivideByThis(T scalar, Matrix result);
+ protected abstract void DoDivideByThis(T dividend, Matrix result);
///
- /// Computes the modulus for each element of the matrix.
+ /// Computes the modulus for the given divisor each element of the matrix.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// Matrix to store the results in.
protected abstract void DoModulus(T divisor, Matrix result);
+ ///
+ /// Computes the modulus for the given dividend for each element of the matrix.
+ ///
+ /// The scalar numerator to use.
+ /// A vector to store the results in.
+ protected abstract void DoModulusByThis(T dividend, Matrix result);
+
///
/// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.
///
@@ -175,9 +182,16 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The pointwise denominator matrix to use.
/// The matrix to store the result of the pointwise division.
- protected abstract void DoPointwiseDivide(Matrix other, Matrix result);
+ protected abstract void DoPointwiseDivide(Matrix divisor, Matrix result);
+
+ ///
+ /// Pointwise modulus this matrix with another matrix and stores the result into the result matrix.
+ ///
+ /// The pointwise denominator matrix to use
+ /// The result of the modulus.
+ protected abstract void DoPointwiseModulus(Matrix divisor, Matrix result);
///
/// Adds a scalar to each element of the matrix.
@@ -1038,6 +1052,70 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
DoConjugate(result);
}
+ ///
+ /// Computes the modulus (matrix % divisor) for each element of the matrix.
+ ///
+ /// The scalar denominator to use.
+ /// A matrix containing the results.
+ public Matrix Modulus(T divisor)
+ {
+ var result = CreateMatrix(RowCount, ColumnCount);
+ DoModulus(divisor, result);
+ return result;
+ }
+
+ ///
+ /// Computes the modulus (matrix % divisor) for each element of the matrix.
+ ///
+ /// The scalar denominator to use.
+ /// Matrix to store the results in.
+ public void Modulus(T divisor, Matrix result)
+ {
+ if (result == null)
+ {
+ throw new ArgumentNullException("result");
+ }
+
+ if (ColumnCount != result.ColumnCount || RowCount != result.RowCount)
+ {
+ throw DimensionsDontMatch(this, result);
+ }
+
+ DoModulus(divisor, result);
+ }
+
+ ///
+ /// Computes the modulus (dividend % matrix) for each element of the matrix.
+ ///
+ /// The scalar numerator to use.
+ /// A matrix containing the results.
+ public Matrix ModulusByThis(T dividend)
+ {
+ var result = CreateMatrix(RowCount, ColumnCount);
+ DoModulusByThis(dividend, result);
+ return result;
+ }
+
+ ///
+ /// Computes the modulus (dividend % matrix) for each element of the matrix.
+ ///
+ /// The scalar numerator to use.
+ /// Matrix to store the results in.
+ public void ModulusByThis(T dividend, Matrix result)
+ {
+ if (result == null)
+ {
+ throw new ArgumentNullException("result");
+ }
+
+ if (ColumnCount != result.ColumnCount || RowCount != result.RowCount)
+ {
+ throw DimensionsDontMatch(this, result);
+ }
+
+ DoModulusByThis(dividend, result);
+ }
+
///
/// Pointwise multiplies this matrix with another matrix.
///
@@ -1094,41 +1172,41 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
/// Pointwise divide this matrix by another matrix.
///
- /// The matrix to pointwise subtract this one by.
+ /// The pointwise denominator matrix to use.
/// If the other matrix is .
- /// If this matrix and are not the same size.
- /// A new matrix that is the pointwise division of this matrix and .
- public Matrix PointwiseDivide(Matrix other)
+ /// If this matrix and are not the same size.
+ /// A new matrix that is the pointwise division of this matrix and .
+ public Matrix PointwiseDivide(Matrix divisor)
{
- if (other == null)
+ if (divisor == null)
{
- throw new ArgumentNullException("other");
+ throw new ArgumentNullException("divisor");
}
- if (ColumnCount != other.ColumnCount || RowCount != other.RowCount)
+ if (ColumnCount != divisor.ColumnCount || RowCount != divisor.RowCount)
{
- throw DimensionsDontMatch(this, other);
+ throw DimensionsDontMatch(this, divisor);
}
var result = CreateMatrix(RowCount, ColumnCount);
- DoPointwiseDivide(other, result);
+ DoPointwiseDivide(divisor, result);
return result;
}
///
/// Pointwise divide this matrix by another matrix and stores the result into the result matrix.
///
- /// The matrix to pointwise divide this one by.
+ /// The pointwise denominator matrix to use.
/// The matrix to store the result of the pointwise division.
/// If the other matrix is .
/// If the result matrix is .
- /// If this matrix and are not the same size.
+ /// If this matrix and are not the same size.
/// If this matrix and are not the same size.
- public void PointwiseDivide(Matrix other, Matrix result)
+ public void PointwiseDivide(Matrix divisor, Matrix result)
{
- if (other == null)
+ if (divisor == null)
{
- throw new ArgumentNullException("other");
+ throw new ArgumentNullException("divisor");
}
if (result == null)
@@ -1136,44 +1214,65 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
throw new ArgumentNullException("result");
}
- if (ColumnCount != result.ColumnCount || RowCount != result.RowCount || ColumnCount != other.ColumnCount || RowCount != other.RowCount)
+ if (ColumnCount != result.ColumnCount || RowCount != result.RowCount || ColumnCount != divisor.ColumnCount || RowCount != divisor.RowCount)
{
- throw DimensionsDontMatch(this, other, result);
+ throw DimensionsDontMatch(this, divisor, result);
}
- DoPointwiseDivide(other, result);
+ DoPointwiseDivide(divisor, result);
}
///
- /// Computes the modulus for each element of the matrix.
+ /// Pointwise modulus this matrix by another matrix.
///
- /// The divisor to use.
- /// A matrix containing the results.
- public Matrix Modulus(T divisor)
+ /// The pointwise denominator matrix to use.
+ /// If the other matrix is .
+ /// If this matrix and are not the same size.
+ /// A new matrix that is the pointwise modulus of this matrix and .
+ public Matrix PointwiseModulus(Matrix divisor)
{
+ if (divisor == null)
+ {
+ throw new ArgumentNullException("divisor");
+ }
+
+ if (ColumnCount != divisor.ColumnCount || RowCount != divisor.RowCount)
+ {
+ throw DimensionsDontMatch(this, divisor);
+ }
+
var result = CreateMatrix(RowCount, ColumnCount);
- DoModulus(divisor, result);
+ DoPointwiseModulus(divisor, result);
return result;
}
///
- /// Computes the modulus for each element of the matrix.
+ /// Pointwise modulus this matrix by another matrix and stores the result into the result matrix.
///
- /// The divisor to use.
- /// Matrix to store the results in.
- public void Modulus(T divisor, Matrix result)
+ /// The pointwise denominator matrix to use.
+ /// The matrix to store the result of the pointwise modulus.
+ /// If the other matrix is .
+ /// If the result matrix is .
+ /// If this matrix and are not the same size.
+ /// If this matrix and are not the same size.
+ public void PointwiseModulus(Matrix divisor, Matrix result)
{
+ if (divisor == null)
+ {
+ throw new ArgumentNullException("divisor");
+ }
+
if (result == null)
{
throw new ArgumentNullException("result");
}
- if (ColumnCount != result.ColumnCount || RowCount != result.RowCount)
+ if (ColumnCount != result.ColumnCount || RowCount != result.RowCount || ColumnCount != divisor.ColumnCount || RowCount != divisor.RowCount)
{
- throw DimensionsDontMatch(this, result);
+ throw DimensionsDontMatch(this, divisor, result);
}
- DoModulus(divisor, result);
+ DoPointwiseModulus(divisor, result);
}
///
diff --git a/src/Numerics/LinearAlgebra/Generic/Matrix.Operators.cs b/src/Numerics/LinearAlgebra/Generic/Matrix.Operators.cs
index 0c6b7049..73c779b3 100644
--- a/src/Numerics/LinearAlgebra/Generic/Matrix.Operators.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Matrix.Operators.cs
@@ -282,52 +282,87 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
/// Divides a scalar with a matrix.
///
- /// The scalar to divide.
- /// The matrix.
+ /// The scalar to divide.
+ /// The matrix.
/// The result of the division.
- /// If is .
- public static Matrix operator /(T leftSide, Matrix rightSide)
+ /// If is .
+ public static Matrix operator /(T dividend, Matrix divisor)
{
- if (rightSide == null)
+ if (divisor == null)
{
- throw new ArgumentNullException("rightSide");
+ throw new ArgumentNullException("divisor");
}
- return rightSide.DivideByThis(leftSide);
+ return divisor.DivideByThis(dividend);
}
///
/// Divides a matrix with a scalar.
///
- /// The matrix to divide.
- /// The scalar value.
+ /// The matrix to divide.
+ /// The scalar value.
/// The result of the division.
- /// If is .
- public static Matrix operator /(Matrix leftSide, T rightSide)
+ /// If is .
+ public static Matrix operator /(Matrix dividend, T divisor)
{
- if (leftSide == null)
+ if (dividend == null)
{
- throw new ArgumentNullException("leftSide");
+ throw new ArgumentNullException("dividend");
}
- return leftSide.Divide(rightSide);
+ return dividend.Divide(divisor);
}
///
- /// Multiplies a Matrix by a constant and returns the result.
+ /// Computes the modulus of each element of the matrix of the given divisor.
///
- /// The matrix to multiply.
- /// The constant to multiply the matrix by.
- /// The result of the multiplication.
- /// If is .
- public static Matrix operator %(Matrix leftSide, T rightSide)
+ /// The matrix whose elements we want to compute the modulus of.
+ /// The divisor to use.
+ /// The result of the calculation
+ /// If is .
+ public static Matrix operator %(Matrix dividend, T divisor)
{
- if (leftSide == null)
+ if (dividend == null)
{
- throw new ArgumentNullException("leftSide");
+ throw new ArgumentNullException("dividend");
}
- return leftSide.Modulus(rightSide);
+ return dividend.Modulus(divisor);
+ }
+
+ ///
+ /// Computes the modulus of the given dividend of each element of the matrix.
+ ///
+ /// The dividend we want to compute the modulus of.
+ /// The matrix whose elements we want to use as divisor.
+ /// The result of the calculation
+ /// If is .
+ public static Matrix operator %(T dividend, Matrix divisor)
+ {
+ if (divisor == null)
+ {
+ throw new ArgumentNullException("dividend");
+ }
+
+ return divisor.ModulusByThis(dividend);
+ }
+
+ ///
+ /// Computes the pointwise modulus of each element of two matrices.
+ ///
+ /// The matrix 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 Matrix operator %(Matrix dividend, Matrix divisor)
+ {
+ if (dividend == null)
+ {
+ throw new ArgumentNullException("dividend");
+ }
+
+ return dividend.PointwiseModulus(divisor);
}
[SpecialName]
@@ -337,9 +372,15 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
}
[SpecialName]
- public static Matrix op_DotDivide(Matrix x, Matrix y)
+ public static Matrix op_DotDivide(Matrix dividend, Matrix divisor)
+ {
+ return dividend.PointwiseDivide(divisor);
+ }
+
+ [SpecialName]
+ public static Vector op_DotPercent(Vector dividend, Vector divisor)
{
- return x.PointwiseDivide(y);
+ return dividend.PointwiseModulus(divisor);
}
}
}
diff --git a/src/Numerics/LinearAlgebra/Generic/Vector.Arithmetic.cs b/src/Numerics/LinearAlgebra/Generic/Vector.Arithmetic.cs
index bd6c444c..116fcbcd 100644
--- a/src/Numerics/LinearAlgebra/Generic/Vector.Arithmetic.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Vector.Arithmetic.cs
@@ -103,30 +103,30 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
/// Divides each element of the vector by a scalar and stores the result in the result vector.
///
- /// The scalar to divide with.
+ /// The scalar denominator to use.
/// The vector to store the result of the division.
- protected abstract void DoDivide(T scalar, Vector result);
+ protected abstract void DoDivide(T divisor, Vector result);
///
/// Divides a scalar by each element of the vector and stores the result in the result vector.
///
- /// The scalar to divide.
+ /// The scalar numerator to use.
/// The vector to store the result of the division.
- protected abstract void DoDivideByThis(T scalar, Vector result);
+ protected abstract void DoDivideByThis(T dividend, Vector result);
///
/// Computes the modulus for each element of the vector for the given divisor.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// A vector to store the results in.
- protected abstract void DoModulus(T scalar, Vector result);
+ protected abstract void DoModulus(T divisor, Vector result);
///
/// Computes the modulus for the given dividend for each element of the vector.
///
- /// The dividend to use.
+ /// The scalar numerator to use.
/// A vector to store the results in.
- protected abstract void DoModulusByThis(T scalar, Vector result);
+ protected abstract void DoModulusByThis(T dividend, Vector result);
///
/// Pointwise multiplies this vector with another vector and stores the result into the result vector.
@@ -138,16 +138,16 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
/// Pointwise divide this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise divide this one by.
+ /// The pointwise denominator vector to use.
/// The result of the division.
- protected abstract void DoPointwiseDivide(Vector other, Vector result);
+ protected abstract void DoPointwiseDivide(Vector divisor, Vector result);
///
/// Pointwise modulus this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise modulus this one by.
+ /// The pointwise denominator vector to use.
/// The result of the modulus.
- protected abstract void DoPointwiseModulus(Vector other, Vector result);
+ protected abstract void DoPointwiseModulus(Vector divisor, Vector result);
///
/// Adds a scalar to each element of the vector.
@@ -588,23 +588,23 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
}
///
- /// Computes the modulus for each element of the vector for the given divisor.
+ /// Computes the modulus (vector % divisor) for each element of the vector for the given divisor.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// A vector containing the result.
- public Vector Modulus(T scalar)
+ public Vector Modulus(T divisor)
{
var result = CreateVector(Count);
- DoModulus(scalar, result);
+ DoModulus(divisor, result);
return result;
}
///
- /// Computes the modulus for each element of the vector for the given divisor.
+ /// Computes the modulus (vector % divisor) for each element of the vector for the given divisor.
///
- /// The divisor to use.
+ /// The scalar denominator to use.
/// A vector to store the results in.
- public void Modulus(T scalar, Vector result)
+ public void Modulus(T divisor, Vector result)
{
if (result == null)
{
@@ -616,27 +616,27 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "result");
}
- DoModulus(scalar, result);
+ DoModulus(divisor, result);
}
///
- /// Computes the modulus for the given dividend for each element of the vector.
+ /// Computes the modulus (dividend % vector) for the given dividend for each element of the vector.
///
- /// The dividend to use.
+ /// The scalar numerator to use.
/// A vector containing the result.
- public Vector ModulusByThis(T scalar)
+ public Vector ModulusByThis(T dividend)
{
var result = CreateVector(Count);
- DoModulusByThis(scalar, result);
+ DoModulusByThis(dividend, result);
return result;
}
///
- /// Computes the modulus for the given dividend for each element of the vector.
+ /// Computes the modulus (dividend % vector) for the given dividend for each element of the vector.
///
- /// The dividend to use.
+ /// The scalar numerator to use.
/// A vector to store the results in.
- public void ModulusByThis(T scalar, Vector result)
+ public void ModulusByThis(T dividend, Vector result)
{
if (result == null)
{
@@ -648,7 +648,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "result");
}
- DoModulusByThis(scalar, result);
+ DoModulusByThis(dividend, result);
}
///
@@ -712,51 +712,51 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
/// Pointwise divide this vector with another vector.
///
- /// The vector to pointwise divide this one by.
+ /// The pointwise denominator vector to use.
/// A new vector which is the pointwise division of the two vectors.
/// If the other vector is .
- /// If this vector and are not the same size.
- public Vector PointwiseDivide(Vector other)
+ /// If this vector and are not the same size.
+ public Vector PointwiseDivide(Vector divisor)
{
- if (other == null)
+ if (divisor == null)
{
- throw new ArgumentNullException("other");
+ throw new ArgumentNullException("divisor");
}
- if (Count != other.Count)
+ if (Count != divisor.Count)
{
- throw new ArgumentException(Resources.ArgumentVectorsSameLength, "other");
+ throw new ArgumentException(Resources.ArgumentVectorsSameLength, "divisor");
}
var result = CreateVector(Count);
- DoPointwiseDivide(other, result);
+ DoPointwiseDivide(divisor, result);
return result;
}
///
/// Pointwise divide this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise divide this one by.
+ /// The pointwise denominator vector to use.
/// The vector to store the result of the pointwise division.
/// If the other vector is .
/// If the result vector is .
- /// If this vector and are not the same size.
+ /// If this vector and are not the same size.
/// If this vector and are not the same size.
- public void PointwiseDivide(Vector other, Vector result)
+ public void PointwiseDivide(Vector divisor, Vector result)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
- if (other == null)
+ if (divisor == null)
{
- throw new ArgumentNullException("other");
+ throw new ArgumentNullException("divisor");
}
- if (Count != other.Count)
+ if (Count != divisor.Count)
{
- throw new ArgumentException(Resources.ArgumentVectorsSameLength, "other");
+ throw new ArgumentException(Resources.ArgumentVectorsSameLength, "divisor");
}
if (Count != result.Count)
@@ -764,57 +764,57 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "result");
}
- DoPointwiseDivide(other, result);
+ DoPointwiseDivide(divisor, result);
}
///
/// Pointwise modulus this vector with another vector.
///
- /// The vector to pointwise modulus this one by.
+ /// The pointwise denominator vector to use.
/// A new vector which is the pointwise modulus of the two vectors.
/// If the other vector is .
- /// If this vector and are not the same size.
- public Vector PointwiseModulus(Vector other)
+ /// If this vector and are not the same size.
+ public Vector PointwiseModulus(Vector divisor)
{
- if (other == null)
+ if (divisor == null)
{
- throw new ArgumentNullException("other");
+ throw new ArgumentNullException("divisor");
}
- if (Count != other.Count)
+ if (Count != divisor.Count)
{
- throw new ArgumentException(Resources.ArgumentVectorsSameLength, "other");
+ throw new ArgumentException(Resources.ArgumentVectorsSameLength, "divisor");
}
var result = CreateVector(Count);
- DoPointwiseModulus(other, result);
+ DoPointwiseModulus(divisor, result);
return result;
}
///
/// Pointwise modulus this vector with another vector and stores the result into the result vector.
///
- /// The vector to pointwise modulus this one by.
+ /// The pointwise denominator vector to use.
/// The vector to store the result of the pointwise modulus.
/// If the other vector is .
/// If the result vector is .
- /// If this vector and are not the same size.
+ /// If this vector and are not the same size.
/// If this vector and are not the same size.
- public void PointwiseModulus(Vector other, Vector result)
+ public void PointwiseModulus(Vector divisor, Vector result)
{
if (result == null)
{
throw new ArgumentNullException("result");
}
- if (other == null)
+ if (divisor == null)
{
- throw new ArgumentNullException("other");
+ throw new ArgumentNullException("divisor");
}
- if (Count != other.Count)
+ if (Count != divisor.Count)
{
- throw new ArgumentException(Resources.ArgumentVectorsSameLength, "other");
+ throw new ArgumentException(Resources.ArgumentVectorsSameLength, "divisor");
}
if (Count != result.Count)
@@ -822,7 +822,7 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "result");
}
- DoPointwiseModulus(other, result);
+ DoPointwiseModulus(divisor, result);
}
///
diff --git a/src/Numerics/LinearAlgebra/Generic/Vector.Operators.cs b/src/Numerics/LinearAlgebra/Generic/Vector.Operators.cs
index c551a6ea..275d397c 100644
--- a/src/Numerics/LinearAlgebra/Generic/Vector.Operators.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Vector.Operators.cs
@@ -227,105 +227,105 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
///
/// Divides a scalar with a vector.
///
- /// The scalar to divide.
- /// The vector.
+ /// The scalar to divide.
+ /// The vector.
/// The result of the division.
- /// If is .
- public static Vector operator /(T leftSide, Vector rightSide)
+ ///