diff --git a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs index 5dbfe3cd..c17c6e66 100644 --- a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs @@ -546,6 +546,24 @@ 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 matrix to store the result of the division. + protected override void DoDivide(Complex scalar, Matrix result) + { + var denseResult = result as DenseMatrix; + if (denseResult == null) + { + base.DoDivide(scalar, result); + } + else + { + Control.LinearAlgebraProvider.ScaleArray(1.0/scalar, _values, denseResult._values); + } + } + /// /// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs index 97409551..39167450 100644 --- a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs @@ -541,6 +541,24 @@ 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 matrix to store the result of the division. + protected override void DoDivide(Complex32 scalar, Matrix result) + { + var denseResult = result as DenseMatrix; + if (denseResult == null) + { + base.DoDivide(scalar, result); + } + else + { + Control.LinearAlgebraProvider.ScaleArray(1.0f/scalar, _values, denseResult._values); + } + } + /// /// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs index 3d9eec4e..146b27ea 100644 --- a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs @@ -627,6 +627,24 @@ 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 matrix to store the result of the division. + protected override void DoDivide(double scalar, Matrix result) + { + var denseResult = result as DenseMatrix; + if (denseResult == null) + { + base.DoDivide(scalar, result); + } + else + { + Control.LinearAlgebraProvider.ScaleArray(1.0/scalar, _values, denseResult._values); + } + } + /// /// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs index e931c694..f0c6afd2 100644 --- a/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs @@ -627,6 +627,24 @@ namespace MathNet.Numerics.LinearAlgebra.Single } } + /// + /// Divides each element of the matrix by a scalar and places results into the result matrix. + /// + /// The scalar to divide the matrix with. + /// The matrix to store the result of the division. + protected override void DoDivide(float scalar, Matrix result) + { + var denseResult = result as DenseMatrix; + if (denseResult == null) + { + base.DoDivide(scalar, result); + } + else + { + Control.LinearAlgebraProvider.ScaleArray(1.0f/scalar, _values, denseResult._values); + } + } + /// /// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix. ///