## Metric Induced by a Norm

A metric on a space**X**is a nonnegative real-valued function

*d*:

**X**×

**X**→

*R*such that

*d(x,x) = 0*∀

*x*∈

**X**,

*d(x,y) = d(y,x)*∀

*x,y*∈

**X**, and

*d(x,z)*≤

*d(x,y) + d(y,z)*∀

*x,y,z*∈

**X**. If (

**V**, |·|) is a normed linearspace, then the function

*d*:

**V**×

**V**→

*R*defined by

*d(v,w)*= ||

*v - w*|| defines a metric on

**V**.

The three most commonly used norms are the *l*_{1}-norm with the induced metric defined as

||

**v - w**|| = ||*v*_{0}-*w*_{0}|| + ··· + ||*v*_{n-1}-*w*_{n-1}||,the

*l*

_{2}-norm with the induced metric defined as

||

**v - w**|| = [|*v*_{0}-*w*_{0}|² + ··· + |*v*_{n-1}-*w*_{n-1}|² ]^{½},and the

*l*

_{∞}-norm or max norm or sup norm with the induced metric defined as

||

**v - w**|| =*max*{|*v*_{i}-*w*_{i}| : 0 ≤*i*<*n*},where

**v**=

*v*

_{0}

**e**

_{0}+ ··· +

*v*

_{n-1}

**e**

_{n-1}and

**w**=

*w*

_{0}

**e**

_{0}+ ··· +

*w*

_{n-1}relative to the set of basis vectors {

**e**

_{0}, ···,

**e**

_{n-1}}. Note that the norm of a basis vector is 1.

The source code for evaluating the metrics induced by the

*l*

_{1},

*l*

_{2}, and

*sup*or

*max*norms are given below. The function for evaluating the metric induced by the

*l*

_{1}norm on a real vector space is Vector_L1_Norm_Metric, the function for evaluating the metric induced by the

*l*

_{2}norm on a real vector space is Vector_L2_Norm_Metric, the function for evaluating the metric induced by the

*max*norm on a real vector space is Vector_Max_Norm_Metric, the function for evaluating the metric induced by the

*l*

_{1}norm on a complex vector space is CVector_L1_Norm_Metric, the function for evaluating the metric induced by the

*l*

_{2}norm on a complex vector space is CVector_L2_Norm_Metric, and the function for evaluating the metric induced by the

*max*norm on a complex vector space is CVector_Max_Norm_Metric. There are special versions of these routines for the cases of the ubiquitous

*2*-d and

*3*-d vector spaces.

### Function List

- double Vector_L1_Norm_Metric( double v[ ], double w[ ], int n )

This routine calculates the metric associated with the*l*_{1}-norm of two*n*-dimensional real vectors**v**and**w**, |**v**-**w**| = |*v*[0] -*w*[0] | + ··· + |*v*[n-1] -*w*[n-1] |.

- double Vector_L1_Norm_Metric_2d( double v[ ], double w[ ] )

This routine calculates the metric associated with the*l*_{1}-norm of the*2*-dimensional real vectors**v**and**w**, |**v**-**w**| = |*v*[0] -*w*[0] | + |*v*[1] -*w*[1] |.

- double Vector_L1_Norm_Metric_3d( double v[ ], double w[ ] )

This routine calculates the metric associated with the*l*_{1}-norm of the*3*-dimensional real vectors**v**and**w**, |**v**-**w**| = |*v*[0] -*w*[0] | + |*v*[1] -*w*[1] | + |*v*[2] -*w*[2] |.

- double Vector_L2_Norm_Metric( double v[ ], double w[ ], int n )

This routine calculates the metric associated with the*l*_{2}-norm of the*n*-dimensional real vectors**v**and**w**, |**v**-**w**| =[(*v*_{0}-*w*_{0})² + ··· + (*v*_{n-1}-*w*_{n-1})²]^{½}.

- double Vector_L2_Norm_Metric_2d( double v[ ], double w[ ] )

