From c27534b9a73bc18882e3a9806e364eb690bc8b5a Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Fri, 11 Nov 2016 15:07:43 +0100 Subject: [PATCH] LA: ConugateTranspose into provided result matrix #431 --- src/Numerics/LinearAlgebra/Complex/Matrix.cs | 9 +++++++++ src/Numerics/LinearAlgebra/Complex32/Matrix.cs | 9 +++++++++ src/Numerics/LinearAlgebra/Double/Matrix.cs | 8 ++++++++ src/Numerics/LinearAlgebra/Matrix.cs | 6 +++++- src/Numerics/LinearAlgebra/Single/Matrix.cs | 8 ++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/Numerics/LinearAlgebra/Complex/Matrix.cs b/src/Numerics/LinearAlgebra/Complex/Matrix.cs index 21017305..1e34ced4 100644 --- a/src/Numerics/LinearAlgebra/Complex/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/Matrix.cs @@ -75,6 +75,15 @@ namespace MathNet.Numerics.LinearAlgebra.Complex return ret; } + /// + /// Puts the conjugate transpose of this matrix into the result matrix. + /// + public sealed override void ConjugateTranspose(Matrix result) + { + Transpose(result); + result.MapInplace(c => c.Conjugate(), Zeros.AllowSkip); + } + /// /// Complex conjugates each element of this matrix and place the results into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Complex32/Matrix.cs b/src/Numerics/LinearAlgebra/Complex32/Matrix.cs index d7408613..b0490b77 100644 --- a/src/Numerics/LinearAlgebra/Complex32/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/Matrix.cs @@ -70,6 +70,15 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 return ret; } + /// + /// Puts the conjugate transpose of this matrix into the result matrix. + /// + public sealed override void ConjugateTranspose(Matrix result) + { + Transpose(result); + result.MapInplace(c => c.Conjugate(), Zeros.AllowSkip); + } + /// /// Complex conjugates each element of this matrix and place the results into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Double/Matrix.cs b/src/Numerics/LinearAlgebra/Double/Matrix.cs index 4fbec2d8..1b8c11bb 100644 --- a/src/Numerics/LinearAlgebra/Double/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Double/Matrix.cs @@ -66,6 +66,14 @@ namespace MathNet.Numerics.LinearAlgebra.Double return Transpose(); } + /// + /// Puts the conjugate transpose of this matrix into the result matrix. + /// + public sealed override void ConjugateTranspose(Matrix result) + { + Transpose(result); + } + /// /// Complex conjugates each element of this matrix and place the results into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Matrix.cs b/src/Numerics/LinearAlgebra/Matrix.cs index 500416a3..1461b471 100644 --- a/src/Numerics/LinearAlgebra/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Matrix.cs @@ -1005,7 +1005,6 @@ namespace MathNet.Numerics.LinearAlgebra /// /// Puts the transpose of this matrix into the result matrix. /// - /// The transpose of this matrix. public void Transpose(Matrix result) { Storage.TransposeTo(result.Storage, ExistingData.Clear); @@ -1017,6 +1016,11 @@ namespace MathNet.Numerics.LinearAlgebra /// The conjugate transpose of this matrix. public abstract Matrix ConjugateTranspose(); + /// + /// Puts the conjugate transpose of this matrix into the result matrix. + /// + public abstract void ConjugateTranspose(Matrix result); + /// /// Permute the rows of a matrix according to a permutation. /// diff --git a/src/Numerics/LinearAlgebra/Single/Matrix.cs b/src/Numerics/LinearAlgebra/Single/Matrix.cs index 74d86e53..354dcb50 100644 --- a/src/Numerics/LinearAlgebra/Single/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Single/Matrix.cs @@ -66,6 +66,14 @@ namespace MathNet.Numerics.LinearAlgebra.Single return Transpose(); } + /// + /// Puts the conjugate transpose of this matrix into the result matrix. + /// + public sealed override void ConjugateTranspose(Matrix result) + { + Transpose(result); + } + /// /// Complex conjugates each element of this matrix and place the results into the result matrix. ///