From c0a1b01b4ffd7a14469b60cb09c3f09607f98edd Mon Sep 17 00:00:00 2001 From: Jurgen Van Gael Date: Wed, 27 Jan 2010 23:37:47 +0800 Subject: [PATCH] Dense matrix scalar multiplication optimization. --- src/Numerics/LinearAlgebra/Double/DenseMatrix.cs | 9 +++++++++ src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs | 1 + 2 files changed, 10 insertions(+) diff --git a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs index d5294bc6..caeac622 100644 --- a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs @@ -283,6 +283,15 @@ namespace MathNet.Numerics.LinearAlgebra.Double Control.LinearAlgebraProvider.SubtractArrays(Data, other.Data, Data); } + /// + /// Multiplies each element of this matrix with a scalar. + /// + /// The scalar to multiply with. + public override void Multiply(double scalar) + { + Control.LinearAlgebraProvider.ScaleArray(scalar, Data); + } + /// /// Multiplies this dense matrix with another dense matrix and places the results into the result dense matrix. /// diff --git a/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs b/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs index b27cfdaf..fa98bba6 100644 --- a/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs +++ b/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs @@ -97,6 +97,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double } }); } + /// /// Multiplies each element of this matrix with a scalar. ///