This routine calculates the metric associated with the*l*_{2}-norm of the*2*-dimensional real vectors**v**and**w**, |**v**-**w**| = [ (*v*[0] -*w*[0])² + (*v*[1] -*w*[1])² ]^{½}.

- double Vector_L2_Norm_Metric_3d( double v[ ], double w[ ] )

This routine calculates the metric associated with the*l*_{2}-norm of the*3*-dimensional real vectors**v**and**w**, |**v**-**w**| = [ (*v*[0] -*w*[0])² + (*v*[1] -*w*[1])² + (*v*[2] -*w*[2])²]^{½}.

- double Vector_Max_Norm_Metric( double v[ ], double w[ ], int n )

This routine calculates the metric associated with the*max*-norm of the*n*-dimensional real vectors**v**and**w**, |**v**-**w**| =*max*{|*v*_{i}-*w*_{i}| : 0 ≤*i*<*n*}.

- double Vector_Max_Norm_Metric_2d( double v[ ], double w[ ] )

This routine calculates the metric associated with the*max*-norm of the*2*-dimensional real vectors**v**and**w**, |**v**-**w**| =*max*{|*v*[0] -*w*[0] |, |*v*[1] -*w*[1] |}.

- double Vector_Max_Norm_Metric_3d( double v[ ], double w[ ] )

This routine calculates the metric associated with the*max*-norm of the*3*-dimensional real vectors**v**and**w**, |**v**-**w**| =*max*{|*v*[0] -*w*[0] |, |*v*[1] -*w*[1] |, |*v*[2] -*w*[2] |}.

- double CVector_L1_Norm_Metric( double complex v[ ], double complex w[ ], int n )

This routine calculates the metric associated with the*l*_{1}-norm of two*n*-dimensional complex vectors**v**and**w**, |**v**-**w**| = |*v*[0] -*w*[0] | + ··· + |*v*[n-1] -*w*[n-1] |.

- double CVector_L1_Norm_Metric_2d( double complex v[ ], double complex w[ ] )

This routine calculates the metric associated with the*l*_{1}-norm of the*2*-dimensional complex vectors**v**and**w**, |**v**-**w**| = |*v*[0] -*w*[0] | + |*v*[1] -*w*[1] |.

- double CVector_L1_Norm_Metric_3d( double complex v[ ], double complex w[ ] )

This routine calculates the metric associated with the*l*_{1}-norm of the*3*-dimensional complex vectors**v**and**w**, |**v**-**w**| = |*v*[0] -*w*[0] | + |*v*[1] -*w*[1] | + |*v*[2] -*w*[2] |.

- double CVector_L2_Norm_Metric( double complex v[ ], double complex w[ ], int n )

This routine calculates the metric associated with the*l*_{2}-norm of the*n*-dimensional complex vectors**v**and**w**, |**v**-**w**| =[(*v*_{0}-*w*_{0})² + ··· + (*v*_{n-1}-*w*_{n-1})²]^{½}.

- double CVector_L2_Norm_Metric_2d( double complex v[ ], double complex w[ ] )

This routine calculates the metric associated with the*l*_{2}-norm of the*2*-dimensional complex vectors**v**and**w**, |**v**-**w**| = [ (*v*[0] -*w*[0])² + (*v*[1] -*w*[1])² ]^{½}.

- double CVector_L2_Norm_Metric_3d( double complex v[ ], double complex w[ ] )

This routine calculates the metric associated with the*l*_{2}-norm of the*3*-dimensional complex vectors**v**and**w**, |**v**-**w**| = [ (*v*[0] -*w*[0])² + (*v*[1] -*w*[1])² + (*v*[2] -*w*[2])²]^{½}.

- double CVector_Max_Norm_Metric( double complex v[ ], double complex w[ ], int n )

This routine calculates the metric associated with the*max*-norm of the*n*-dimensional complex vectors**v**and**w**, |**v**-**w**| =*max*{|*v*_{i}-*w*_{i}| : 0 ≤*i*<*n*}.

