Partage
  • Partager sur Facebook
  • Partager sur Twitter

array type 'mat_b [50][50]' is not assignable

    21 mai 2018 à 12:06:15

    Salut , je veux remplir mes deux matrices de taille [50][50] , j'ai cette erreur : "array type 'mat_b [50][50]' is not assignable"

    mon code est :

    #include <stdio.h>
    
    #include "matrix_mult.h"
    
    //using namespace std;
    int i,j;
    int main(int argc, char *argv[])
    {
    	mat_a in_mat_a[50][50] ;
    	   mat_b in_mat_b[50][50];
    		   for( i=0;i<50;i++){
    			   for( j=0;i<50;j++){
    				   in_mat_a=(i*j)/10;
    
    			   }}
    
          		   for( i=0;i<50;i++){
          			 for( j=0;i<50;j++){
          				in_mat_b=(i+j)/10;
    
          			 }}
    
       mat_prod hw_result[50][50], sw_result[50][50];
       int error_count = 0;
    
       // Generate the expected result
       // Iterate over the rows of the A matrix
       for(i= 0; i < 50; i++) {
          for(j = 0; j < 50; j++) {
             // Iterate over the columns of the B matrix
            // sw_result[i][j] = 0;
             // Do the inner product of a row of A and col of B
            // for(int k = 0; k < 50; k++) {
                sw_result[i][j] = in_mat_a[i][j] * in_mat_b[i][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 (i = 0; i < 50; i++) {
          for (int j = 0; j < 50; j++) {
    #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)
    	   printf ( "Test failed ");
    	     else
    	        printf( "Test passed!" );
    #endif
       return error_count;
    }
    
    



    • Partager sur Facebook
    • Partager sur Twitter
      21 mai 2018 à 13:40:58

      Salut,

      21091992 a écrit:

      j'ai cette erreur : "array type 'mat_b [50][50]' is not assignable"

      ...

      A quoi correspond ce type 'mat_b' ? Ne serait-ce pas déjà un tableau ?

      • Partager sur Facebook
      • Partager sur Twitter
        22 mai 2018 à 12:39:04

        Salut

        21091992 a écrit:

        Salut , je veux remplir mes deux matrices de taille [50][50] , j'ai cette erreur : "array type 'mat_b [50][50]' is not assignable"

        En C, il n'est pas possible d'affecter une valeur à un tableau.

        int t[123];
        t = 22; // ERREUR




        -
        Edité par Marc Mongenet 22 mai 2018 à 12:39:18

        • Partager sur Facebook
        • Partager sur Twitter

        array type 'mat_b [50][50]' is not assignable

        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
        • Editeur
        • Markdown