diff --git a/src/Numerics/LinearAlgebra/Builder.cs b/src/Numerics/LinearAlgebra/Builder.cs index de30b3fa..3cc23640 100644 --- a/src/Numerics/LinearAlgebra/Builder.cs +++ b/src/Numerics/LinearAlgebra/Builder.cs @@ -465,7 +465,7 @@ namespace MathNet.Numerics.LinearAlgebra public Matrix RandomPositiveDefinite(int order, IContinuousDistribution distribution) { var a = Random(order, order, distribution); - return a.TransposeThisAndMultiply(a); + return a.ConjugateTransposeThisAndMultiply(a); } /// @@ -475,7 +475,7 @@ namespace MathNet.Numerics.LinearAlgebra public Matrix RandomPositiveDefinite(int order) { var a = Random(order, order, new Normal(MersenneTwister.Default)); - return a.TransposeThisAndMultiply(a); + return a.ConjugateTransposeThisAndMultiply(a); } /// @@ -485,7 +485,7 @@ namespace MathNet.Numerics.LinearAlgebra public Matrix RandomPositiveDefinite(int order, int seed) { var a = Random(order, order, new Normal(new MersenneTwister(seed, true))); - return a.TransposeThisAndMultiply(a); + return a.ConjugateTransposeThisAndMultiply(a); } /// diff --git a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs index 63ea0f19..0387fd71 100644 --- a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs @@ -727,6 +727,62 @@ namespace MathNet.Numerics.LinearAlgebra.Complex base.DoTransposeAndMultiply(other, result); } + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeAndMultiply(Matrix other, Matrix result) + { + var denseOther = other as DenseMatrix; + var denseResult = result as DenseMatrix; + if (denseOther != null && denseResult != null) + { + Control.LinearAlgebraProvider.MatrixMultiplyWithUpdate( + Providers.LinearAlgebra.Transpose.DontTranspose, + Providers.LinearAlgebra.Transpose.ConjugateTranspose, + 1.0, + _values, + _rowCount, + _columnCount, + denseOther._values, + denseOther._rowCount, + denseOther._columnCount, + 0.0, + denseResult._values); + return; + } + + var diagonalOther = other.Storage as DiagonalMatrixStorage; + if (diagonalOther != null) + { + var diagonal = diagonalOther.Data; + var conjugateDiagonal = new Complex[diagonal.Length]; + for (int i = 0; i < diagonal.Length; i++) + { + conjugateDiagonal[i] = diagonal[i].Conjugate(); + } + + var d = Math.Min(ColumnCount, other.RowCount); + if (d < other.RowCount) + { + result.ClearSubMatrix(0, RowCount, ColumnCount, other.RowCount - ColumnCount); + } + int index = 0; + for (int j = 0; j < d; j++) + { + for (int i = 0; i < RowCount; i++) + { + result.At(i, j, _values[index]*conjugateDiagonal[j]); + index++; + } + } + return; + } + + base.DoConjugateTransposeAndMultiply(other, result); + } + /// /// Multiplies the transpose of this matrix with a vector and places the results into the result vector. /// @@ -736,15 +792,39 @@ namespace MathNet.Numerics.LinearAlgebra.Complex { var denseRight = rightSide as DenseVector; var denseResult = result as DenseVector; - - if (denseRight == null || denseResult == null) + if (denseRight != null && denseResult != null) { - base.DoTransposeThisAndMultiply(rightSide, result); + Control.LinearAlgebraProvider.MatrixMultiplyWithUpdate( + Providers.LinearAlgebra.Transpose.Transpose, + Providers.LinearAlgebra.Transpose.DontTranspose, + 1.0, + _values, + _rowCount, + _columnCount, + denseRight.Values, + denseRight.Count, + 1, + 0.0, + denseResult.Values); + return; } - else + + base.DoTransposeThisAndMultiply(rightSide, result); + } + + /// + /// Multiplies the conjugate transpose of this matrix with a vector and places the results into the result vector. + /// + /// The vector to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Vector rightSide, Vector result) + { + var denseRight = rightSide as DenseVector; + var denseResult = result as DenseVector; + if (denseRight != null && denseResult != null) { Control.LinearAlgebraProvider.MatrixMultiplyWithUpdate( - Providers.LinearAlgebra.Transpose.Transpose, + Providers.LinearAlgebra.Transpose.ConjugateTranspose, Providers.LinearAlgebra.Transpose.DontTranspose, 1.0, _values, @@ -755,7 +835,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex 1, 0.0, denseResult.Values); + return; } + + base.DoConjugateTransposeThisAndMultiply(rightSide, result); } /// @@ -809,6 +892,57 @@ namespace MathNet.Numerics.LinearAlgebra.Complex base.DoTransposeThisAndMultiply(other, result); } + /// + /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Matrix other, Matrix result) + { + var denseOther = other as DenseMatrix; + var denseResult = result as DenseMatrix; + if (denseOther != null && denseResult != null) + { + Control.LinearAlgebraProvider.MatrixMultiplyWithUpdate( + Providers.LinearAlgebra.Transpose.ConjugateTranspose, + Providers.LinearAlgebra.Transpose.DontTranspose, + 1.0, + _values, + _rowCount, + _columnCount, + denseOther._values, + denseOther._rowCount, + denseOther._columnCount, + 0.0, + denseResult._values); + return; + } + + var diagonalOther = other.Storage as DiagonalMatrixStorage; + if (diagonalOther != null) + { + var diagonal = diagonalOther.Data; + var d = Math.Min(RowCount, other.ColumnCount); + if (d < other.ColumnCount) + { + result.ClearSubMatrix(0, ColumnCount, RowCount, other.ColumnCount - RowCount); + } + int index = 0; + for (int i = 0; i < ColumnCount; i++) + { + for (int j = 0; j < d; j++) + { + result.At(i, j, _values[index].Conjugate()*diagonal[j]); + index++; + } + index += (RowCount - d); + } + return; + } + + base.DoConjugateTransposeThisAndMultiply(other, result); + } + /// /// Negate each element of this matrix and place the results into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Complex/Matrix.cs b/src/Numerics/LinearAlgebra/Complex/Matrix.cs index 771391fb..d2ec6f96 100644 --- a/src/Numerics/LinearAlgebra/Complex/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/Matrix.cs @@ -293,6 +293,27 @@ namespace MathNet.Numerics.LinearAlgebra.Complex } } + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeAndMultiply(Matrix other, Matrix result) + { + for (var j = 0; j < other.RowCount; j++) + { + for (var i = 0; i < RowCount; i++) + { + var s = Complex.Zero; + for (var l = 0; l < ColumnCount; l++) + { + s += At(i, l)*other.At(j, l).Conjugate(); + } + result.At(i, j, s); + } + } + } + /// /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. /// @@ -314,6 +335,27 @@ namespace MathNet.Numerics.LinearAlgebra.Complex } } + /// + /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Matrix other, Matrix result) + { + for (var j = 0; j < other.ColumnCount; j++) + { + for (var i = 0; i < ColumnCount; i++) + { + var s = Complex.Zero; + for (var l = 0; l < RowCount; l++) + { + s += At(l, i).Conjugate()*other.At(l, j); + } + result.At(i, j, s); + } + } + } + /// /// Multiplies the transpose of this matrix with a vector and places the results into the result vector. /// @@ -332,6 +374,24 @@ namespace MathNet.Numerics.LinearAlgebra.Complex } } + /// + /// Multiplies the conjugate transpose of this matrix with a vector and places the results into the result vector. + /// + /// The vector to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Vector rightSide, Vector result) + { + for (var i = 0; i < ColumnCount; i++) + { + var s = Complex.Zero; + for (var j = 0; j < RowCount; j++) + { + s += At(j, i).Conjugate()*rightSide[j]; + } + result[i] = s; + } + } + /// /// Negate each element of this matrix and place the results into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs index cfe659f0..443c0883 100644 --- a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs @@ -722,6 +722,62 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 base.DoTransposeAndMultiply(other, result); } + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeAndMultiply(Matrix other, Matrix result) + { + var denseOther = other as DenseMatrix; + var denseResult = result as DenseMatrix; + if (denseOther != null && denseResult != null) + { + Control.LinearAlgebraProvider.MatrixMultiplyWithUpdate( + Providers.LinearAlgebra.Transpose.DontTranspose, + Providers.LinearAlgebra.Transpose.ConjugateTranspose, + 1.0f, + _values, + _rowCount, + _columnCount, + denseOther._values, + denseOther._rowCount, + denseOther._columnCount, + 0.0f, + denseResult._values); + return; + } + + var diagonalOther = other.Storage as DiagonalMatrixStorage; + if (diagonalOther != null) + { + var diagonal = diagonalOther.Data; + var conjugateDiagonal = new Complex32[diagonal.Length]; + for (int i = 0; i < diagonal.Length; i++) + { + conjugateDiagonal[i] = diagonal[i].Conjugate(); + } + + var d = Math.Min(ColumnCount, other.RowCount); + if (d < other.RowCount) + { + result.ClearSubMatrix(0, RowCount, ColumnCount, other.RowCount - ColumnCount); + } + int index = 0; + for (int j = 0; j < d; j++) + { + for (int i = 0; i < RowCount; i++) + { + result.At(i, j, _values[index]*conjugateDiagonal[j]); + index++; + } + } + return; + } + + base.DoConjugateTransposeAndMultiply(other, result); + } + /// /// Multiplies the transpose of this matrix with a vector and places the results into the result vector. /// @@ -753,6 +809,35 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 } } + /// + /// Multiplies the conjugate transpose of this matrix with a vector and places the results into the result vector. + /// + /// The vector to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Vector rightSide, Vector result) + { + var denseRight = rightSide as DenseVector; + var denseResult = result as DenseVector; + if (denseRight != null && denseResult != null) + { + Control.LinearAlgebraProvider.MatrixMultiplyWithUpdate( + Providers.LinearAlgebra.Transpose.ConjugateTranspose, + Providers.LinearAlgebra.Transpose.DontTranspose, + 1.0f, + _values, + _rowCount, + _columnCount, + denseRight.Values, + denseRight.Count, + 1, + 0.0f, + denseResult.Values); + return; + } + + base.DoConjugateTransposeThisAndMultiply(rightSide, result); + } + /// /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. /// @@ -804,6 +889,57 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 base.DoTransposeThisAndMultiply(other, result); } + /// + /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Matrix other, Matrix result) + { + var denseOther = other as DenseMatrix; + var denseResult = result as DenseMatrix; + if (denseOther != null && denseResult != null) + { + Control.LinearAlgebraProvider.MatrixMultiplyWithUpdate( + Providers.LinearAlgebra.Transpose.ConjugateTranspose, + Providers.LinearAlgebra.Transpose.DontTranspose, + 1.0f, + _values, + _rowCount, + _columnCount, + denseOther._values, + denseOther._rowCount, + denseOther._columnCount, + 0.0f, + denseResult._values); + return; + } + + var diagonalOther = other.Storage as DiagonalMatrixStorage; + if (diagonalOther != null) + { + var diagonal = diagonalOther.Data; + var d = Math.Min(RowCount, other.ColumnCount); + if (d < other.ColumnCount) + { + result.ClearSubMatrix(0, ColumnCount, RowCount, other.ColumnCount - RowCount); + } + int index = 0; + for (int i = 0; i < ColumnCount; i++) + { + for (int j = 0; j < d; j++) + { + result.At(i, j, _values[index].Conjugate()*diagonal[j]); + index++; + } + index += (RowCount - d); + } + return; + } + + base.DoConjugateTransposeThisAndMultiply(other, result); + } + /// /// Negate 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 b9f248d2..abcf6d44 100644 --- a/src/Numerics/LinearAlgebra/Complex32/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/Matrix.cs @@ -287,6 +287,27 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 } } + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeAndMultiply(Matrix other, Matrix result) + { + for (var j = 0; j < other.RowCount; j++) + { + for (var i = 0; i < RowCount; i++) + { + var s = Complex32.Zero; + for (var l = 0; l < ColumnCount; l++) + { + s += At(i, l)*other.At(j, l).Conjugate(); + } + result.At(i, j, s); + } + } + } + /// /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. /// @@ -308,6 +329,27 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 } } + /// + /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Matrix other, Matrix result) + { + for (var j = 0; j < other.ColumnCount; j++) + { + for (var i = 0; i < ColumnCount; i++) + { + var s = Complex32.Zero; + for (var l = 0; l < RowCount; l++) + { + s += At(l, i).Conjugate()*other.At(l, j); + } + result.At(i, j, s); + } + } + } + /// /// Multiplies the transpose of this matrix with a vector and places the results into the result vector. /// @@ -326,6 +368,24 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 } } + /// + /// Multiplies the conjugate transpose of this matrix with a vector and places the results into the result vector. + /// + /// The vector to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Vector rightSide, Vector result) + { + for (var i = 0; i < ColumnCount; i++) + { + var s = Complex32.Zero; + for (var j = 0; j < RowCount; j++) + { + s += At(j, i).Conjugate()*rightSide[j]; + } + result[i] = s; + } + } + /// /// Negate 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 b70d67f7..a2ff1428 100644 --- a/src/Numerics/LinearAlgebra/Double/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Double/Matrix.cs @@ -277,6 +277,16 @@ namespace MathNet.Numerics.LinearAlgebra.Double } } + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override sealed void DoConjugateTransposeAndMultiply(Matrix other, Matrix result) + { + DoTransposeAndMultiply(other, result); + } + /// /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. /// @@ -298,6 +308,16 @@ namespace MathNet.Numerics.LinearAlgebra.Double } } + /// + /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override sealed void DoConjugateTransposeThisAndMultiply(Matrix other, Matrix result) + { + DoTransposeThisAndMultiply(other, result); + } + /// /// Multiplies the transpose of this matrix with a vector and places the results into the result vector. /// @@ -316,6 +336,16 @@ namespace MathNet.Numerics.LinearAlgebra.Double } } + /// + /// Multiplies the conjugate transpose of this matrix with a vector and places the results into the result vector. + /// + /// The vector to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Vector rightSide, Vector result) + { + DoTransposeThisAndMultiply(rightSide, result); + } + /// /// Negate each element of this matrix and place the results into the result matrix. /// diff --git a/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs b/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs index b6e3b44d..1d778495 100644 --- a/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs +++ b/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs @@ -122,12 +122,19 @@ namespace MathNet.Numerics.LinearAlgebra protected abstract void DoMultiply(Matrix other, Matrix result); /// - /// Multiplies this matrix with transpose of another matrix and places the results into the result matrix. + /// Multiplies this matrix with the transpose of another matrix and places the results into the result matrix. /// /// The matrix to multiply with. /// The result of the multiplication. protected abstract void DoTransposeAndMultiply(Matrix other, Matrix result); + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected abstract void DoConjugateTransposeAndMultiply(Matrix other, Matrix result); + /// /// Multiplies the transpose of this matrix with a vector and places the results into the result vector. /// @@ -135,6 +142,13 @@ namespace MathNet.Numerics.LinearAlgebra /// The result of the multiplication. protected abstract void DoTransposeThisAndMultiply(Vector rightSide, Vector result); + /// + /// Multiplies the conjugate transpose of this matrix with a vector and places the results into the result vector. + /// + /// The vector to multiply with. + /// The result of the multiplication. + protected abstract void DoConjugateTransposeThisAndMultiply(Vector rightSide, Vector result); + /// /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. /// @@ -142,6 +156,13 @@ namespace MathNet.Numerics.LinearAlgebra /// The result of the multiplication. protected abstract void DoTransposeThisAndMultiply(Matrix other, Matrix result); + /// + /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected abstract void DoConjugateTransposeThisAndMultiply(Matrix other, Matrix result); + /// /// Divides each element of the matrix by a scalar and places results into the result matrix. /// @@ -807,6 +828,145 @@ namespace MathNet.Numerics.LinearAlgebra return result; } + + + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + /// If this.Columns != other.ColumnCount. + /// If the result matrix's dimensions are not the this.RowCount x other.RowCount. + public virtual void ConjugateTransposeAndMultiply(Matrix other, Matrix result) + { + if (ColumnCount != other.ColumnCount || result.RowCount != RowCount || result.ColumnCount != other.RowCount) + { + throw DimensionsDontMatch(this, other, result); + } + + if (ReferenceEquals(this, result) || ReferenceEquals(other, result)) + { + var tmp = Build.SameAs(result); + DoConjugateTransposeAndMultiply(other, tmp); + tmp.CopyTo(result); + } + else + { + DoConjugateTransposeAndMultiply(other, result); + } + } + + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and returns the result. + /// + /// The matrix to multiply with. + /// If this.Columns != other.ColumnCount. + /// The result of the multiplication. + public Matrix ConjugateTransposeAndMultiply(Matrix other) + { + if (ColumnCount != other.ColumnCount) + { + throw DimensionsDontMatch(this, other); + } + + var result = Build.SameAs(this, other, RowCount, other.RowCount); + DoConjugateTransposeAndMultiply(other, result); + return result; + } + + /// + /// Multiplies the conjugate transpose of this matrix by a vector and returns the result. + /// + /// The vector to multiply with. + /// The result of the multiplication. + /// If this.RowCount != rightSide.Count. + public Vector ConjugateTransposeThisAndMultiply(Vector rightSide) + { + if (RowCount != rightSide.Count) + { + throw DimensionsDontMatch(this, rightSide, "rightSide"); + } + + var result = Vector.Build.SameAs(this, rightSide, ColumnCount); + DoConjugateTransposeThisAndMultiply(rightSide, result); + return result; + } + + /// + /// Multiplies the conjugate transpose of this matrix with a vector and places the results into the result vector. + /// + /// The vector to multiply with. + /// The result of the multiplication. + /// If result.Count != this.ColumnCount. + /// If this.RowCount != .Count. + public void ConjugateTransposeThisAndMultiply(Vector rightSide, Vector result) + { + if (RowCount != rightSide.Count) + { + throw DimensionsDontMatch(this, rightSide, "rightSide"); + } + + if (ColumnCount != result.Count) + { + throw DimensionsDontMatch(this, result, "result"); + } + + if (ReferenceEquals(rightSide, result)) + { + var tmp = Vector.Build.SameAs(result); + DoConjugateTransposeThisAndMultiply(rightSide, tmp); + tmp.CopyTo(result); + } + else + { + DoConjugateTransposeThisAndMultiply(rightSide, result); + } + } + + /// + /// Multiplies the conjugate transpose of this matrix with another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + /// If this.Rows != other.RowCount. + /// If the result matrix's dimensions are not the this.ColumnCount x other.ColumnCount. + public void ConjugateTransposeThisAndMultiply(Matrix other, Matrix result) + { + if (RowCount != other.RowCount || result.RowCount != ColumnCount || result.ColumnCount != other.ColumnCount) + { + throw DimensionsDontMatch(this, other, result); + } + + if (ReferenceEquals(this, result) || ReferenceEquals(other, result)) + { + var tmp = Build.SameAs(result); + DoConjugateTransposeThisAndMultiply(other, tmp); + tmp.CopyTo(result); + } + else + { + DoConjugateTransposeThisAndMultiply(other, result); + } + } + + /// + /// Multiplies the conjugate transpose of this matrix with another matrix and returns the result. + /// + /// The matrix to multiply with. + /// If this.Rows != other.RowCount. + /// The result of the multiplication. + public Matrix ConjugateTransposeThisAndMultiply(Matrix other) + { + if (RowCount != other.RowCount) + { + throw DimensionsDontMatch(this, other); + } + + var result = Build.SameAs(this, other, ColumnCount, other.ColumnCount); + DoConjugateTransposeThisAndMultiply(other, result); + return result; + } + /// /// Negate each element of this matrix. /// diff --git a/src/Numerics/LinearAlgebra/Single/Matrix.cs b/src/Numerics/LinearAlgebra/Single/Matrix.cs index b8737c0e..a13fda54 100644 --- a/src/Numerics/LinearAlgebra/Single/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Single/Matrix.cs @@ -277,6 +277,16 @@ namespace MathNet.Numerics.LinearAlgebra.Single } } + /// + /// Multiplies this matrix with the conjugate transpose of another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override sealed void DoConjugateTransposeAndMultiply(Matrix other, Matrix result) + { + DoTransposeAndMultiply(other, result); + } + /// /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. /// @@ -298,6 +308,16 @@ namespace MathNet.Numerics.LinearAlgebra.Single } } + /// + /// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix. + /// + /// The matrix to multiply with. + /// The result of the multiplication. + protected override sealed void DoConjugateTransposeThisAndMultiply(Matrix other, Matrix result) + { + DoTransposeThisAndMultiply(other, result); + } + /// /// Multiplies the transpose of this matrix with a vector and places the results into the result vector. /// @@ -316,6 +336,16 @@ namespace MathNet.Numerics.LinearAlgebra.Single } } + /// + /// Multiplies the conjugate transpose of this matrix with a vector and places the results into the result vector. + /// + /// The vector to multiply with. + /// The result of the multiplication. + protected override void DoConjugateTransposeThisAndMultiply(Vector rightSide, Vector result) + { + DoTransposeThisAndMultiply(rightSide, result); + } + /// /// Computes the modulus for each element of the matrix. ///