- double CVector_Max_Norm_Metric_2d( double complex v[ ], double complex w[ ] )

This routine calculates the metric associated with the*max*-norm of the*2*-dimensional complex vectors**v**and**w**, |**v**-**w**| =*max*{|*v*[0] -*w*[0] |, |*v*[1] -*w*[1] |}.

- double CVector_Max_Norm_Metric_3d( double complex v[ ], double complex w[ ] )

This routine calculates the metric associated with the*max*-norm of the*3*-dimensional complex vectors**v**and**w**, |**v**-**w**| =*max*{|*v*[0] -*w*[0] |, |*v*[1] -*w*[1] |, |*v*[2] -*w*[2] |}.

*C* Source Code

- The file, vector_l1_norm_metric.c, contains the version of Vector_L1_Norm_Metric( ) written in
*C*.

- The file, vector_l1_norm_metric_2d.c, contains the version of Vector_L1_Norm_Metric_2d( ) written in
*C*.

- The file, vector_l1_norm_metric_3d.c, contains the version of Vector_L1_Norm_Metric_3d( ) written in
*C*.

- The file, vector_l2_norm_metric.c, contains the version of Vector_L2_Norm_Metric( ) written in
*C*.

- The file, vector_l2_norm_metric_2d.c, contains the version of Vector_L2_Norm_Metric_2d( ) written in
*C*.

- The file, vector_l2_norm_metric_3d.c, contains the version of Vector_L2_Norm_Metric_3d( ) written in
*C*.

- The file, vector_max_norm_metric.c, contains the version of Vector_Max_Norm_Metric( ) written in
*C*.

- The file, vector_max_norm_metric_2d.c, contains the version of Vector_Max_Norm_Metric_2d( ) written in
*C*.

- The file, vector_max_norm_metric_3d.c, contains the version of Vector_Max_Norm_Metric_3d( ) written in
*C*.

- The file, cvector_l1_norm_metric.c, contains the version of CVector_L1_Norm_Metric( ) written in
*C*.

- The file, cvector_l1_norm_metric_2d.c, contains the version of CVector_L1_Norm_Metric_2d( ) written in
*C*.

- The file, cvector_l1_norm_metric_3d.c, contains the version of CVector_L1_Norm_Metric_3d( ) written in
*C*.

- The file, cvector_l2_norm_metric.c, contains the version of CVector_L2_Norm_Metric( ) written in
*C*.

- The file, cvector_l2_norm_metric_2d.c, contains the version of CVector_L2_Norm_Metric_2d( ) written in
*C*.

- The file, cvector_l2_norm_metric_3d.c, contains the version of CVector_L2_Norm_Metric_3d( ) written in
*C*.

- The file, cvector_max_norm_metric.c, contains the version of CVector_Max_Norm_Metric( ) written in
*C*.

- The file, cvector_max_norm_metric_2d.c, contains the version of CVector_Max_Norm_Metric_2d( ) written in
*C*.

- The file, cvector_max_norm_metric_3d.c, contains the version of CVector_Max_Norm_Metric_3d( ) written in
*C*.

*NASM* Source Code

For Linux gcc Users

- The file, vector_l1_norm_metric.asm, contains the version of Vector_L1_Norm_Metric( ) written in
*NASM*.

- The file, vector_l1_norm_metrics_2d.asm, contains the version of Vector_L1_Norm_Metric_2d( ) written in
*NASM*.

- The file, vector_l1_norm_metric_3d.asm, contains the version of Vector_L1_Norm_Metric_2d( ) written in
*NASM*.

- The file, vector_l2_norm_metric.asm, contains the version of Vector_L2_Norm_Metric( ) written in
*NASM*.

- The file, vector_l2_norm_metric_2d.asm, contains the version of Vector_L2_Norm_Metric_2d( ) written in
*NASM*.

- The file, vector_l2_norm_metric_3d.asm, contains the version of Vector_L2_Norm_Metric_3d( ) written in
*NASM*.

