# Normed and Inner Product Spaces

 Home Matrix Home Normed and Inner Product Spaces Inner Products Vector Space Norms Matrix Norms Metrics Induced by Norms

## Metric Induced by a Norm

A metric on a space X is a nonnegative real-valued function d:X×XR such that d(x,x) = 0xX, d(x,y) = d(y,x)x,yX, and d(x,z)d(x,y) + d(y,z)x,y,zX. If (V, |·|) is a normed linearspace, then the function d:V×VR defined by d(v,w) = ||v - w|| defines a metric on V.

The three most commonly used norms are the l1-norm with the induced metric defined as

|| v - w || = || v0 - w0 || + ··· + || vn-1 - wn-1||,

the l2-norm with the induced metric defined as
|| v - w || = [|v0 - w0|² + ··· + |vn-1 - wn-1|² ]½,

and the l-norm or max norm or sup norm with the induced metric defined as
|| v - w || = max{| vi - wi | : 0 ≤ i < n},

where v = v0e0 + ··· + vn-1en-1 and w = w0e0 + ··· + wn-1 relative to the set of basis vectors {e0, ···, en-1}.  Note that the norm of a basis vector is 1.

The source code for evaluating the metrics induced by the l1, l2, and sup or max norms are given below.  The function for evaluating the metric induced by the l1 norm on a real vector space is Vector_L1_Norm_Metric, the function for evaluating the metric induced by the l2 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 l1 norm on a complex vector space is CVector_L1_Norm_Metric, the function for evaluating the metric induced by the l2 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 l1-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 l1-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 l1-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 l2-norm of the n-dimensional real vectors v and w, | v - w | =[( v0 - w0 )² + ··· + ( vn-1 - wn-1 )²]½.

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

This routine calculates the metric associated with the l2-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 l2-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{| vi - wi | : 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 l1-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 l1-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 l1-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 l2-norm of the n-dimensional complex vectors v and w, | v - w | =[( v0 - w0 )² + ··· + ( vn-1 - wn-1 )²]½.

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

This routine calculates the metric associated with the l2-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 l2-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{| vi - wi | : 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 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.