Arithmetic Matrix Operations



Matrix Multiplication

More Matrix Multiplication For Matrices Stored in Upper Triangular Form

For symmetric matrices, skew-symmetric matrices, Hermitian matrices and for upper triangular matrices, it is possible to store only the upper-triangular part of the matrix as the rest of the matrix can easily be recovered. E.g. for symmetric matrices ai,j = aj,i for i < j, for skew-symmetric matrices ai,j = -aj,i for i < j, for Hermitian matrices ai,j = a*j,i for i < j, where * denotes the complex conjugate and for upper triangular matrices ai,j = 0 for i < j.

An n×n matrix A=(ai,j) is said to be stored in upper triangular form if A[0]=a0,0, A[1]=a0,1, A[2]=a0,2, … A[n-1]=a0,n-1, A[n]=a1,1A[2n-2]=a1,n-1 ….

The multiplication routines below assume that the matrix is either a symmetric matrix, a skew-symmetric matrix, an upper-triangular matrix or a Hermitian matrix which is stored in upper-triangular form and that the matrix is either pre- or post- multiplied by a vector, either a row vector for premultiplication or a column vector for postmultiplication.

Function List

  • void Multiply_Sym_Matrix_by_Vector_ut(double *u, double *A, double *v, int n)

    This routine calculates the vector u = A v, where the matrix A is assumed to be symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double A[n*(n+1)/2]. The vectors u and v should be declared in the calling routine as double u[n] and double v[n], respectively.

  • void Multiply_Skew_Matrix_by_Vector_ut(double *u, double *A, double* v, int n)

    This routine calculates the vector u = A v, where the matrix A is assumed to be skew-symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double A[n*(n+1)/2]. The vectors u and v should be declared in the calling routine as double u[n] and double v[n], respectively.

  • void Multiply_UT_Matrix_by_Vector_ut(double *u, double *A, double *v, int n)

    This routine calculates the vector u = A v, where the matrix A is assumed to be upper triangular and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double A[n*(n+1)/2]. The vectors u and v should be declared in the calling routine as double u[n] and double v[n], respectively.

  • void Multiply_Vector_by_Skew_Matrix_ut(double *u, double *v, double* A, int n)

    This routine calculates the vector u = v A, where the matrix A is assumed to be skew-symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double A[n*(n+1)/2]. The vectors u and v should be declared in the calling routine as double u[n] and double v[n], respectively.

  • void Multiply_Vector_by_UT_Matrix_ut(double *u, double *v, double *A, int n)

    This routine calculates the vector u = v A, where the matrix A is assumed to be upper triangular and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double A[n*(n+1)/2]. The vectors u and v should be declared in the calling routine as double u[n] and double v[n], respectively.

  • void Mul_Sym_CMatrix_by_CVector_ut(double complex *u, double complex *A, double complex *v, int n)

    This routine calculates the complex vector u = A v, where the complex matrix A is assumed to be symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vectors u and v should be declared in the calling routine as double complex u[n] and double complex v[n], respectively.

  • void Mul_Sym_CMatrix_by_RVector_ut(double complex *u, double complex *A, double *v, int n)

    This routine calculates the complex vector u = A v, where the complex matrix A is assumed to be symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vector u and real vector v should be declared in the calling routine as double complex u[n] and double v[n], respectively.

  • void Mul_Skew_CMatrix_by_CVector_ut(double complex *u, double complex *A, double complex *v, int n)

    This routine calculates the complex vector u = A v, where the complex matrix A is assumed to be skew-symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vectors u and v should be declared in the calling routine as double complex u[n] and double complex v[n], respectively.

  • void Mul_Skew_CMatrix_by_RVector_ut(double complex *u, double complex *A, double *v, int n)

    This routine calculates the complex vector u = A v, where the complex matrix A is assumed to be skew-symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vector u and real vector v should be declared in the calling routine as double complex u[n] and double v[n], respectively.

  • void Mul_UT_CMatrix_by_CVector_ut(double complex *u, double complex *A, double complex *v, int n)

    This routine calculates the complex vector u = A v, where the complex matrix A is assumed to be upper triangular and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vectors u and v should be declared in the calling routine as double complex u[n] and double complex v[n], respectively.

  • void Mul_UT_CMatrix_by_RVector_ut(double complex *u, double complex *A, double *v, int n)

    This routine calculates the complex vector u = A v, where the complex matrix A is assumed to be upper triangular and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vector u and real vector v should be declared in the calling routine as double complex u[n] and double v[n], respectively.

  • void Mul_Hermitian_Matrix_by_CVect_ut(double complex *u, double complex *A, double complex *v, int n)

    This routine calculates the complex vector u = A v, where the complex matrix A is assumed to be Hermitian and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vectors u and v should be declared in the calling routine as double complex u[n] and double complex v[n], respectively.

  • void Mul_Hermitian_Matrix_by_CVect_ut(double complex *u, double complex *A, double *v, int n)

    This routine calculates the complex vector u = A v, where the complex matrix A is assumed to be Hermitian and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vector u and real vector v should be declared in the calling routine as double complex u[n] and double v[n], respectively.

  • void Mul_CVector_by_Skew_CMatrix_ut(double complex *u, double complex *v, double complex *A, int n)

    This routine calculates the complex vector u = v A, where the complex matrix A is assumed to be skew-symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vectors u and v should be declared in the calling routine as double complex u[n] and double complex v[n], respectively.

  • void Mul_RVector_by_Skew_CMatrix_ut(double complex *u, double *v, double complex *A, int n)

    This routine calculates the complex vector u = v A, where the complex matrix A is assumed to be skew-symmetric and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vector u and real vector v should be declared in the calling routine as double complex u[n] and double v[n], respectively.

  • void Mul_CVector_by_UT_CMatrix_ut(double complex *u, double complex *v, double complex *A, int n)

    This routine calculates the complex vector u = v A, where the complex matrix A is assumed to be upper triangular and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vectors u and v should be declared in the calling routine as double complex u[n] and double complex v[n], respectively.

  • void Mul_RVector_by_UT_CMatrix_ut(double complex *u, double *v, double complex *A, int n)

    This routine calculates the complex vector u = v A, where the complex matrix A is assumed to be upper triangular and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vector u and real vector v should be declared in the calling routine as double complex u[n] and double v[n], respectively.

  • void Mul_CVect_by_Hermitian_Matrix_ut(double complex *u, double complex *v, double complex *A, int n)

    This routine calculates the complex vector u = v A, where the complex matrix A is assumed to be Hermitian and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vectors u and v should be declared in the calling routine as double complex u[n] and double complex v[n], respectively.

  • void Mul_RVect_by_Hermitian_Matrix_ut(double complex *u, double *v, double complex *A, int n)

    This routine calculates the complex vector u = v A, where the complex matrix A is assumed to be Hermitian and is stored in upper-triangular form. The matrix, A should be declared in the calling routine as double complex A[n*(n+1)/2]. The complex vector u and real vector v should be declared in the calling routine as double complex u[n] and double v[n], respectively.

