Salut,j'ai entrain de créer un programme de multiplication vecteurs . comme entrées j'ai (double a[10] et double b[10]) et sortie double c[10]. lorsque je compile mon programme . j'ai cette erreur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
:28: error: invalid types 'mat_prod {aka double}[int]' for array subscript
dans la ligne 28 : hw_result[i][j] != sw_result[i][j]. j'ai pas compris d'ou elle vient cette erreur.
merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include "matrix_mult.h"
 
using namespace std;
 
int main(double c)
{
   mat_a in_mat_a[10] = {1,1,2,3,4,5,6,7,8,9};
   mat_b in_mat_b[10] = {9,8,7,6,5,4,3,2,1,1};
   mat_prod hw_result[10], sw_result[10];
   int error_count = 0;
 
   // Generate the expected result
   // Iterate over the rows of the A matrix
   for(int i = 0; i < 9; i++) {
      for(int j = 0; j < 9; j++) {
         // Iterate over the columns of the B matrix
          int k ;
         sw_result[k] = 0;
         // Do the inner product of a row of A and col of B
         for(int k = 0; k < 9; k++) {
            sw_result[k] = in_mat_a[i] * in_mat_b[j];
         }
      }
   }
 
#ifdef HW_COSIM
   // Run the Vivado HLS matrix multiplier
   matrix_mult(in_mat_a, in_mat_b, hw_result);
#endif
 
   // Print product matrix
   for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; i++) {
#ifdef HW_COSIM
 
         // Check result of HLS vs. expected
         if (hw_result[i][j] != sw_result[i][j]) {
            error_count++;
         }
#else
         cout << sw_result[i][j];
#endif
      }
   }
 
#ifdef HW_COSIM
   if (error_count)
      cout << "TEST FAIL: " << error_count << "Results do not match!" << endl;
   else
      cout << "Test passed!" << endl;
#endif
   return error_count;
}
vector multiplication