# Arithmetic Vector Operations

 Home Matrix Home Arithmetic Matrix Routines Home Vector Addition / Subtraction Vector Multiply / Divide by a Scalar Linear Combination of Vectors Multiply Vectors Zero Vector / Basis Vectors

## Vector Multiplication.

The function multiplying a real column vector on the left by a real row vector on the right is Multiply_Vector_by_Vector( ). Similarly the function multiplying a complex column vector on the left by a complex row vector on the right is Multiply_CVector_by_CVector( ), the function multiplying a complex column vector on the left by a real row vector on the right is Multiply_CVector_by_RVector( ) and the function multiplying a real column vector on the left by a complex row vector on the right is Multiply_RVector_by_CVector( ).

### Function List

• void Multiply_Vector_by_Vector( double *A, int nrows, int ncols, double u[ ],
double v[ ])

Post multiply the column vector u by the row vector v to form the nrows×ncols matrix A. Here u is an nrows×1 column vector and v is a 1×ncols row vector and A[i][j] = u[i]v[j].
The matrix A should be declared as double A[nrows*ncols] or as
double A[nrows][ncols] in the calling routine.

• void Multiply_CVector_by_CVector( double complex *A, int nrows, int ncols, double complex u[ ], double complex v[ ])

Post multiply the complex column vector u by the complex row vector v to form the nrows×ncols complex matrix A. Here u is an nrows×1 complex column vector and v is a 1×ncols complex row vector and A[i][j] = u[i]v[j].
The matrix A should be declared as double complex A[nrows*ncols] or as
double complex A[nrows][ncols] in the calling routine.

• void Multiply_RVector_by_CVector( double complex *A, int nrows, int ncols, double u[ ], double complex v[ ])

Post multiply the column vector u by the complex row vector v to form the nrows×ncols complex matrix A. Here u is an nrows×1 column vector and v is a 1×ncols complex row vector and A[i][j] = u[i]v[j].
The complex matrix A should be declared as double complex A[nrows*ncols] or as
double complex A[nrows][ncols] in the calling routine.

• void Multiply_CVector_by_RVector( double complex *A, int nrows, int ncols, double complex u[ ], double v[ ])

Post multiply the complex column vector u by the row vector v to form the nrows×ncols complex matrix A. Here u is an nrows×1 complex column vector and v is a 1×ncols row vector and A[i][j] = u[i]v[j].
The matrix A should be declared as double complex A[nrows*ncols] or as
double complex A[nrows][ncols] in the calling routine.

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

• The file, testmulvectorbyvector.c, contains a test program of Multiply_Vector_by_Vector( ). This test program requires the file multiply_vector_by_vector.c listed above.

• The file, MultiplyVectorbyVectorTest.txt, contains the results of the test program testmulvectorbyvector.c.

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

• The file, testmulcvectorbycvector.c, contains a test program of Multiply_CVector_by_CVector( ). This test program requires the file multiply_cvector_by_cvector.c listed above.

• The file, MultiplyCVectorbyCVectorTest.txt, contains the results of the test program testmulcvectorbycvector.c.

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

• The file, testmulrvectorbycvector.c, contains a test program of Multiply_RVector_by_CVector( ). This test program requires the file multiply_rvector_by_cvector.c listed above.

• The file, MultiplyRVectorbyCVectorTest.txt, contains the results of the test program testmulrvectorbycvector.c.

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

• The file, testmulcvectorbyrvector.c, contains a test program of Multiply_CVector_by_RVector( ). This test program requires the file multiply_cvector_by_rvector.c listed above.

• The file, MultiplyCVectorbyRVectorTest.txt, contains the results of the test program testmulcvectorbyrvector.c.

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