01 [...] 02 // Matrix vector multiplication in C 03 04 // Matrix: 05 float matrix[4][4]={ 06 { 2.5, 3.4, 7.9, 1.2 }, 07 { 1.2, 7.7, 3.7, 0.5 }, 08 { 3.1, 8.2, 7.1, 3.6 }, 09 { 7.8, 0.4, 1.2, 5.2 } 10 }; 11 12 // Vector: 13 float vector[4]={ 1.0, 1.0, 1.0, 1.0 }; 14 15 // Compute result: 16 float result[4]={0}; 17 int i,j; 18 for (i=0;i<4;i++) 19 { 20 result[i]=0; 21 for(j=0;j<4;j++) 22 { 23 result[i] += matrix[i][j] * vector[j]; 24 } 25 } 26 }