Change W row/col
authorokcsampson <okcsampson@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 12 Jun 2017 02:22:06 +0000 (02:22 +0000)
committerokcsampson <okcsampson@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 12 Jun 2017 02:22:06 +0000 (02:22 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3181 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/ofdm.c
codec2-dev/src/ofdm_internal.h
codec2-dev/unittest/tofdm.c

index 5cb261153780f807d0bcac7b9bbaae9dc06d5261..2dc247a19b5147c87c2a5b8b7662e93cf90e5301 100644 (file)
@@ -82,7 +82,7 @@ static void matrix_vector_multiply(struct OFDM *ofdm, complex float *result, com
         result[row] = 0.0f + 0.0f * I;
 
         for (col = 0; col < (OFDM_NC + 2); col++) {
-            result[row] += (vector[col] * (ofdm->W[row][col] / (float) OFDM_M)); /* complex result */
+            result[row] += (vector[col] * (ofdm->W[col][row] / (float) OFDM_M)); /* complex result */
         }
     }
 }
@@ -238,9 +238,9 @@ struct OFDM *ofdm_create() {
         ofdm->w[i] = j * TAU * OFDM_RS / OFDM_FS;
     }
 
-    for (i = 0; i < OFDM_M; i++) {
-        for (j = 0; j < (OFDM_NC + 2); j++) {
-            ofdm->W[i][j] = cexpf(I * ofdm->w[j] * i);
+    for (i = 0; i < (OFDM_NC + 2); i++) {
+        for (j = 0; j < OFDM_M; j++) {
+            ofdm->W[i][j] = cexpf(I * ofdm->w[i] * j);
         }
     }
 
index fa966f6bad5eab4e0576596d60e0926e5e2fc2dc..b01241f56a18539c5bd161749eb8826c8b5f2fb4 100644 (file)
@@ -64,7 +64,7 @@ struct OFDM {
     bool phase_est_en;
 
     complex float rate_fs_pilot_samples[OFDM_M + OFDM_NCP];
-    complex float W[OFDM_M][OFDM_NC + 2];
+    complex float W[OFDM_NC + 2][OFDM_M];
     complex float rxbuf[OFDM_RXBUF];
     complex float pilots[OFDM_NC + 2];
     float w[OFDM_NC + 2];
index b6936b06c589850d27549ed9da81b7a6f181dc40..61e3a3dc7b84b127005c2b1a2f20d823b5bef4ab 100644 (file)
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
     fout = fopen("tofdm_out.txt","wt");
     assert(fout != NULL);
     fprintf(fout, "# Created by tofdm.c\n");
-    octave_save_complex(fout, "W_c", (COMP*)ofdm->W, OFDM_M, OFDM_NC + 2, OFDM_NC + 2);
+    octave_save_complex(fout, "W_c", (COMP*)ofdm->W, OFDM_NC + 2, OFDM_M, OFDM_M);
     octave_save_int(fout, "tx_bits_log_c", tx_bits_log, 1, OFDM_BITSPERFRAME*FRAMES);
     octave_save_complex(fout, "tx_log_c", (COMP*)tx_log, 1, OFDM_SAMPLESPERFRAME*FRAMES,  OFDM_SAMPLESPERFRAME*FRAMES);
     fclose(fout);