- The file, vector_max_norm_metric.asm, contains the version of Vector_Max_Norm_Metric( ) written in
*NASM*.

- The file, vector_max_norm_metric_2d.asm contains the version of Vector_Max_Norm_Metric_2d( ) written in
*NASM*.

- The file, vector_max_norm_metric_3d.asm contains the version of Vector_Max_Norm_Metric_3d( ) written in
*NASM*.

*C* Test Code, Test Results, and Build Shell Script

- The file, testvectorl1metric.c, contains a test program of Vector_L1_Norm_Metric( ). This test program requires the file
*vector_l1_norm_metric.c*listed above.

- The file, VectorL1MetricTest.txt, contains the results of the test program testvectorl1metric.c.

- The file, testvectorl1metric.sh, contains the shell script used to compile, link, and execute the test program testvectorl1metric.c.

- The file, testvectorl1metric2d.c, contains a test program of Vector_L1_Norm_Metric_2d( ). This test program requires the file
*vector_l1_norm_metric_2d.c*listed above.

- The file, VectorL1Metric2dTest.txt, contains the results of the test program testvectorl1metric2d.c.

- The file, testvectorl1metric2d.sh, contains the shell script used to compile, link, and execute the test program testvectorl1metric2d.c.

- The file, testvectorl1metric3d.c, contains a test program of Vector_L1_Norm_Metric_3d( ). This test program requires the file
*vector_l1_norm_metric_3d.c*listed above.

- The file, VectorL1Metric3dTest.txt, contains the results of the test program testvectorl1metric3d.c.

- The file, testvectorl1metric3d.sh, contains the shell script used to compile, link, and execute the test program testvectorl1metric3d.c.

- The file, testvectorl2metric.c, contains a test program of Vector_L2_Norm_Metric( ). This test program requires the file
*vector_l2_norm_metric.c*listed above.

- The file, VectorL2MetricTest.txt, contains the results of the test program testvectorl2metric.c.

- The file, testvectorl2metric.sh, contains the shell script used to compile, link, and execute the test program testvectorl2metric.c.

- The file, testvectorl2metric2d.c, contains a test program of Vector_L2_Norm_Metric_2d( ). This test program requires the file
*vector_l2_norm_metric_2d.c*listed above.

- The file, VectorL2Metric2dTest.txt, contains the results of the test program testvectorl2metric2d.c.

- The file, testvectorl2metric2d.sh, contains the shell script used to compile, link, and execute the test program testvectorl2metric2d.c.

- The file, testvectorl2metric3d.c, contains a test program of Vector_L2_Norm_Metric_3d( ). This test program requires the file
*vector_l2_norm_metric_3d.c*listed above.

- The file, VectorL2Metric3dTest.txt, contains the results of the test program testvectorl2metric3d.c.

- The file, testvectorl2metric3d.sh, contains the shell script used to compile, link, and execute the test program testvectorl2metric3d.c.

- The file, testvectormaxmetric.c, contains a test program of Vector_Max_Norm_Metric( ). This test program requires the file
*vector_max_norm_metric.c*listed above.

- The file, VectorMaxMetricTest.txt, contains the results of the test program testvectormaxnorm.c.

- The file, testvectormaxmetric.sh, contains the shell script used to compile, link, and execute the test program testvectormaxmetric.c.

- The file, testvectormaxmetric2d.c, contains a test program of Vector_Max_Norm_Metric_2d( ). This test program requires the file
*vector_max_norm_metric_2d.c*listed above.

- The file, VectorMaxMetric2dTest.txt, contains the results of the test program testvectormaxmetric2d.c.

- The file, testvectormaxmetric2d.sh, contains the shell script used to compile, link, and execute the test program testvectormaxmetric2d.c.

- The file, testvectormaxmetric3d.c, contains a test program of Vector_Max_Norm_Metric_3d( ). This test program requires the file
*vector_max_norm_metric_3d.c*listed above.

- The file, VectorMaxMetric3dTest.txt, contains the results of the test program testvectormaxmetric3d.c.

