Arithmetic Matrix Operations



Matrix Multiplication

More Matrix Multiplication For Matrices Stored in Lower Triangular Form

For symmetric matrices, skew-symmetric matrices, Hermitian matrices and for lower triangular matrices, it is possible to store only the lower-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 lower triangular matrices ai,j = 0 for i > j.

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

The multiplication routines below assume that the matrix is either a symmetric matrix, a skew-symmetric matrix, a lower-triangular matrix or a Hermitian matrix which is stored in lower-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_lt(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 lower-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_lt(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 lower-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_LT_Matrix_by_Vector_lt(double *u, double *A, double *v, int n)

    This routine calculates the vector u = A v, where the matrix A is assumed to be lower triangular and is stored in lower-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_lt(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 lower-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_LT_Matrix_lt(double *u, double *v, double *A, int n)

    This routine calculates the vector u = v A, where the matrix A is assumed to be lower triangular and is stored in lower-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_lt(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 lower-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_lt(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 lower-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_lt(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 lower-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_lt(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 lower-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_LT_CMatrix_by_CVector_lt(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 lower triangular and is stored in lower-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_LT_CMatrix_by_RVector_lt(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 lower triangular and is stored in lower-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_lt(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 lower-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_lt(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 lower-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_lt(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 lower-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_lt(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 lower-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_LT_CMatrix_lt(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 lower triangular and is stored in lower-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_LT_CMatrix_lt(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 lower triangular and is stored in lower-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_lt(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 lower-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_lt(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 lower-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_lt.c, contains a test program of Multiply_Sym_Matrix_by_Vector_lt( ) in the file multiply_symmetric_matrix_by_vector_lt.c. This test program requires the file multiply_symmetric_matrix_by_vector_lt.c listed above.

  • The file, MultiplySymMatrixByVectorLTTests.txt, contains the results of the test program testmulsymmatrixbyvector_lt.c.

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


  • The file, testmulskewmatrixbyvector_lt.c, contains a test program of Multiply_Skew_Matrix_by_Vector_lt( ) in the file multiply_skew_matrix_by_vector_lt.c. This test program requires the file multiply_skew_matrix_by_vector_lt.c listed above.

  • The file, MultiplySkewMatrixByVectorLTTests.txt, contains the results of the test program testmulskewmatrixbyvector_lt.c.

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


  • The file, testmulltmatrixbyvector_lt.c, contains a test program of Multiply_LT_Matrix_by_Vector_lt( ) in the file multiply_lower_tri_matrix_by_vector_lt.c. This test program requires the file multiply_lower_tri_matrix_by_vector_lt.c listed above.

  • The file, MultiplyLTMatrixByVectorLTTests.txt, contains the results of the test program testmulltmatrixbyvector_lt.c.

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


  • The file, testmulvectorbyskewmatrix_lt.c, contains a test program of Multiply_Vector_by_Skew_Matrix_lt( ) in the file multiply_vector_by_skew_matrix_lt.c. This test program requires the file multiply_vector_by_skew_matrix_lt.c listed above.

  • The file, MultiplyVectorBySkewMatrixLTTests.txt, contains the results of the test program testmulvectorbyskewmatrix_lt.c.

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


  • The file, testmulvectorbyltmatrix_lt.c, contains a test program of Multiply_Vector_by_LT_Matrix_lt( ) in the file multiply_vector_by_lower_tri_matrix_lt.c. This test program requires the file multiply_vector_by_lower_tri_matrix_lt.c listed above.

  • The file, MultiplyVectorByLTMatrixLTTests.txt, contains the results of the test program testmulvectorbyltmatrix_lt.c.

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


  • The file, testmulsymcmatrixbycvector_lt.c, contains a test program of Mul_Sym_CMatrix_by_CVector_lt( ) in the file mul_symmetric_cmatrix_by_cvector_lt.c. This test program requires the file mul_symmetric_cmatrix_by_cvector_lt.c listed above.

  • The file, MultiplySymCMatrixByCVectorLTTests.txt, contains the results of the test program testmulsymcmatrixbycvector_lt.c.

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


  • The file, testmulsymcmatrixbyrvector_lt.c, contains a test program of Mul_Sym_CMatrix_by_RVector_lt( ) in the file mul_symmetric_cmatrix_by_rvector_lt.c. This test program requires the file mul_symmetric_cmatrix_by_rvector_lt.c listed above.

  • The file, MultiplySymCMatrixByRVectorLTTests.txt, contains the results of the test program testmulsymcmatrixbyrvector_lt.c.

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


  • The file, testmulskewcmatrixbycvector_lt.c, contains a test program of Mul_Skew_CMatrix_by_CVector_lt( ) in the file mul_skew_cmatrix_by_cvector_lt.c. This test program requires the file mul_skew_cmatrix_by_cvector_lt.c listed above.

  • The file, MultiplySkewCMatrixByCVectorLTTests.txt, contains the results of the test program testmulskewcmatrixbycvector_lt.c.

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


  • The file, testmulskewcmatrixbyrvector_lt.c, contains a test program of Mul_Skew_CMatrix_by_RVector_lt( ) in the file mul_skew_cmatrix_by_rvector_lt.c. This test program requires the file mul_skew_cmatrix_by_rvector_lt.c listed above.

  • The file, MultiplySkewCMatrixByRVectorLTTests.txt, contains the results of the test program testmulskewcmatrixbyrvector_lt.c.

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


  • The file, testmulltcmatrixbycvector_lt.c, contains a test program of Mul_LT_CMatrix_by_CVector_lt( ) in the file mul_lower_tri_cmatrix_by_cvector_lt.c. This test program requires the file mul_lower_tri_cmatrix_by_cvector_lt.c listed above.

  • The file, MultiplyLTCMatrixByCVectorLTTests.txt, contains the results of the test program testmulltcmatrixbycvector_lt.c.

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


  • The file, testmulltcmatrixbyrvector_lt.c, contains a test program of Mul_LT_CMatrix_by_RVector_lt( ) in the file mul_lower_tri_cmatrix_by_rvector_lt.c. This test program requires the file mul_lower_tri_cmatrix_by_rvector_lt.c listed above.

  • The file, MultiplyLTCMatrixByRVectorLTTests.txt, contains the results of the test program testmulltcmatrixbyrvector_lt.c.

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


  • The file, testmulhermitianmatrixbycvector_lt.c, contains a test program of Mul_Hermitian_Matrix_by_CVect_lt( ) in the file mul_hermitian_matrix_by_cvect_lt.c. This test program requires the file mul_hermitian_matrix_by_cvect_lt.c listed above.

  • The file, MultiplyHermitianMatrixByCVectorLTTests.txt, contains the results of the test program testmulhermitianmatrixbycvector_lt.c.

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


  • The file, testmulhermitianmatrixbyrvector_lt.c, contains a test program of Mul_Hermitian_Matrix_by_RVect_lt( ) in the file mul_hermitian_matrix_by_rvect_lt.c. This test program requires the file mul_hermitian_matrix_by_rvect_lt.c listed above.

  • The file, MultiplyHermitianMatrixByRVectorLTTests.txt, contains the results of the test program testmulhermitianmatrixbyrvector_lt.c.

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


  • The file, testmulcvectorbyskewcmatrix_lt.c, contains a test program of Mul_CVector_by_Skew_CMatrix_lt( ) in the file mul_cvector_by_skew_cmatrix_lt.c. This test program requires the file mul_cvector_by_skew_cmatrix_lt.c listed above.

  • The file, MultiplyCVectorBySkewCMatrixLTTests.txt, contains the results of the test program testmulcvectorbyskewcmatrix_lt.c.

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


  • The file, testmulrvectorbyskewcmatrix_lt.c, contains a test program of Mul_RVector_by_Skew_CMatrix_lt( ) in the file mul_rvector_by_skew_cmatrix_lt.c. This test program requires the file mmul_rvector_by_skew_cmatrix_lt.c listed above.

  • The file, MultiplyRVectorBySkewCMatrixLTTests.txt, contains the results of the test program testmulrvectorbyskewcmatrix_lt.c.

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


  • The file, testmulcvectorbyltcmatrix_lt.c, contains a test program of Mul_CVector_by_LT_CMatrix_lt( ) in the file mul_cvector_by_lower_tri_cmatrix_lt.c. This test program requires the file mul_cvector_by_lower_tri_cmatrix_lt.c listed above.

  • The file, MultiplyCVectorByLTCMatrixLTTests.txt, contains the results of the test program testmulcvectorbyltcmatrix_lt.c.

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


  • The file, testmulrvectorbyltcmatrix_lt.c, contains a test program of Mul_RVector_by_LT_CMatrix_lt( ) in the file mul_rvector_by_lower_tri_cmatrix_lt.c. This test program requires the file mul_rvector_by_lower_tri_cmatrix_lt.c listed above.

  • The file, MultiplyRVectorByLTCMatrixLTTests.txt, contains the results of the test program testmulrvectorbyltcmatrix_lt.c.

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


  • The file, testmulcvectorbyhermitianmatrix_lt.c, contains a test program of Mul_CVect_by_Hermitian_Matrix_lt( ) in the file mul_cvect_by_hermitian_matrix_lt.c. This test program requires the file mul_cvect_by_hermitian_matrix_lt.c listed above.

  • The file, MultiplyCVectorByHermitianMatrixLTTests.txt, contains the results of the test program testmulcvectorbyhermitianmatrix_lt.c.

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


  • The file, testmulrvectorbyhermitianmatrix_lt.c, contains a test program of Mul_RVect_by_Hermitian_Matrix_lt( ) in the file mul_rvect_by_hermitian_matrix_lt.c. This test program requires the file mul_rvect_by_hermitian_matrix_lt.c listed above.

  • The file, MultiplyRVectorByHermitianMatrixLTTests.txt, contains the results of the test program testmulrvectorbyhermitianmatrix_lt.c.

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