From ea26d5d89946749499d49e717a1c8a4cc43edf60 Mon Sep 17 00:00:00 2001 From: chzchzchz Date: Sun, 1 Oct 2017 02:20:38 -0700 Subject: [PATCH] fix build under gcc6.4.0 compiler forbids setting complex values by assigning to real() and imag() --- include/dsp.h | 6 ++---- src/producer_thread.cpp | 8 ++++---- src/tracker_thread.cpp | 13 +++++-------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/dsp.h b/include/dsp.h index fcba157c..23322105 100644 --- a/include/dsp.h +++ b/include/dsp.h @@ -44,8 +44,7 @@ inline itpp::cvec fshift(const itpp::cvec &seq,const double f,const double fs) { itpp::cvec r(len); std::complexcoeff; for (uint32 t=0;t(cos(k*t), sin(k*t)); //r(t)=seq(t)*exp(k*((double)t)); r(t)=seq(t)*coeff; } @@ -61,8 +60,7 @@ inline void fshift_inplace(itpp::cvec &seq,const double f,const double fs) { const uint32 len=length(seq); std::complexcoeff; for (uint32 t=0;t(cos(k*t), sin(k*t)); //r(t)=seq(t)*exp(k*((double)t)); seq(t)*=coeff; } diff --git a/src/producer_thread.cpp b/src/producer_thread.cpp index 6c726180..594b2149 100644 --- a/src/producer_thread.cpp +++ b/src/producer_thread.cpp @@ -118,17 +118,17 @@ void producer_thread( global_thread_data.raw_seconds_dropped_inc(); } n_samples=BLOCK_SIZE; - complex sample_temp; for (uint16 t=0;t(real, imag); sample_time+=(FS_LTE/16)/(fs_programmed*k_factor); //sample_time=itpp_ext::matlab_mod(sample_time,19200.0); if (sample_time>19200.0) diff --git a/src/tracker_thread.cpp b/src/tracker_thread.cpp index c903685f..db29f98f 100644 --- a/src/tracker_thread.cpp +++ b/src/tracker_thread.cpp @@ -156,18 +156,15 @@ void get_fd( n_samp_elapsed=(sym_num==0)?128+10:128+9; } //syms=exp(J*bulk_phase_offset)*elem_mult(syms,exp((-J*2*pi*tracked_cell.fifo.front().late/128)*cn)); - complex coeff; - double phase; const double k=2*pi*pdu.late/128; bulk_phase_offset=WRAP(bulk_phase_offset+2*pi*n_samp_elapsed*(1/(FS_LTE/16))*-frequency_offset,-pi,pi); const complex bpo_coeff=complex(cos(bulk_phase_offset),sin(bulk_phase_offset)); for (uint8 t=1;t<=36;t++) { - phase=-k*t; - coeff.real()=cos(phase); - coeff.imag()=sin(phase); - syms(35+t)*=bpo_coeff*coeff; - coeff.imag()=-coeff.imag(); - syms(36-t)*=bpo_coeff*coeff; + double phase=-k*t; + double real=cos(phase); + double imag=sin(phase); + syms(35+t)*=bpo_coeff*complex(real, imag); + syms(36-t)*=bpo_coeff*complex(real, -imag); } // At this point, we have the frequency domain data for this slot and // this symbol number. FOC and TOC has already been performed.