Matrix::Power Method

Overload List

#SignatureDescription
1TMtxVec *Power(double Exponent) const;Raises base object elements to any power.
2TMtxVec *Power(TCplx Exponent) const;Raises all calling Matrix elements to complex power Exponent in-place.
3TMtxVec *Power(double Base, TMtxVec *Exponent) const;Raises base elements to exponent power.
4TMtxVec *Power(TCplx Base, TMtxVec *Exponent) const;Raises Base complex value to Exponent object values powers and store the results to calling object values.
5TMtxVec *Power(TMtxVec *Base, TMtxVec *Exponent) const;Raises each of Base object elements to corresponding power.
6TMtxVec *Power(TMtxVec *Base, TCplx Exponent) const;Raises each of the Base object elements to complex Exponent power.
7TMtxVec *Power(TMtxVec *Base, double Exponent) const;Raises each of the Base object elements to real Exponent power.

Overload 1: TMtxVec *Power(double Exponent) const;

Raises base object elements to any power.

#NameTypeDescription
1Exponentdouble
Remarks:

Raises Base calling object elements to any power. The Matrix::IntPower is faster, if Exponent is an integer. Real valued power can handle only positive Exponent. Matrix::IntPower can handle negative exponent also.

Note
To compute a power to the negative exponent in general case or when the base is negative, use the complex version of the function.

Examples
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a;

    a.SetIt(1, 4, false, DewArray<double>{1, 2, 3, 4});
    a.Power(1.2);
}
See Also: Matrix::IntPower, Matrix::PowerVec
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 2: TMtxVec *Power(TCplx Exponent) const;

Raises all calling Matrix elements to complex power Exponent in-place.

#NameTypeDescription
1ExponentTCplx
Remarks:

If the calling Matrix is real and has negative elements, the result will be NAN at those entries. To obtain a valid result in this case, extend the calling Matrix to complex with Matrix::ExtendToComplex method. In all real/complex combinations, the Power method will not automatically assume that a number is complex to speed up the computation. Alternatively the user can of course always convert the real numbers to complex before passing them to the Power routine.

Examples
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a;

    a = {{1, 2, 3, 4}};
    a.Power(1.2);
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 3: TMtxVec *Power(double Base, TMtxVec *Exponent) const;

Raises base elements to exponent power.

#NameTypeDescription
1Basedouble
2ExponentTMtxVec *
Remarks:

Raises Base value to Exponent object values powers and store the results to calling object values. Size and Matrix::Complex properties of calling object are adjusted automatically.

See Also: Matrix::PowerVec
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 4: TMtxVec *Power(TCplx Base, TMtxVec *Exponent) const;

Raises Base complex value to Exponent object values powers and store the results to calling object values.

#NameTypeDescription
1BaseTCplx
2ExponentTMtxVec *
Remarks:

Size and Matrix::Complex properties of calling object are adjusted automatically.

Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 5: TMtxVec *Power(TMtxVec *Base, TMtxVec *Exponent) const;

Raises each of Base object elements to corresponding power.

#NameTypeDescription
1BaseTMtxVec *
2ExponentTMtxVec *
Remarks:

Store the result in Exponenet elements:

Power[i] = Base[i]^Exponent[i]

Size and Matrix::Complex property of calling object are adjusted automatically. An exception is raised if Base and Exponent sizes do not match.

Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 6: TMtxVec *Power(TMtxVec *Base, TCplx Exponent) const;

Raises each of the Base object elements to complex Exponent power.

#NameTypeDescription
1BaseTMtxVec *
2ExponentTCplx
Remarks:

Size and Matrix::Complex properties of calling object are adjusted automatically.

Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 7: TMtxVec *Power(TMtxVec *Base, double Exponent) const;

Raises each of the Base object elements to real Exponent power.

#NameTypeDescription
1BaseTMtxVec *
2Exponentdouble
Remarks:

Size and Matrix::Complex properties of calling object are adjusted automatically.

Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler