clVector::NormC Method

Overload List

#SignatureDescription
1double NormC(TOpenCLMtxVec *Vec, bool RelativeError = false) const;The C-norm.
2double NormC(TOpenCLMtxVec *Vec, int VecIndex, int Index, int Len, bool RelativeError = false) const;Calculates the C norm ||V-Vec|| between Vec elements [VecIndex]..[VecIndex+Len-1] and calling vector elements [Index]..[Index+Len-1].
3double NormC() const;Calculate the C-norm of calling vector.
4double NormC(int Index, int Len) const;Calculates the C norm from calling vector elements [Index]..[Index+Len-1].

Overload 1: double NormC(TOpenCLMtxVec *Vec, bool RelativeError = false) const;

The C-norm.

#NameTypeDescription
1VecTOpenCLMtxVec *
2RelativeError = falsebool

Returns: C norm: ||V-Vec||, where V is the calling vector.

Remarks:

If the NormC is called without any parameters, the NormC calculates the norm of the calling vector. The C norm of ||V-Vec|| is defined by the formula:

∥V−Vec∥C=max⁡k∣V[k]−Vec[k]∣\|\text{V} - \text{Vec}\| _C = \max _k |\text{V}[k]-\text{Vec}[k]|

If RelativeError is true then the computed norm is divided by the norm of V, and the function returns the "relative error":

∥V−Vec∥∥V∥\frac{\| \text{V} - \text{Vec}\|}{\|\text{V}\|}
Examples
#include "Units.clMtxVec.h"
#include "clMtxVec.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::ClMtxVec;

void Example()
{
    TOpenCLVector *a, *b;
    CreateIt(a, b);
    a->CopyFromArray(DewArray<double>{1,2,3,4});
    a->CopyFromArray(DewArray<double>{4,3,2,1});
    double c = a->NormC(b,true);
    FreeIt(a,b);
}
See Also: clVector::NormL1, clVector::NormL2
Declared in Dew::Math::clVector · Dew.Math/clMtxExpr.h · Cross-compiler

Overload 2: double NormC(TOpenCLMtxVec *Vec, int VecIndex, int Index, int Len, bool RelativeError = false) const;

Calculates the C norm ||V-Vec|| between Vec elements [VecIndex]..[VecIndex+Len-1] and calling vector elements [Index]..[Index+Len-1].

#NameTypeDescription
1VecTOpenCLMtxVec *
2VecIndexint
3Indexint
4Lenint
5RelativeError = falsebool
Declared in Dew::Math::clVector · Dew.Math/clMtxExpr.h · Cross-compiler

Overload 3: double NormC() const;

Calculate the C-norm of calling vector.

Returns: NormC = max|a[i]|, 0 < i < Length-1 .

Declared in Dew::Math::clVector · Dew.Math/clMtxExpr.h · Cross-compiler

Overload 4: double NormC(int Index, int Len) const;

Calculates the C norm from calling vector elements [Index]..[Index+Len-1].

#NameTypeDescription
1Indexint
2Lenint
Declared in Dew::Math::clVector · Dew.Math/clMtxExpr.h · Cross-compiler