title: Matrix Multiplication Using SSE Error __m128 to *float conversion?
body: <p>I'm trying to program matrix multiplication using SSE Intrinsic. I'm not sure if my code is correct and I can't compiler it either because I get an error:</p>
  
  <pre><code>Error   1   error C2440: 'type cast' : cannot convert from 'float' to '__m128 *
  </code></pre>
  
  <p>Can someone double check my program so that my matrix multiplication is correct? Note also that this is for a square matrix.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>void Intrinsics (float * matrix_a, float * matrix_b, float * matrix_result, const int num_row, const int num_col) {
      __declspec(align(16)) float * a = matrix_a;
      __declspec(align(16)) float * b = matrix_b;
      __declspec(align(16)) float * c = matrix_result;
  
      for(int i = 0; i &lt; num_row; ++i)
      {
         for(int j = 0; j &lt; num_col; ++j)
          {
              __m128 *m3 = (__m128*)a[i];     // The error is here.
              __m128 *m4 = (__m128*)b[j];
              float* res;
              *(c + (j * num_col + i)) = 0;
            for(int k = 0; k &lt; num_col; k += 4)
              {
                  __m128 m5 = _mm_mul_ps(*m3,*m4);
                  res = (float*)&amp;m5;
                  *(c + (j * num_col + i)) += res[0]+res[1]+res[2]+res[3];
                  m3++;
                  m4++;
              }
          }
      }
  }
  </code></pre>