Vector Space Norms
A norm on an n-dimensional real or complex vector space V is a nonnegative real-valued function || · || : V → R such that || v || = 0 iff v = 0, || av || = | a | || v || where a is a scalar, and || v + w || ≤ || v || + || w ||.The three most commonly used norms are the l_{1}-norm defined as
|| v || = | v_{0} | + ··· + | v_{n-1} |,
the l_{2}-norm defined as
|| v || = (|v_{0}|² + ··· + |v_{n-1}|² )^{½},
and the l_{∞}-norm or max norm or sup norm defined as
| v | = max{| v_{i} | : 0 ≤ i < n},
where v = v_{0}e_{0} + ··· + v_{n-1}e_{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 l_{1}, l_{2}, and sup or max norms are given below. The function for evaluating the l_{1} norm of a real vector is Vector_L1_Norm, the function for evaluating the l_{2} norm of a real vector is Vector_L2_Norm, the function for evaluating the max norm of a real vector is Vector_Max_Norm, the function for evaluating the l_{1} norm of a complex vector is CVector_L1_Norm, the function for evaluating the l_{2} norm of a complex vector is CVector_L2_Norm, and the function for evaluating the max norm of a complex vector is CVector_Max_Norm, . There are special versions of these routines for the cases of the ubiquitous 2-d and 3-d vectors.
Function List
- double Vector_L1_Norm( double v[ ], int n)
This routine calculates the l_{1}-norm of the n-dimensional real vector v,
| v | = | v[0] | + ··· + | v[n-1] |.
- double Vector_L1_Norm_2d( double v[] )
This routine calculates the l_{1}-norm of the 2-dimensional real vector v,
| v | = | v[0] | + | v[1] |.
- double Vector_L1_Norm_3d( double v[ ] )
This routine calculates the l_{1}-norm of the 3-dimensional real vector v,
| v | = | v[0] | + | v[1] | + | v[2] |.
- double Vector_L2_Norm( double v[ ], int n )
This routine calculates the l_{2}-norm of the n-dimensional real vector v,
| v | = [ v_{0}² + ··· + v_{n-1}² ]^{½}.
- double Vector_L2_Norm_2d( double v[ ] )
This routine calculates the l_{2}-norm of the 2-dimensional real vector v,
| v | = [ v[0]² + v[1]² ]^{½}.
- double Vector_L2_Norm_3d( double v[ ] )
This routine calculates the l_{2}-norm of the 3-dimensional real vector v,
| v | = [ v[0]² + v[1]² + v[2]² ]^{½}.
- double Vector_Max_Norm( double v[ ], int n )
This routine calculates the max-norm of the n-dimensional real vector v,
| v | = max{| v_{i} | : 0 ≤ i < n}.
- double Vector_Max_Norm_2d( double v[ ] )
This routine calculates the max-norm of the 2-dimensional real vector v,
| v | = max{| v[0] |, | v[1] |}.
- double Vector_Max_Norm_3d( double v[ ] )
This routine calculates the max-norm of the 3-dimensional real vector v,
| v | = max{| v[0] |, | v[1] |, | v[2] |}.
- double CVector_L1_Norm( double complex v[ ], int n)
This routine calculates the l_{1}-norm of the n-dimensional complex vector v,
| v | = | v[0] | + ··· + | v[n-1] |.
- double CVector_L1_Norm_2d( double complex v[] )
This routine calculates the l_{1}-norm of the 2-dimensional complex vector v,
| v | = | v[0] | + | v[1] |.
- double CVector_L1_Norm_3d( double complex v[ ] )
This routine calculates the l_{1}-norm of the 3-dimensional complex vector v,
| v | = | v[0] | + | v[1] | + | v[2] |.
- double CVector_L2_Norm( double complex v[ ], int n )
This routine calculates the l_{2}-norm of the n-dimensional complex vector v,
| v | = [ |v_{0}|² + ··· + |v_{n-1}|² ]^{½}.
- double CVector_L2_Norm_2d( double complex v[ ] )
This routine calculates the l_{2}-norm of the 2-dimensional complex vector v,
| v | = [ |v[0]|² + |v[1]|² ]^{½}.
- double CVector_L2_Norm_3d( double complex v[ ] )
This routine calculates the l_{2}-norm of the 3-dimensional complex vector v,
| v | = [ |v[0]|² + |v[1]|² + |v[2]|² ]^{½}.
- double CVector_Max_Norm( double complex v[ ], int n )
This routine calculates the max-norm of the n-dimensional complex vector v,
| v | = max{| v_{i} | : 0 ≤ i < n}.
- double CVector_Max_Norm_2d( double complex v[ ] )
This routine calculates the max-norm of the 2-dimensional complex vector v,
| v | = max{| v[0] |, | v[1] |}.
- double CVector_Max_Norm_3d( double complex v[ ] )
This routine calculates the max-norm of the 3-dimensional complex vector v,
| v | = max{| v[0] |, | v[1] |, | v[2] |}.
C Source Code
- The file, vector_l1_norm.c, contains the version of Vector_L1_Norm( ) written in C.
- The file, vector_l1_norm_2d.c, contains the version of Vector_L1_Norm_2( ) written in C.
- The file, vector_l1_norm_3d.c, contains the version of Vector_L1_Norm_3( ) written in C.
- The file, vector_l2_norm.c, contains the version of Vector_L2_Norm( ) written in C.
- The file, vector_l2_norm_2d.c, contains the version of Vector_L2_Norm_2( ) written in C.
- The file, vector_l2_norm_3d.c, contains the version of Vector_L2_Norm_3( ) written in C.
- The file, vector_max_norm.c, contains the version of Vector_Max_Norm( ) written in C.
- The file, vector_max_norm_2d.c, contains the version of Vector_Max_Norm_2( ) written in C.
- The file, vector_max_norm_3d.c, contains the version of Vector_Max_Norm_3( ) written in C.
- The file, cvector_l1_norm.c, contains the version of CVector_L1_Norm( ) written in C.
- The file, cvector_l1_norm_2d.c, contains the version of CVector_L1_Norm_2( ) written in C.
- The file, cvector_l1_norm_3d.c, contains the version of CVector_L1_Norm_3( ) written in C.
- The file, cvector_l2_norm.c, contains the version of CVector_L2_Norm( ) written in C.
- The file, cvector_l2_norm_2d.c, contains the version of CVector_L2_Norm_2( ) written in C.
- The file, cvector_l2_norm_3d.c, contains the version of CVector_L2_Norm_3( ) written in C.
- The file, cvector_max_norm.c, contains the version of CVector_Max_Norm( ) written in C.
- The file, cvector_max_norm_2d.c, contains the version of CVector_Max_Norm_2( ) written in C.
- The file, cvector_max_norm_3d.c, contains the version of CVector_Max_Norm_3( ) written in C.
NASM Source Code
For Linux gcc Users
- The file, vector_l1_norm.asm, contains the version of Vector_L1_Norm( ) written in NASM.
- The file, vector_l1_norm_2d.asm, contains the version of Vector_L1_Norm_2( ) written in NASM.
- The file, vector_l1_norm_3d.asm, contains the version of Vector_L1_Norm_3( ) written in NASM.
- The file, vector_l2_norm.asm, contains the version of Vector_L2_Norm( ) written in NASM.
- The file, vector_l2_norm_2d.asm, contains the version of Vector_L2_Norm_2( ) written in NASM.
- The file, vector_l2_norm_3d.asm, contains the version of Vector_L2_Norm_3( ) written in NASM.
- The file, vector_max_norm.asm, contains the version of Vector_Max_Norm( ) written in NASM.
- The file, vector_max_norm_2d.asm, contains the version of Vector_Max_Norm_2( ) written in NASM.
- The file, vector_max_norm_3d.asm, contains the version of Vector_Max_Norm_3( ) written in NASM.
C Test Code, Test Results, and Build Shell Script
- The file, testvectorl1norm.c, contains a test program of Vector_L1_Norm( ). This test program requires the file vector_l1_norm.c listed above.
- The file, VectorL1NormTest.txt, contains the results of the test program testvectorl1norm.c.
- The file, testvectorl1norm.sh, contains the shell script used to compile, link, and execute the test program testvectorl1norm.c.
- The file, testvectorl1norm2d.c, contains a test program of Vector_L1_Norm_2d( ). This test program requires the file vector_l1_norm_2d.c listed above.
- The file, VectorL1Norm2dTest.txt, contains the results of the test program testvectorl1norm2d.c.
- The file, testvectorl1norm2d.sh, contains the shell script used to compile, link, and execute the test program testvectorl1norm2d.c.
- The file, testvectorl1norm3d.c, contains a test program of Vector_L1_Norm_3d( ). This test program requires the file vector_l1_norm_3d.c listed above.
- The file, VectorL1Norm3dTest.txt, contains the results of the test program testvectorl1norm3d.c.
- The file, testvectorl1norm3d.sh, contains the shell script used to compile, link, and execute the test program testvectorl1norm3d.c.
- The file, testvectorl2norm.c, contains a test program of Vector_L2_Norm( ). This test program requires the file vector_l2_norm.c listed above.
- The file, VectorL2NormTest.txt, contains the results of the test program testvectorl2norm.c.
- The file, testvectorl2norm.sh, contains the shell script used to compile, link, and execute the test program testvectorl2norm.c.
- The file, testvectorl2norm2d.c, contains a test program of Vector_L2_Norm_2d( ). This test program requires the file vector_l2_norm_2d.c listed above.
- The file, VectorL2Norm2dTest.txt, contains the results of the test program testvectorl2norm2d.c.
- The file, testvectorl2norm2d.sh, contains the shell script used to compile, link, and execute the test program testvectorl2norm2d.c.
- The file, testvectorl2norm3d.c, contains a test program of Vector_L2_Norm_3d( ). This test program requires the file vector_l2_norm_3d.c listed above.
- The file, VectorL2Norm3dTest.txt, contains the results of the test program testvectorl2norm3d.c.
- The file, testvectorl2norm3d.sh, contains the shell script used to compile, link, and execute the test program testvectorl2norm3d.c.
- The file, testvectormaxnorm.c, contains a test program of Vector_Max_Norm( ). This test program requires the file vector_max_norm.c listed above.
- The file, VectorMaxNormTest.txt, contains the results of the test program testvectormaxnorm.c.
- The file, testvectormaxnorm.sh, contains the shell script used to compile, link, and execute the test program testvectormaxnorm.c.
- The file, testvectormaxnorm2d.c, contains a test program of Vector_Max_Norm_2d( ). This test program requires the file vector_max_norm_2d.c listed above.
- The file, VectorMaxNorm2dTest.txt, contains the results of the test program testvectormaxnorm2d.c.
- The file, testvectormaxnorm2d.sh, contains the shell script used to compile, link, and execute the test program testvectormaxnorm2d.c.
- The file, testvectormaxnorm3d.c, contains a test program of Vector_Max_Norm_3d( ). This test program requires the file vector_max_norm_3d.c listed above.
- The file, VectorMaxNorm3dTest.txt, contains the results of the test program testvectormaxnorm3d.c.
- The file, testvectormaxnorm3d.sh, contains the shell script used to compile, link, and execute the test program testvectormaxnorm3d.c.
- The file, testcvectorl1norm.c, contains a test program of CVector_L1_Norm( ). This test program requires the file cvector_l1_norm.c listed above.
- The file, CVectorL1NormTest.txt, contains the results of the test program testcvectorl1norm.c.
- The file, testcvectorl1norm.sh, contains the shell script used to compile, link, and execute the test program testcvectorl1norm.c.
- The file, testcvectorl1norm2d.c, contains a test program of CVector_L1_Norm_2d( ). This test program requires the file cvector_l1_norm_2d.c listed above.
- The file, CVectorL1Norm2dTest.txt, contains the results of the test program testcvectorl1norm2d.c.
- The file, testcvectorl1norm2d.sh, contains the shell script used to compile, link, and execute the test program testcvectorl1norm2d.c.
- The file, testcvectorl1norm3d.c, contains a test program of CVector_L1_Norm_3d( ). This test program requires the file cvector_l1_norm_3d.c listed above.
- The file, CVectorL1Norm3dTest.txt, contains the results of the test program testcvectorl1norm3d.c.
- The file, testcvectorl1norm3d.sh, contains the shell script used to compile, link, and execute the test program testcvectorl1norm3d.c.
- The file, testcvectorl2norm.c, contains a test program of CVector_L2_Norm( ). This test program requires the file cvector_l2_norm.c listed above.
- The file, CVectorL2NormTest.txt, contains the results of the test program testcvectorl2norm.c.
- The file, testcvectorl2norm.sh, contains the shell script used to compile, link, and execute the test program testcvectorl2norm.c.
- The file, testcvectorl2norm2d.c, contains a test program of CVector_L2_Norm_2d( ). This test program requires the file cvector_l2_norm_2d.c listed above.
- The file, CVectorL2Norm2dTest.txt, contains the results of the test program testcvectorl2norm2d.c.
- The file, testcvectorl2norm2d.sh, contains the shell script used to compile, link, and execute the test program testcvectorl2norm2d.c.
- The file, testcvectorl2norm3d.c, contains a test program of CVector_L2_Norm_3d( ). This test program requires the file cvector_l2_norm_3d.c listed above.
- The file, CVectorL2Norm3dTest.txt, contains the results of the test program testcvectorl2norm3d.c.
- The file, testcvectorl2norm3d.sh, contains the shell script used to compile, link, and execute the test program testcvectorl2norm3d.c.
- The file, testcvectormaxnorm.c, contains a test program of CVector_Max_Norm( ). This test program requires the file cvector_max_norm.c listed above.
- The file, CVectorMaxNormTest.txt, contains the results of the test program testcvectormaxnorm.c.
- The file, testcvectormaxnorm.sh, contains the shell script used to compile, link, and execute the test program testcvectormaxnorm.c.
- The file, testcvectormaxnorm2d.c, contains a test program of CVector_Max_Norm_2d( ). This test program requires the file cvector_max_norm_2d.c listed above.
- The file, CVectorMaxNorm2dTest.txt, contains the results of the test program testcvectormaxnorm2d.c.
- The file, testcvectormaxnorm2d.sh, contains the shell script used to compile, link, and execute the test program testcvectormaxnorm2d.c.
- The file, testcvectormaxnorm3d.c, contains a test program of CVector_Max_Norm_3d( ). This test program requires the file cvector_max_norm_3d.c listed above.
- The file, CVectorMaxNorm3dTest.txt, contains the results of the test program testcvectormaxnorm3d.c.
- The file, testcvectormaxnorm3d.sh, contains the shell script used to compile, link, and execute the test program testcvectormaxnorm3d.c.