Loading [MathJax]/extensions/TeX/boldsymbol.js

 

 

 

Matrix Handling in C/C++, Static and Dynamical allocation

We have an N\times N matrix A with N=100 In C/C++ this would be defined as

   int N = 100;
   double A[100][100];
   //   initialize all elements to zero
   for(i=0 ; i < N ; i++) {
      for(j=0 ; j < N ; j++) {
         A[i][j] = 0.0;

Note the way the matrix is organized, row-major order.