add_mat.cc

Go to the documentation of this file.
00001 
00007 extern "C" {
00008 
00020 void add_mat(double **a, double **b, double **c, int n, int m)
00021 {
00022   register int i,j;
00023 
00024   if (n != m) {
00025     for (i=0; i < n ; i++) {
00026       for (j=0; j < m ; j++) {
00027         c[i][j] = a[i][j]+b[i][j];
00028       }
00029     }
00030   }
00031   else {
00032     for (i=0; i < n; i++) {
00033       for (j=0; j < i; j++) {
00034         c[i][j] = a[i][j]+b[i][j];
00035         c[j][i] = a[j][i]+b[j][i];
00036       }
00037       c[i][i] = a[i][i]+b[i][i];
00038     }
00039   }
00040 }
00041 
00042 } /* extern "C" */
00043 

Generated on Wed Feb 13 16:35:39 2008 for PSI by  doxygen 1.5.4