You are here: Symbol Reference > clMtxExpr Namespace > Classes > clVector Record > public > NormL2 Method > clVector.NormL2 Method (TOpenCLMtxVec, boolean)
MtxVec VCL
ContentsIndex
PreviousUpNext
clVector.NormL2 Method (TOpenCLMtxVec, boolean)

The L2-norm.

Pascal
function NormL2(const Vec: TOpenCLMtxVec; RelativeError: boolean = False): double; overload;

L2 norm, defined by ||V-Vec||, where V is calling vector.

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

 

 

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

 

 

 

var a,b: clVector; c: double; begin a.CopyFromArray( TDoubleArray.Create(1,2,3,4)); b.CopyFromArray( TDoubleArray.Create(4,3,2,1)); c := a.NormL2(b,True); end;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!