Matrix::IntPower Method

Overload List

#SignatureDescription
1TMtxVec *IntPower(int Exponent) const;Power (integer exponent).
2TMtxVec *IntPower(TMtxVec *Base, int Exponent) const;Calculate the power Base^(Exponent) for all Base object elements using the integer Exponent value and store the results in calling object.

Overload 1: TMtxVec *IntPower(int Exponent) const;

Power (integer exponent).

#NameTypeDescription
1Exponentint
Remarks:

Calculate the power ^(Exponent) for all caling object elements using the integer parameter Exponent. For non integer exponents, the Matrix::Power and Matrix::PowerVec methods can be used.

Examples
#include "MtxExpr.h"
#include "Units.MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxExpr;

void Example()
{
    Matrix a, b;

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

Overload 2: TMtxVec *IntPower(TMtxVec *Base, int Exponent) const;

Calculate the power Base^(Exponent) for all Base object elements using the integer Exponent value and store the results in calling object.

#NameTypeDescription
1BaseTMtxVec *
2Exponentint
Remarks:

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

Examples
#include "MtxExpr.h"
#include "Units.MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxExpr;

void Example()
{
    Matrix a, b;

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