MtxExpr::SqrAddScaled Function

Overload List

#SignatureDescription
1Vector SqrAddScaled(TVec *X, const double xScale, TMtxVec *Y, const double yScale);Compute sqr(X)*xScale + sqr(Y)*yScale
2Matrix SqrAddScaled(TMtx *X, const double xScale, TMtxVec *Y, const double yScale);Compute sqr(X)*xScale + sqr(Y)*yScale, when X is a matrix
3Vector SqrAddScaled(TVec *X, TMtxVec *Y, const double yScale);Compute sqr(X) + sqr(Y)*yScale
4Matrix SqrAddScaled(TMtx *X, TMtxVec *Y, const double yScale);Compute sqr(X) + sqr(Y)*yScale, when X is a Matrix.
5Vector SqrAddScaled(TVec *X, const TCplx &xScale, TMtxVec *Y, const TCplx &yScale);Compute sqr(X)*xScale + sqr(Y)*yScale
6Matrix SqrAddScaled(TMtx *X, const TCplx &xScale, TMtxVec *Y, const TCplx &yScale);Compute sqr(X)*xScale + sqr(Y)*yScale, where X is a Matrix
7Vector SqrAddScaled(TVec *X, TMtxVec *Y, const TCplx &yScale);Compute sqr(X) + sqr(Y)*yScale
8Matrix SqrAddScaled(TMtx *X, TMtxVec *Y, const TCplx &yScale);Compute sqr(X) + sqr(Y)*yScale, where X is a Matrix

Overload 1: Vector SqrAddScaled(TVec *X, const double xScale, TMtxVec *Y, const double yScale);

Compute sqr(X)*xScale + sqr(Y)*yScale

#NameTypeDescription
1XTVec *
2xScaleconst double
3YTMtxVec *
4yScaleconst double
Remarks:

Computes the weighted sum of the squares of X and Y without temporary objects.

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

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

void Example()
{
    double xScale = 2.0, yScale = 3.0;
    Vector X = { 1, 2, 3, 4 };
    Vector Y = { 2, 3, 4, 5 };
    Vector A1 = Sqr(X) * xScale + Sqr(Y) * yScale;
    Vector A2 = SqrAddScaled(X, xScale, Y, yScale);
    Vector A3;
    A3.SqrAddScaled(X, xScale, Y, yScale);

    if (!A2.IsEqual(A1)) ERaise("Problem");
    if (!A3.IsEqual(A1)) ERaise("Problem");
}
Declared in Dew::Math::Units::MtxExpr · Dew.Math/Units.MtxExpr.h · Cross-compiler

Overload 2: Matrix SqrAddScaled(TMtx *X, const double xScale, TMtxVec *Y, const double yScale);

Compute sqr(X)*xScale + sqr(Y)*yScale, when X is a matrix

#NameTypeDescription
1XTMtx *
2xScaleconst double
3YTMtxVec *
4yScaleconst double
Remarks:

The operation does only per-element math.

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

Overload 3: Vector SqrAddScaled(TVec *X, TMtxVec *Y, const double yScale);

Compute sqr(X) + sqr(Y)*yScale

#NameTypeDescription
1XTVec *
2YTMtxVec *
3yScaleconst double
Remarks:

Computes the sum of the square of X and the scaled square of Y without temporary objects.

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

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

void Example()
{
    double yScale = 2.0;
    Vector X = { 1, 2, 3, 4 };
    Vector Y = { 2, 3, 4, 5 };
    Vector A1 = Sqr(X) + Sqr(Y) * yScale;
    Vector A2 = SqrAddScaled(X, Y, yScale);
    Vector A3;
    A3.SqrAddScaled(X, Y, yScale);

    if (!A2.IsEqual(A1)) ERaise("Problem");
    if (!A3.IsEqual(A1)) ERaise("Problem");
}
Declared in Dew::Math::Units::MtxExpr · Dew.Math/Units.MtxExpr.h · Cross-compiler

Overload 4: Matrix SqrAddScaled(TMtx *X, TMtxVec *Y, const double yScale);

Compute sqr(X) + sqr(Y)*yScale, when X is a Matrix.

#NameTypeDescription
1XTMtx *
2YTMtxVec *
3yScaleconst double
Remarks:

The operation does only per-element math.

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

Overload 5: Vector SqrAddScaled(TVec *X, const TCplx &xScale, TMtxVec *Y, const TCplx &yScale);

Compute sqr(X)*xScale + sqr(Y)*yScale

#NameTypeDescription
1XTVec *
2xScaleconst TCplx &
3YTMtxVec *
4yScaleconst TCplx &
Declared in Dew::Math::Units::MtxExpr · Dew.Math/Units.MtxExpr.h · Cross-compiler

Overload 6: Matrix SqrAddScaled(TMtx *X, const TCplx &xScale, TMtxVec *Y, const TCplx &yScale);

Compute sqr(X)*xScale + sqr(Y)*yScale, where X is a Matrix

#NameTypeDescription
1XTMtx *
2xScaleconst TCplx &
3YTMtxVec *
4yScaleconst TCplx &
Declared in Dew::Math::Units::MtxExpr · Dew.Math/Units.MtxExpr.h · Cross-compiler

Overload 7: Vector SqrAddScaled(TVec *X, TMtxVec *Y, const TCplx &yScale);

Compute sqr(X) + sqr(Y)*yScale

#NameTypeDescription
1XTVec *
2YTMtxVec *
3yScaleconst TCplx &
Declared in Dew::Math::Units::MtxExpr · Dew.Math/Units.MtxExpr.h · Cross-compiler

Overload 8: Matrix SqrAddScaled(TMtx *X, TMtxVec *Y, const TCplx &yScale);

Compute sqr(X) + sqr(Y)*yScale, where X is a Matrix

#NameTypeDescription
1XTMtx *
2YTMtxVec *
3yScaleconst TCplx &
Declared in Dew::Math::Units::MtxExpr · Dew.Math/Units.MtxExpr.h · Cross-compiler