diff --git a/src/Numerics/LinearAlgebra/Complex/Matrix.cs b/src/Numerics/LinearAlgebra/Complex/Matrix.cs
index cb7a8c9c..d842bd52 100644
--- a/src/Numerics/LinearAlgebra/Complex/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Matrix.cs
@@ -301,6 +301,21 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
}
}
+ ///
+ /// Complex conjugates each element of this matrix and place the results into the result matrix.
+ ///
+ /// The result of the conjugation.
+ protected override void DoConjugate(Matrix result)
+ {
+ for (var i = 0; i < RowCount; i++)
+ {
+ for (var j = 0; j != ColumnCount; j++)
+ {
+ result.At(i, j, At(i, j).Conjugate());
+ }
+ }
+ }
+
///
/// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.
///
diff --git a/src/Numerics/LinearAlgebra/Complex32/Matrix.cs b/src/Numerics/LinearAlgebra/Complex32/Matrix.cs
index ae6c0b83..4c4165cd 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Matrix.cs
@@ -301,6 +301,21 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
}
}
+ ///
+ /// Complex conjugates each element of this matrix and place the results into the result matrix.
+ ///
+ /// The result of the conjugation.
+ protected override void DoConjugate(Matrix result)
+ {
+ for (var i = 0; i < RowCount; i++)
+ {
+ for (var j = 0; j != ColumnCount; j++)
+ {
+ result.At(i, j, At(i, j).Conjugate());
+ }
+ }
+ }
+
///
/// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.
///
diff --git a/src/Numerics/LinearAlgebra/Double/Matrix.cs b/src/Numerics/LinearAlgebra/Double/Matrix.cs
index a15f119b..65ca4499 100644
--- a/src/Numerics/LinearAlgebra/Double/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Double/Matrix.cs
@@ -291,6 +291,20 @@ namespace MathNet.Numerics.LinearAlgebra.Double
}
}
+ ///
+ /// Complex conjugates each element of this matrix and place the results into the result matrix.
+ ///
+ /// The result of the conjugation.
+ protected override void DoConjugate(Matrix result)
+ {
+ if (ReferenceEquals(this, result))
+ {
+ return;
+ }
+
+ CopyTo(result);
+ }
+
///
/// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.
///
diff --git a/src/Numerics/LinearAlgebra/Generic/Matrix.Arithmetic.cs b/src/Numerics/LinearAlgebra/Generic/Matrix.Arithmetic.cs
index 0bfaa5ef..3201bbbc 100644
--- a/src/Numerics/LinearAlgebra/Generic/Matrix.Arithmetic.cs
+++ b/src/Numerics/LinearAlgebra/Generic/Matrix.Arithmetic.cs
@@ -56,6 +56,12 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
/// The result of the negation.
protected abstract void DoNegate(Matrix result);
+ ///
+ /// Complex conjugates each element of this matrix and place the results into the result matrix.
+ ///
+ /// The result of the conjugation.
+ protected abstract void DoConjugate(Matrix result);
+
///
/// Adds another matrix to this matrix.
///
@@ -804,6 +810,38 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
DoNegate(result);
}
+ ///
+ /// Complex conjugate each element of this matrix.
+ ///
+ /// A matrix containing the conjugated values.
+ public Matrix Conjugate()
+ {
+ var result = CreateMatrix(RowCount, ColumnCount);
+ DoConjugate(result);
+ return result;
+ }
+
+ ///
+ /// Complex conjugate each element of this matrix and place the results into the result matrix.
+ ///
+ /// The result of the conjugation.
+ /// If the result matrix is .
+ /// if the result matrix's dimensions are not the same as this matrix.
+ public void Conjugate(Matrix result)
+ {
+ if (result == null)
+ {
+ throw new ArgumentNullException("result");
+ }
+
+ if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
+ {
+ throw DimensionsDontMatch(this, result);
+ }
+
+ DoConjugate(result);
+ }
+
///
/// Adds two matrices together and returns the results.
///
diff --git a/src/Numerics/LinearAlgebra/Single/Matrix.cs b/src/Numerics/LinearAlgebra/Single/Matrix.cs
index db6d1464..9d46ce06 100644
--- a/src/Numerics/LinearAlgebra/Single/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Single/Matrix.cs
@@ -307,6 +307,20 @@ namespace MathNet.Numerics.LinearAlgebra.Single
}
}
+ ///
+ /// Complex conjugates each element of this matrix and place the results into the result matrix.
+ ///
+ /// The result of the conjugation.
+ protected override void DoConjugate(Matrix result)
+ {
+ if (ReferenceEquals(this, result))
+ {
+ return;
+ }
+
+ CopyTo(result);
+ }
+
///
/// Pointwise multiplies this matrix with another matrix and stores the result into the result matrix.
///