Arithmetic Matrix Operations



ATB, ABT, ATA, AAT

AT B, A BT, AT A, and A AT
A B, A B, A A, and A A

Occasionally one needs to form products of the form AT B, A BT, AT A, and A AT, where the superscript T denotes the transpose and in the case of complex matrices products of the form A B, A B, A A, and A A, where the superscript denotes the complex conjugate of the transpose. The routines below perform that function without having to declare and define the intervening transpose.

Function List

  • void Matrix_x_a_Matrix_Transposed( double *C, double *A, int nrows, int ncols, double *B, int mrows)

    Post multiply the nrows×ncols matrix A by the transpose of the mrows×ncols matrix B to form the nrows×mrows matrix C, i.e. C = A BT, where T denotes the transpose. The matrix C should be declared as double C[nrows][mrows] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void Matrix_x_Its_Transpose( double *C, double *A, int nrows, int ncols )

    Post multiply an nrows×ncols matrix A by its transpose. The result is an nrows×nrows square symmetric matrix C, i.e. C = A AT, where T denotes the transpose. The matrix C should be declared as double C[nrows][nrows] in the calling routine. The memory allocated to C should not include any memory allocated to A.

  • void Matrix_Transposed_x_a_Matrix( double *C, double *A, int nrows,int ncols, double *B, int mcols )

    Post multiply the transpose of the nrows×ncols matrix A by the nrows×mcols matrix B to form the ncols×mcols matrix C, i.e. C = ATB, where T denotes the transpose. The matrix C should be declared as double C[ncols][mcols] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void Matrix_Transposed_x_the_Matrix( double *C, double *A, int nrows, int ncols )

    Pre multiply an nrows×ncols matrix A by its transpose. The result is an ncols×ncol square symmetric matrix C, i.e. C = ATA, where T denotes the transpose. The matrix C should be declared as double C[ncols][ncols] in the calling routine. The memory allocated to C should not include any memory allocated to A.

  • void CMatrix_x_a_CMatrix_Transposed( double complex *C, double complex *A, int nrows, int ncols, double complex *B, int mrows)

    Post multiply the nrows×ncols complex matrix A by the transpose of the mrows×ncols complex matrix B to form the nrows×mrows complex matrix C, i.e. C = A BT, where T denotes the transpose. The matrix C should be declared as double complex C[nrows][mrows] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void CMatrix_x_Its_Transpose( double complex *C, double complex *A, int nrows, int ncols )

    Post multiply an nrows×ncols complex matrix A by its transpose. The result is an nrows×nrows square symmetric complex matrix C, i.e. C = A AT, where T denotes the transpose. The matrix C should be declared as double complex C[nrows][nrows] in the calling routine. The memory allocated to C should not include any memory allocated to A.

  • void CMatrix_Transposed_x_a_CMatrix( double complex *C, double complex *A, int nrows,int ncols, double complex *B, int mcols )

    Post multiply the transpose of the nrows×ncols complex matrix A by the nrows×mcols complex matrix B to form the ncols×mcols complex matrix C, i.e. C = ATB, where T denotes the transpose. The matrix C should be declared as double complex C[ncols][mcols] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void CMatrix_Transposed_x_the_CMatrix( double complex *C, double complex *A, int nrows, int ncols )

    Pre multiply an nrows×ncols complex matrix A by its transpose. The result is an ncols×ncol square symmetric complex matrix C, i.e. C = ATA, where T denotes the transpose. The matrix C should be declared as double complex C[ncols][ncols] in the calling routine. The memory allocated to C should not include any memory allocated to A.

  • void CMatrix_x_a_CMatrix_Daggered( double complex *C, double complex *A, int nrows, int ncols, double complex *B, int mrows)

    Post multiply the nrows×ncols complex matrix A by the complex conjugate of the transpose of the mrows×ncols complex matrix B to form the nrows×mrows complex matrix C, i.e. C = A B, where denotes the complex conjugate transpose. The matrix C should be declared as double complex C[nrows][mrows] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void CMatrix_x_Its_Dagger( double complex *C, double complex *A, int nrows, int ncols )

    Post multiply an nrows×ncols complex matrix A by its complex conjugate transpose. The result is an nrows×nrows Hermitian matrix C, i.e. C = A A, where denotes the complex conjugate transpose. The matrix C should be declared as double complex C[nrows][nrows] in the calling routine. The memory allocated to C should not include any memory allocated to A.

  • void CMatrix_Daggered_x_a_CMatrix( double complex *C, double complex *A, int nrows,int ncols, double complex *B, int mcols )

    Post multiply the complex conjugate transpose of the nrows×ncols complex matrix A by the nrows×mcols complex matrix B to form the ncols×mcols complex matrix C, i.e. C = AB, where denotes the complex conjugate transpose. The matrix C should be declared as double complex C[ncols][mcols] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void CMatrix_Daggered_x_the_CMatrix( double complex *C, double complex *A, int nrows, int ncols )

    Pre multiply an nrows×ncols complex matrix A by its complex cojugate transpose. The result is an ncols×ncol Hermitian matrix C, i.e. C = AA, where denotes the complex conjugate transpose. The matrix C should be declared as double complex C[ncols][ncols] in the calling routine. The memory allocated to C should not include any memory allocated to A.

  • void CMatrix_Daggered_x_an_RMatrix( double complex *C, double complex *A, int nrows,int ncols, double *B, int mcols )

    Post multiply the complex conjugate transpose of the nrows×ncols complex matrix A by the nrows×mcols real matrix B to form the ncols×mcols complex matrix C, i.e. C = AB, where denotes the complex conjugate transpose. The matrix C should be declared as double complex C[ncols][mcols] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void CMatrix_Transposed_x_an_RMatrix( double complex *C, double complex *A, int nrows,int ncols, double *B, int mcols )

    Post multiply the transpose of the nrows×ncols complex matrix A by the nrows×mcols real matrix B to form the ncols×mcols complex matrix C, i.e. C = ATB, where T denotes the transpose. The matrix C should be declared as double complex C[ncols][mcols] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void CMatrix_x_an_RMatrix_Transposed( double complex *C, double complex *A, int nrows, int ncols, double *B, int mrows)

    Post multiply the nrows×ncols complex matrix A by the transpose of the mrows×ncols real matrix B to form the nrows×mrows complex matrix C, i.e. C = A BT, where T denotes the transpose. The matrix C should be declared as double complex C[nrows][mrows] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void RMatrix_Transposed_x_a_CMatrix( double complex *C, double *A, int nrows,int ncols, double complex *B, int mcols )

    Post multiply the transpose of the nrows×ncols real matrix A by the nrows×mcols complex matrix B to form the ncols×mcols complex matrix C, i.e. C = ATB, where T denotes the transpose. The matrix C should be declared as double complex C[ncols][mcols] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void RMatrix_x_a_CMatrix_Daggered( double complex *C, double complex *A, int nrows, int ncols, double complex *B, int mrows)

    Post multiply the nrows×ncols real matrix A by the complex conjugate of the transpose of the mrows×ncols complex matrix B to form the nrows×mrows complex matrix C, i.e. C = A B, where denotes the complex conjugate transpose. The matrix C should be declared as double complex C[nrows][mrows] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

  • void RMatrix_x_a_CMatrix_Transposed( double complex *C, double *A, int nrows, int ncols, double complex *B, int mrows)

    Post multiply the nrows×ncols real matrix A by the transpose of the mrows×ncols complex matrix B to form the nrows×mrows complex matrix C, i.e. C = A BT, where T denotes the transpose. The matrix C should be declared as double complex C[nrows][mrows] in the calling routine. The memory allocated to C should not include any memory allocated to A or B.