- The file, testvectormaxmetric3d.sh, contains the shell script used to compile, link, and execute the test program testvectormaxmetric3d.c.

- The file, testcvectorl1metric.c, contains a test program of CVector_L1_Norm_Metric( ). This test program requires the file
*cvector_l1_norm_metric.c*listed above.

- The file, CVectorL1MetricTest.txt, contains the results of the test program testcvectorl1metric.c.

- The file, testcvectorl1metric.sh, contains the shell script used to compile, link, and execute the test program testcvectorl1metric.c.

- The file, testcvectorl1metric2d.c, contains a test program of CVector_L1_Norm_Metric_2d( ). This test program requires the file
*cvector_l1_norm_metric_2d.c*listed above.

- The file, CVectorL1Metric2dTest.txt, contains the results of the test program testcvectorl1metric2d.c.

- The file, testcvectorl1metric2d.sh, contains the shell script used to compile, link, and execute the test program testcvectorl1metric2d.c.

- The file, testcvectorl1metric3d.c, contains a test program of CVector_L1_Norm_Metric_3d( ). This test program requires the file
*cvector_l1_norm_metric_3d.c*listed above.

- The file, CVectorL1Metric3dTest.txt, contains the results of the test program testcvectorl1metric3d.c.

- The file, testcvectorl1metric3d.sh, contains the shell script used to compile, link, and execute the test program testcvectorl1metric3d.c.

- The file, testcvectorl2metric.c, contains a test program of CVector_L2_Norm_Metric( ). This test program requires the file
*cvector_l2_norm_metric.c*listed above.

- The file, CVectorL2MetricTest.txt, contains the results of the test program testcvectorl2metric.c.

- The file, testcvectorl2metric.sh, contains the shell script used to compile, link, and execute the test program testcvectorl2metric.c.

- The file, testcvectorl2metric2d.c, contains a test program of CVector_L2_Norm_Metric_2d( ). This test program requires the file
*cvector_l2_norm_metric_2d.c*listed above.

- The file, CVectorL2Metric2dTest.txt, contains the results of the test program testcvectorl2metric2d.c.

- The file, testcvectorl2metric2d.sh, contains the shell script used to compile, link, and execute the test program testcvectorl2metric2d.c.

- The file, testcvectorl2metric3d.c, contains a test program of CVector_L2_Norm_Metric_3d( ). This test program requires the file
*cvector_l2_norm_metric_3d.c*listed above.

- The file, CVectorL2Metric3dTest.txt, contains the results of the test program testcvectorl2metric3d.c.

- The file, testcvectorl2metric3d.sh, contains the shell script used to compile, link, and execute the test program testcvectorl2metric3d.c.

- The file, testcvectormaxmetric.c, contains a test program of CVector_Max_Norm_Metric( ). This test program requires the file
*cvector_max_norm_metric.c*listed above.

- The file, CVectorMaxMetricTest.txt, contains the results of the test program testcvectormaxmetric.c.

- The file, testcvectormaxmetric.sh, contains the shell script used to compile, link, and execute the test program testcvectormaxmetric.c.

- The file, testcvectormaxmetric2d.c, contains a test program of CVector_Max_Norm_Metric_2d( ). This test program requires the file
*cvector_max_norm_metric_2d.c*listed above.

- The file, CVectorMaxMetric2dTest.txt, contains the results of the test program testcvectormaxmetric2d.c.

- The file, testcvectormaxmetric2d.sh, contains the shell script used to compile, link, and execute the test program testcvectormaxmetric2d.c.

- The file, testcvectormaxmetric3d.c, contains a test program of CVector_Max_Norm_Metric_3d( ). This test program requires the file
*cvector_max_norm_metric_3d.c*listed above.

- The file, CVectorMaxMetric3dTest.txt, contains the results of the test program testcvectormaxmetric3d.c.

- The file, testcvectormaxmetric3d.sh, contains the shell script used to compile, link, and execute the test program testcvectormaxmetric3d.c.