
The direct sum of the matrices A_{1},..., A_{n} is the matrix C = A_{1} ⊕ ... ⊕ A_{n} given by the matrix
C = 
⌈  A_{1}  0  ···  0  ⌉ 
  0  A_{2}  ···  0   
  ···  ···  ···  ···   
⌊  0  0  ···  A_{n}  ⌋ 


 void Direct_Sum( double *C, int nrows, int ncols, int number_of_summands, double *A1, int nrows1, int ncols1, ... , double *Am, int nrowsm, int ncolsm, double *Alast )
This routine initializes the nrows×ncols matrix C as the direct sum of number_of_summands matrices A1, … , Alast, where last = number_of_summands. The number of rows of C, nrows, is equal to the sum of the number of rows of the individual summands:
nrows = nrows1 + … + nrowsm + nrowslast,
and the number of columns of C, ncols, is equal to the
sum of the number of columns of the individual summands:
ncols = ncols1 + … + ncolsm + ncolslast.
Note that the number of rows and columns of the last summand, Alast, are not arguments, but rather are calculated internally.
 void CDirect_Sum( double complex *C, int nrows, int ncols, int number_of_summands, double complex*A1, int nrows1, int ncols1, ... , double complex *Am, int nrowsm, int ncolsm, double complex *Alast )
This routine initializes the nrows×ncols matrix C as the direct sum of number_of_summands matrices A1, … , Alast, where last = number_of_summands. The number of rows of C, nrows, is equal to the sum of the number of rows of the individual summands:
nrows = nrows1 + … + nrowsm + nrowslast,
and the number of columns of C, ncols, is equal to the
sum of the number of columns of the individual summands:
ncols = ncols1 + … + ncolsm + ncolslast.
Note that the number of rows and columns of the last summand, Alast, are not arguments, but rather are calculated internally.
 The file, direct_sum.c, contains the version of Direct_Sum( ) written in C.
 The file, cdirect_sum.c, contains the version of CDirect_Sum( ) written in C.
 The file, testdirectsum_C.c, contains a test program of Direct_Sum( ). This test program requires the file direct_sum.c listed above.
 The file, DirectSumTests_C.txt, contains the results of the test program testdirectsum_C.c.
 The file, testdirectsum_C.sh, contains the shell script used to compile, link, and execute the test program testdirectsum_C.c.
 The file, testcdirectsum.c, contains a test program of CDirect_Sum( ). This test program requires the file cdirect_sum.c listed above.
 The file, CDirectSumTests.txt, contains the results of the test program testcdirectsum.c.
 The file, testcdirectsum.sh, contains the shell script used to compile, link, and execute the test program testcdirectsum.c.
 The file, direct_sum.asm, contains the version of Direct_Sum( ) written in NASM.
 The file, testdirectsum_A.c, contains a test program of Zero_Vector( ). This test program requires the file zero_vector.asm listed above.
 The file, DirectSumTests_A.txt, contains the results of the test program testdirectsum_A.c.
 The file, testdirectsum_A.sh, contains the shell script used to compile, link, and execute the test program testdirectsum_A.c.
Routine  3 ×3 ⊕ 3×3 
direct_sum.c  1016 
direct_sum.asm  494 