C Source Code


C Test Code, Test Results, and Build Shell Script

  • The file, testmulsymmatrixbyvector_ut.c, contains a test program of Multiply_Sym_Matrix_by_Vector_ut( ) in the file multiply_symmetric_matrix_by_vector_ut.c. This test program requires the file multiply_symmetric_matrix_by_vector_ut.c listed above.

  • The file, MultiplySymMatrixByVectorUTTests.txt, contains the results of the test program testmulsymmatrixbyvector_ut.c.

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


  • The file, testmulskewmatrixbyvector_ut.c, contains a test program of Multiply_Skew_Matrix_by_Vector_ut( ) in the file multiply_skew_matrix_by_vector_ut.c. This test program requires the file multiply_skew_matrix_by_vector_ut.c listed above.

  • The file, MultiplySkewMatrixByVectorUTTests.txt, contains the results of the test program testmulskewmatrixbyvector_ut.c.

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


  • The file, testmulutmatrixbyvector_ut.c, contains a test program of Multiply_UT_Matrix_by_Vector_ut( ) in the file multiply_upper_tri_matrix_by_vector_ut.c. This test program requires the file multiply_upper_tri_matrix_by_vector_ut.c listed above.

  • The file, MultiplyUTMatrixByVectorUTTests.txt, contains the results of the test program testmulutmatrixbyvector_ut.c.

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


  • The file, testmulvectorbyskewmatrix_ut.c, contains a test program of Multiply_Vector_by_Skew_Matrix_ut( ) in the file multiply_vector_by_skew_matrix_ut.c. This test program requires the file multiply_vector_by_skew_matrix_ut.c listed above.

  • The file, MultiplyVectorBySkewMatrixUTTests.txt, contains the results of the test program testmulvectorbyskewmatrix_ut.c.

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


  • The file, testmulvectorbyutmatrix_ut.c, contains a test program of Multiply_Vector_by_UT_Matrix_ut( ) in the file multiply_vector_by_upper_tri_matrix_ut.c. This test program requires the file multiply_vector_by_upper_tri_matrix_ut.c listed above.

  • The file, MultiplyVectorByUTMatrixUTTests.txt, contains the results of the test program testmulvectorbyutmatrix_ut.c.

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


  • The file, testmulsymcmatrixbycvector_ut.c, contains a test program of Mul_Sym_CMatrix_by_CVector_ut( ) in the file mul_symmetric_cmatrix_by_cvector_ut.c. This test program requires the file mul_symmetric_cmatrix_by_cvector_ut.c listed above.

  • The file, MultiplySymCMatrixByCVectorUTTests.txt, contains the results of the test program testmulsymcmatrixbycvector_ut.c.

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


  • The file, testmulsymcmatrixbyrvector_ut.c, contains a test program of Mul_Sym_CMatrix_by_RVector_ut( ) in the file mul_symmetric_cmatrix_by_rvector_ut.c. This test program requires the file mul_symmetric_cmatrix_by_rvector_ut.c listed above.

  • The file, MultiplySymCMatrixByRVectorUTTests.txt, contains the results of the test program testmulsymcmatrixbyrvector_ut.c.

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


  • The file, testmulskewcmatrixbycvector_ut.c, contains a test program of Mul_Skew_CMatrix_by_CVector_ut( ) in the file mul_skew_cmatrix_by_cvector_ut.c. This test program requires the file mul_skew_cmatrix_by_cvector_ut.c listed above.

  • The file, MultiplySkewCMatrixByCVectorUTTests.txt, contains the results of the test program testmulskewcmatrixbycvector_ut.c.

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


  • The file, testmulskewcmatrixbyrvector_ut.c, contains a test program of Mul_Skew_CMatrix_by_RVector_ut( ) in the file mul_skew_cmatrix_by_rvector_ut.c. This test program requires the file mul_skew_cmatrix_by_rvector_ut.c listed above.

  • The file, MultiplySkewCMatrixByRVectorUTTests.txt, contains the results of the test program testmulskewcmatrixbyrvector_ut.c.

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


  • The file, testmulutcmatrixbycvector_ut.c, contains a test program of Mul_UT_CMatrix_by_CVector_ut( ) in the file mul_upper_tri_cmatrix_by_cvector_ut.c. This test program requires the file mul_upper_tri_cmatrix_by_cvector_ut.c listed above.

  • The file, MultiplyUTCMatrixByCVectorUTTests.txt, contains the results of the test program testmulutcmatrixbycvector_ut.c.

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


  • The file, testmulutcmatrixbyrvector_ut.c, contains a test program of Mul_UT_CMatrix_by_RVector_ut( ) in the file mul_upper_tri_cmatrix_by_rvector_ut.c. This test program requires the file mul_upper_tri_cmatrix_by_rvector_ut.c listed above.

  • The file, MultiplyUTCMatrixByRVectorUTTests.txt, contains the results of the test program testmulutcmatrixbyrvector_ut.c.

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


  • The file, testmulhermitianmatrixbycvector_ut.c, contains a test program of Mul_Hermitian_Matrix_by_CVect_ut( ) in the file mul_hermitian_matrix_by_cvect_ut.c. This test program requires the file mul_hermitian_matrix_by_cvect_ut.c listed above.

  • The file, MultiplyHermitianMatrixByCVectorUTTests.txt, contains the results of the test program testmulhermitianmatrixbycvector_ut.c.

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


  • The file, testmulhermitianmatrixbyrvector_ut.c, contains a test program of Mul_Hermitian_Matrix_by_RVect_ut( ) in the file mul_hermitian_matrix_by_rvect_ut.c. This test program requires the file mul_hermitian_matrix_by_rvect_ut.c listed above.

  • The file, MultiplyHermitianMatrixByRVectorUTTests.txt, contains the results of the test program testmulhermitianmatrixbyrvector_ut.c.

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


  • The file, testmulcvectorbyskewcmatrix_ut.c, contains a test program of Mul_CVector_by_Skew_CMatrix_ut( ) in the file mul_cvector_by_skew_cmatrix_ut.c. This test program requires the file mul_cvector_by_skew_cmatrix_ut.c listed above.

  • The file, MultiplyCVectorBySkewCMatrixUTTests.txt, contains the results of the test program testmulcvectorbyskewcmatrix_ut.c.

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


  • The file, testmulrvectorbyskewcmatrix_ut.c, contains a test program of Mul_RVector_by_Skew_CMatrix_ut( ) in the file mul_rvector_by_skew_cmatrix_ut.c. This test program requires the file mmul_rvector_by_skew_cmatrix_ut.c listed above.

  • The file, MultiplyRVectorBySkewCMatrixUTTests.txt, contains the results of the test program testmulrvectorbyskewcmatrix_ut.c.

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


  • The file, testmulcvectorbyutcmatrix_ut.c, contains a test program of Mul_CVector_by_UT_CMatrix_ut( ) in the file mul_cvector_by_upper_tri_cmatrix_ut.c. This test program requires the file mul_cvector_by_upper_tri_cmatrix_ut.c listed above.

  • The file, MultiplyCVectorByUTCMatrixUTTests.txt, contains the results of the test program testmulcvectorbyutcmatrix_ut.c.

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


  • The file, testmulrvectorbyutcmatrix_ut.c, contains a test program of Mul_RVector_by_UT_CMatrix_ut( ) in the file mul_rvector_by_upper_tri_cmatrix_ut.c. This test program requires the file mul_rvector_by_upper_tri_cmatrix_ut.c listed above.

  • The file, MultiplyRVectorByUTCMatrixUTTests.txt, contains the results of the test program testmulrvectorbyutcmatrix_ut.c.

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


  • The file, testmulcvectorbyhermitianmatrix_ut.c, contains a test program of Mul_CVect_by_Hermitian_Matrix_ut( ) in the file mul_cvect_by_hermitian_matrix_ut.c. This test program requires the file mul_cvect_by_hermitian_matrix_ut.c listed above.

  • The file, MultiplyCVectorByHermitianMatrixUTTests.txt, contains the results of the test program testmulcvectorbyhermitianmatrix_ut.c.

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


  • The file, testmulrvectorbyhermitianmatrix_ut.c, contains a test program of Mul_RVect_by_Hermitian_Matrix_ut( ) in the file mul_rvect_by_hermitian_matrix_ut.c. This test program requires the file mul_rvect_by_hermitian_matrix_ut.c listed above.

  • The file, MultiplyRVectorByHermitianMatrixUTTests.txt, contains the results of the test program testmulrvectorbyhermitianmatrix_ut.c.

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