DISLI

This function computes the infinity norm distance between two points.

Function Return Value

DISLI — Infinity norm distance between the points X and Y. (Output)

Required Arguments

X — Vector of length max(N * INCX, 1). (Input)

Y — Vector of length max(N * INCY, 1). (Input)

Optional Arguments

N — Length of the vectors X and Y. (Input)
Default: N = SIZE (X,1).

INCX — Displacement between elements of X. (Input)
The I-th element of X is X(1 + (I  1) *  INCX) if INCX is greater than or equal to zero, or X(1 + (I  N* INCX) if INCX is less than zero.
Default: INCX = 1.

INCY — Displacement between elements of Y. (Input)
The I-th element of Y is Y(1 + (I  1) * INCY) if INCY is greater than or equal to zero, or Y(1 + (I  N* INCY) if INCY is less than zero.
Default: INCY = 1.

FORTRAN 90 Interface

Generic: DISLI (X, Y [])

Specific: The specific interface names are S_DISLI and D_DISLI.

FORTRAN 77 Interface

Single: DISLI(N, X, INCX, Y, INCY)

Double: The double precision function function name is DDISLI.

Description

The function DISLI computes the -norm distance between two points x and y. The -norm distance is defined to be

 

Example

Compute the -norm distance between two vectors of length 4.

 

USE DISLI_INT

USE UMACH_INT

 

IMPLICIT NONE

! Declare variables

INTEGER INCX, INCY, N

PARAMETER (N=4)

!

INTEGER NOUT

REAL VAL, X(N), Y(N)

!

! Set values for X and Y

! X = ( 1.0 -1.0 0.0 2.0 )

!

! Y = ( 4.0 2.0 1.0 -3.0 )

!

DATA X/1.0, -1.0, 0.0, 2.0/

DATA Y/4.0, 2.0, 1.0, -3.0/

! Compute L-infinity distance

VAL = DISLI(X,Y)

! Print results

CALL UMACH (2, NOUT)

WRITE (NOUT,*) ' The infinity-norm distance is ', VAL

END

Output

 

The infinity-norm distance is 5.00000