Matrix.NormL1 Method

Overload List

#SignatureDescription
1function NormL1: Double;The L1-norm of the calling Matrix.
└ indexed: function NormL1(Index: Integer; Len: Integer): Double;
2function NormL1(const Vec: TDenseMtxVec; RelativeError: Boolean): Double;The L1-norm.
└ indexed: function NormL1(const Vec: TDenseMtxVec; VecIndex: Integer; Index: Integer; Len: Integer; RelativeError: Boolean): Double;

Overload 1: function NormL1: Double;

The L1-norm of the calling Matrix.

Returns: Double

Remarks:

Calculates:

NormL1 = sum | a[i] |, 0 < i < Length-1

Indexed: function NormL1(Index: Integer; Len: Integer): Double;

Calculates the L1 norm from calling Matrix elements [Index]..[Index+Len-1].

#NameTypeDescription
1IndexIntegerstart index
2LenIntegerelement count

Returns: Double

Overload 2: function NormL1(const Vec: TDenseMtxVec; RelativeError: Boolean): Double;

The L1-norm.

#NameTypeDescription
1VecTDenseMtxVec
2RelativeErrorBoolean

Returns: Double

Remarks:

Calculates the L1 norm : ||V-Vec||, where V is calling Matrix. If the NormL1 is called without any parameters, the NormL1 calculates the norm of calling Matrix. The L1 norm of ||V-Vec|| is defined by the formula:

VVecL1=k=0Length1V[k]Vec[k]\|\text{V} - \text{Vec}\| _{L1} = \sum _{k=0} ^{\text{Length}-1}|\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":

VVecV\frac{\| \text{V} - \text{Vec}\|}{\|\text{V}\|}
Examples
var a,b: Matrix;
    c: double;
begin
    a.SetIt(1,4,False,[1,2,3,4]);
    b.SetIt(1,4,False,[4,3,2,1]);
    c := a.NormL1(b,True);
end;
See Also: Matrix.NormC, Matrix.NormL2

Indexed: function NormL1(const Vec: TDenseMtxVec; VecIndex: Integer; Index: Integer; Len: Integer; RelativeError: Boolean): Double;

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

#NameTypeDescription
1VecTDenseMtxVec
2VecIndexInteger
3IndexIntegerstart index
4LenIntegerelement count
5RelativeErrorBoolean

Returns: Double