diff --git a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs index b877dd94..721c0124 100644 --- a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs @@ -590,6 +590,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 b96f8224..0027d783 100644 --- a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs @@ -585,6 +585,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 cb170313..ee9dfa3e 100644 --- a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs @@ -671,6 +671,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 9397b3a2..41d074a6 100644 --- a/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs @@ -671,6 +671,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. ///