C Source Code

C Test Code, Test Results, and Build Shell Script

  • The file, testmatrixxamatrixtransposed.c, contains a test program of Matrix_x_a_Matrix_Transposed( ) in the file matrix_x_a_matrix_transposed.c. This test program requires the file matrix_x_a_matrix_transposed.c listed above.

  • The file, MatrixxAMatrixTransposedTests.txt, contains the results of the test program testmatrixxamatrixtransposed.c.

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


  • The file, testmatrixxitstranspose.c, contains a test program of Matrix_x_Its_Transpose( ) in the file matrix_x_its_transpose.c. This test program requires the file matrix_x_its_transpose.c listed above.

  • The file, MatrixxItsTransposeTests.txt, contains the results of the test program testmatrixxitstranspose.c.

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


  • The file, testmatrixtransposedxamatrix.c, contains a test program of Matrix_Transposed_x_a_Matrix( ) in the file matrix_transposed_x_a_matrix.c. This test program requires the file matrix_transposed_x_a_matrix.c listed above.

  • The file, MatrixTransposedxAMatrixTests.txt, contains the results of the test program testmatrixtransposedxamatrix.c.

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


  • The file, testmatrixtransposedxthematrix.c, contains a test program of Matrix_Transposed_x_the_Matrix( ) in the file matrix_transposed_x_the_matrix.c. This test program requires the file matrix_transposed_x_the_matrix.c listed above.

  • The file, MatrixTransposedxtheMatrixTests.txt, contains the results of the test program testmatrixtransposedxthematrix.c.

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


  • The file, testcmatrixxacmatrixtransposed.c, contains a test program of CMatrix_x_a_CMatrix_Transposed( ) in the file cmatrix_x_a_cmatrix_transposed.c. This test program requires the file cmatrix_x_a_cmatrix_transposed.c listed above.

  • The file, CMatrixxACMatrixTransposedTests.txt, contains the results of the test program testcmatrixxacmatrixtransposed.c.

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


  • The file, testcmatrixxitstranspose.c, contains a test program of CMatrix_x_Its_Transpose( ) in the file cmatrix_x_its_transpose.c. This test program requires the file cmatrix_x_its_transpose.c listed above.

  • The file, CMatrixxItsTransposeTests.txt, contains the results of the test program testcmatrixxitstranspose.c.

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


  • The file, testcmatrixtransposedxacmatrix.c, contains a test program of CMatrix_Transposed_x_a_CMatrix( ) in the file cmatrix_transposed_x_a_cmatrix.c. This test program requires the file cmatrix_transposed_x_a_cmatrix.c listed above.

  • The file, CMatrixTransposedxACMatrixTests.txt, contains the results of the test program testcmatrixtransposedxacmatrix.c.

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


  • The file, testcmatrixtransposedxthecmatrix.c, contains a test program of CMatrix_Transposed_x_the_CMatrix( ) in the file cmatrix_transposed_x_the_cmatrix.c. This test program requires the file cmatrix_transposed_x_the_cmatrix.c listed above.

  • The file, CMatrixTransposedxtheCMatrixTests.txt, contains the results of the test program testcmatrixtransposedxthecmatrix.c.

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


  • The file, testcmatrixxacmatrixdaggered.c, contains a test program of CMatrix_x_a_CMatrix_Daggered( ) in the file cmatrix_x_a_cmatrix_daggered.c. This test program requires the file cmatrix_x_a_cmatrix_daggered.c listed above.

  • The file, CMatrixxACMatrixDaggeredTests.txt, contains the results of the test program testcmatrixxacmatrixdaggered.c.

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


  • The file, testcmatrixxitsdagger.c, contains a test program of CMatrix_x_Its_Dagger( ) in the file cmatrix_x_its_dagger.c. This test program requires the file cmatrix_x_its_dagger.c listed above.

  • The file, CMatrixxItsDaggerTests.txt, contains the results of the test program testcmatrixxitsdagger.c.

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


  • The file, testcmatrixdaggeredxacmatrix.c, contains a test program of CMatrix_Daggered_x_a_CMatrix( ) in the file cmatrix_daggered_x_a_cmatrix.c. This test program requires the file cmatrix_daggered_x_a_cmatrix.c listed above.

  • The file, CMatrixDaggeredxACMatrixTests.txt, contains the results of the test program testcmatrixdaggeredxacmatrix.c.

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


  • The file, testcmatrixdaggeredxthecmatrix.c, contains a test program of CMatrix_Daggered_x_the_CMatrix( ) in the file cmatrix_daggered_x_the_cmatrix.c. This test program requires the file cmatrix_daggered_x_the_cmatrix.c listed above.

  • The file, CMatrixDaggeredxtheCMatrixTests.txt, contains the results of the test program testcmatrixdaggeredxthecmatrix.c.

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


  • The file, testcmatrixdaggeredxanrmatrix.c, contains a test program of CMatrix_Daggered_x_an_RMatrix( ) in the file cmatrix_daggered_x_an_rmatrix.c. This test program requires the file cmatrix_daggered_x_an_rmatrix.c listed above.

  • The file, CMatrixDaggeredxAnRMatrixTests.txt, contains the results of the test program testcmatrixdaggeredxanrmatrix.c.

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


  • The file, testcmatrixtransposedxanrmatrix.c, contains a test program of CMatrix_Transposed_x_an_RMatrix( ) in the file cmatrix_transposed_x_an_rmatrix.c. This test program requires the file cmatrix_transposed_x_an_rmatrix.c listed above.

  • The file, CMatrixTransposedxAnRMatrixTests.txt, contains the results of the test program testcmatrixtransposedxanrmatrix.c.

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


  • The file, testcmatrixxanrmatrixtransposed.c, contains a test program of CMatrix_x_an_RMatrix_Transposed( ) in the file cmatrix_x_an_rmatrix_transposed.c. This test program requires the file cmatrix_x_an_rmatrix_transposed.c listed above.

  • The file, CMatrixxAnRMatrixTransposedTests.txt, contains the results of the test program testcmatrixxanrmatrixtransposed.c.

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


  • The file, testrmatrixtransposedxacmatrix.c, contains a test program of RMatrix_Transposed_x_a_CMatrix( ) in the file rmatrix_transposed_x_a_cmatrix.c. This test program requires the file rmatrix_transposed_x_a_cmatrix.c listed above.

  • The file, RMatrixTransposedxACMatrixTests.txt, contains the results of the test program testrmatrixtransposedxacmatrix.c.

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


  • The file, testrmatrixxacmatrixdaggered.c, contains a test program of RMatrix_x_a_CMatrix_Daggered( ) in the file rmatrix_x_a_cmatrix_daggered.c. This test program requires the file rmatrix_x_a_cmatrix_daggered.c listed above.

  • The file, RMatrixxACMatrixDaggeredTests.txt, contains the results of the test program testrmatrixxacmatrixdaggered.c.

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


  • The file, testrmatrixxacmatrixtransposed.c, contains a test program of RMatrix_x_a_CMatrix_Transposed( ) in the file rmatrix_x_a_cmatrix_transposed.c. This test program requires the file rmatrix_x_a_cmatrix_transposed.c listed above.

  • The file, RMatrixxACMatrixTransposedTests.txt, contains the results of the test program testrmatrixxacmatrixtransposed.c.

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