diff --git a/src/Numerics/LinearAlgebra/Complex/Matrix.cs b/src/Numerics/LinearAlgebra/Complex/Matrix.cs
index e05d2b24..d11ca313 100644
--- a/src/Numerics/LinearAlgebra/Complex/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Matrix.cs
@@ -347,15 +347,25 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
}
///
- /// Pointwise raise this matrix to an exponent and store the result into the result vector.
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
///
/// The exponent to raise this matrix values to.
- /// The vector to store the result of the pointwise power.
+ /// The matrix to store the result of the pointwise power.
protected override void DoPointwisePower(Complex exponent, Matrix result)
{
Map(x => x.Power(exponent), result, Zeros.Include);
}
+ ///
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
+ ///
+ /// The exponent to raise this matrix values to.
+ /// The vector to store the result of the pointwise power.
+ protected override void DoPointwisePower(Matrix exponent, Matrix result)
+ {
+ Map2(Complex.Pow, result, Zeros.Include);
+ }
+
///
/// Pointwise canonical modulus, where the result has the sign of the divisor,
/// of 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 e8cf00a1..05c6e242 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Matrix.cs
@@ -342,15 +342,25 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
}
///
- /// Pointwise raise this matrix to an exponent and store the result into the result vector.
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
///
/// The exponent to raise this matrix values to.
- /// The vector to store the result of the pointwise power.
+ /// The matrix to store the result of the pointwise power.
protected override void DoPointwisePower(Complex32 exponent, Matrix result)
{
Map(x => x.Power(exponent), result, Zeros.Include);
}
+ ///
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
+ ///
+ /// The exponent to raise this matrix values to.
+ /// The vector to store the result of the pointwise power.
+ protected override void DoPointwisePower(Matrix exponent, Matrix result)
+ {
+ Map2(Complex32.Pow, result, Zeros.Include);
+ }
+
///
/// Pointwise canonical modulus, where the result has the sign of the divisor,
/// of 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 844695cd..4f894486 100644
--- a/src/Numerics/LinearAlgebra/Double/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Double/Matrix.cs
@@ -357,15 +357,25 @@ namespace MathNet.Numerics.LinearAlgebra.Double
}
///
- /// Pointwise raise this matrix to an exponent and store the result into the result vector.
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
///
/// The exponent to raise this matrix values to.
- /// The vector to store the result of the pointwise power.
+ /// The matrix to store the result of the pointwise power.
protected override void DoPointwisePower(double exponent, Matrix result)
{
Map(x => Math.Pow(x, exponent), result, exponent > 0.0 ? Zeros.AllowSkip : Zeros.Include);
}
+ ///
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
+ ///
+ /// The exponent to raise this matrix values to.
+ /// The vector to store the result of the pointwise power.
+ protected override void DoPointwisePower(Matrix exponent, Matrix result)
+ {
+ Map2(Math.Pow, result, Zeros.Include);
+ }
+
///
/// Pointwise canonical modulus, where the result has the sign of the divisor,
/// of this matrix with another matrix and stores the result into the result matrix.
diff --git a/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs b/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs
index 2ca829a2..13ca4c02 100644
--- a/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs
+++ b/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs
@@ -224,12 +224,19 @@ namespace MathNet.Numerics.LinearAlgebra
protected abstract void DoPointwiseDivide(Matrix divisor, Matrix result);
///
- /// Pointwise raise this matrix to an exponent and store the result into the result vector.
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
///
/// The exponent to raise this matrix values to.
- /// The vector to store the result of the pointwise power.
+ /// The matrix to store the result of the pointwise power.
protected abstract void DoPointwisePower(T exponent, Matrix result);
+ ///
+ /// Pointwise raise this matrix to an exponent matrix and store the result into the result matrix.
+ ///
+ /// The exponent matrix to raise this matrix values to.
+ /// The matrix to store the result of the pointwise power.
+ protected abstract void DoPointwisePower(Matrix exponent, Matrix result);
+
///
/// Pointwise canonical modulus, where the result has the sign of the divisor,
/// of this matrix with another matrix and stores the result into the result matrix.
@@ -1391,6 +1398,38 @@ namespace MathNet.Numerics.LinearAlgebra
DoPointwisePower(exponent, result);
}
+ ///
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
+ ///
+ /// The exponent to raise this matrix values to.
+ public Matrix PointwisePower(Matrix exponent)
+ {
+ if (ColumnCount != exponent.ColumnCount || RowCount != exponent.RowCount)
+ {
+ throw DimensionsDontMatch(this, exponent);
+ }
+
+ var result = Build.SameAs(this);
+ DoPointwisePower(exponent, result);
+ return result;
+ }
+
+ ///
+ /// Pointwise raise this matrix to an exponent.
+ ///
+ /// The exponent to raise this matrix values to.
+ /// The matrix to store the result into.
+ /// If this matrix and are not the same size.
+ public void PointwisePower(Matrix exponent, Matrix result)
+ {
+ if (ColumnCount != result.ColumnCount || RowCount != result.RowCount || ColumnCount != exponent.ColumnCount || RowCount != exponent.RowCount)
+ {
+ throw DimensionsDontMatch(this, exponent, result);
+ }
+
+ DoPointwisePower(exponent, result);
+ }
+
///
/// Pointwise canonical modulus, where the result has the sign of the divisor,
/// of this matrix by another matrix.
diff --git a/src/Numerics/LinearAlgebra/Single/Matrix.cs b/src/Numerics/LinearAlgebra/Single/Matrix.cs
index 54c7ca65..2e1dea8b 100644
--- a/src/Numerics/LinearAlgebra/Single/Matrix.cs
+++ b/src/Numerics/LinearAlgebra/Single/Matrix.cs
@@ -357,15 +357,25 @@ namespace MathNet.Numerics.LinearAlgebra.Single
}
///
- /// Pointwise raise this matrix to an exponent and store the result into the result vector.
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
///
/// The exponent to raise this matrix values to.
- /// The vector to store the result of the pointwise power.
+ /// The matrix to store the result of the pointwise power.
protected override void DoPointwisePower(float exponent, Matrix result)
{
Map(x => (float)Math.Pow(x, exponent), result, exponent > 0.0f ? Zeros.AllowSkip : Zeros.Include);
}
+ ///
+ /// Pointwise raise this matrix to an exponent and store the result into the result matrix.
+ ///
+ /// The exponent to raise this matrix values to.
+ /// The vector to store the result of the pointwise power.
+ protected override void DoPointwisePower(Matrix exponent, Matrix result)
+ {
+ Map2((x, y) => (float)Math.Pow(x, y), result, Zeros.Include);
+ }
+
///
/// Pointwise canonical modulus, where the result has the sign of the divisor,
/// of this matrix with another matrix and stores the result into the result matrix.