Example: Calculation of L2 Distance between points x = (1,1) and y = (4,5).

 

Function call: sqrt_quadratic(pmatrix_1).

 

pmatrix_1:

 

  x1  x2  y1  y2

 

  (1,1)        1

  (2,2)        1

  (1,3)       -2

  (3,3)        1

  (2,4)       -2

  (4,4)        1

 

The pmatrix_1 is in file pmatrix_1.txt in PSG PMatrix format (see, Sparse (Packed) Matrix Format).

L2 Distance is calculated at point_1:

 

component_name

value

x1

x2

y1

y2

1

1

4

5

 

The point point_1 is in file point_1.txt (see, PSG Point).

 

To calculate L2 Distance at point_1 run problem in file problem_L2_Distance.txt (see, Calculate Problem):

 

calculate          

point: point_1      

value:              

 sqrt_quadratic(pmatrix_1)

 

Value of sqrt_quadratic(pmatrix_1) at point_1 equals 5

Files problem_L2_Distance.txt, pmatrix_1.txt, and point_1.txt are in folder .\Aorda\PSG\Examples\Functions\L2_Distance_test