Matrix::Product Method

Overload List

#SignatureDescription
1double Product() const;Elements product.
2double Product(int Index, int Len) const;Returns the product for calling object elements [Index]..[Index+Len-1].
3void Product(TCplx &X) const;Calculate the product of all calling object complex elements.
4void Product(TCplx &X, int Index, int Len) const;Calculate the product for calling object complex elements [Index]..[Index+Len-1].
5void Product(double &X) const;Calculate the product of all calling object elements and store the result in real variable X.
6void Product(double &X, int Index, int Len) const;Calculate the product for calling object elements [Index]..[Index+Len-1] and store the result in real variable X.

Overload 1: double Product() const;

Elements product.

Returns: the product of all calling object elements:

Remarks:

An exception is raised if calling object Matrix::Complex property is true.

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

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

void Example()
{
    Matrix a;
    a.SetIt(2, 2, false, DewArray<double>{ 1.0, 2.0, 3.0, 4.0 });
    double result = a.Product();
    if (Abs(result - 24.0) > 1e-10)
        throw tException(DewString("Matrix.Product: expected 24.0, got ") + SampleToStr(result));
}
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a;
    double c;

    a.SetIt(1, 4, false, DewArray<double>{1, 2, 3, 4});
    c = a.Product(); // c= 24
}
See Also: Matrix::Productc
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 2: double Product(int Index, int Len) const;

Returns the product for calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1Indexint
2Lenint
Remarks:

An exception is raised if array borders are overrun or underrun.

Examples
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a;
    double c;

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

Overload 3: void Product(TCplx &X) const;

Calculate the product of all calling object complex elements.

#NameTypeDescription
1XTCplx &
Remarks:

Store the result in complex variable X.

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

Overload 4: void Product(TCplx &X, int Index, int Len) const;

Calculate the product for calling object complex elements [Index]..[Index+Len-1].

#NameTypeDescription
1XTCplx &
2Indexint
3Lenint
Remarks:

Store the result in complex variable X. An exception is raised if array borders are overrun or underrun.

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

Overload 5: void Product(double &X) const;

Calculate the product of all calling object elements and store the result in real variable X.

#NameTypeDescription
1Xdouble &
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 6: void Product(double &X, int Index, int Len) const;

Calculate the product for calling object elements [Index]..[Index+Len-1] and store the result in real variable X.

#NameTypeDescription
1Xdouble &
2Indexint
3Lenint
Remarks:

An exception is raised if array borders are overrun or underrun.

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