## Zero Vector and Canonical Basis Vectors.

It is convenient to have routines to initialize a vector to either a zero vector,**v**= (

*v*) where

_{i}*v*= 0 ∀

_{i}*i*, or a canonical basis vector,

**v**= (

_{i}*v*) where

_{i,j}*v*= 0 ∀

_{i,j}*j≠i*and

*v*= 1.

_{i,i}The function for setting a real vector to the zero vector is

*Zero_Vector( )*and the function for setting a complex vector to the zero vector is

*Zero_CVector( )*. The function for setting a real vector to a canonical basis vector is

*Canonical_Basis_Vector( )*and the function for setting a complex vector to a canonical basis vector is

*Canonical_Basis_CVector( )*.

### Function List

- void Zero_Vector( double *v, int n )

Set the*n*-dimensional vector*v*to the zero vector, i.e.*v[i] = 0*for all*i*.

- void Canonical_Basis_Vector( double v[ ], int i, int n )

Set the*n*-dimensional vector*v*to the*i*canonical basis vector, i.e.^{th}*v*= 0 if_{j}*j ≠ i*and

*v*= 1. If_{i}*n ≤ 0*then*v[0] = 1*regardless of the value of*i*. If*n > 0*and*i < 0*or*i ≥ n*, then*v[i]*is not set, i.e.*v*is set to the zero vector.

- void Zero_CVector( double complex *v, int n )

Set the*n*-dimensional complex vector*v*to the zero vector, i.e.*v[i] = 0*for all*i*.

- void Canonical_Basis_CVector( double complex v[ ], int i, int n )

Set the*n*-dimensional complex vector*v*to the*i*canonical basis vector, i.e.^{th}*v*= 0 if_{j}*j ≠ i*and*v*= 1. If_{i}*n ≤ 0*then*v[0] = 1*regardless of the value of*i*. If*n > 0*and*i < 0*or*i ≥ n*, then*v[i]*is not set, i.e.*v*is set to the zero vector.

*C* Source Code

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

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

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

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

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

- The file, testzerovector_C.c, contains a test program of Zero_Vector( ). This test program requires the file
*zero_vector.c*listed above.

- The file, ZeroVector_CTest.txt, contains the results of the test program testzerovector_C.c.

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

- The file, testcanonicalbasis_C.c, contains a test program of Canonical_Basis_Vector( ). This test program requires the file
*canonical_basis_vector.c*listed above.

- The file, CanonicalBasisVector_CTest.txt, contains the results of the test program testcanonicalbasis_C.c.

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

- The file, testzerocvector_C.c, contains a test program of Zero_CVector( ). This test program requires the file
*zero_cvector.c*listed above.

- The file, ZeroCVector_CTest.txt, contains the results of the test program testzerocvector_C.c.

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

- The file, testcanonicalcbasis_C.c, contains a test program of Canonical_Basis_CVector( ). This test program requires the file
*canonical_basis_cvector.c*listed above.

- The file, CanonicalBasisCVector_CTest.txt, contains the results of the test program testcanonicalcbasis_C.c.

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

*NASM* Source Code

For Linux gcc Users

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

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

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

- The file, testzerovector_A.c, contains a test program of Zero_Vector( ). This test program requires the file
*zero_vector.asm*listed above.

- The file, ZeroVector_ATest.txt, contains the results of the test program testzerovector_A.c.

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

- The file, testcanonicalbasis_A.c, contains a test program of Canonical_Basis_Vector( ). This test program requires the file
*canonical_basis_vector.asm*listed above.

- The file, CanonicalBasisVector_ATest.txt, contains the results of the test program testcanonicalbasis_A.c.

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