8 #ifndef CompactRealDftData_H 9 #define CompactRealDftData_H 42 Index namp = amps.size();
43 Index npha = phas.size();
44 if ( namp < npha || namp > npha + 1 )
clear();
52 Index namp = amps.size();
53 Index npha = phas.size();
54 if ( namp < npha || namp > npha + 1 )
clear();
59 if ( &rhs ==
this )
return;
62 if ( nsam == 0 )
return;
64 Index npha = nsam - namp + 1;
65 if ( namp < npha || namp > npha + 1 ) {
clear();
return; }
68 if ( nsam == 0 )
return;
70 if ( rhs.isPower() ) gfac *= sqrt(nsam);
71 if ( rhs.isBin() ) gfac *= nsam;
72 if ( this->isPower() ) gfac /= sqrt(nsam);
73 if ( this->isBin() ) gfac /= nsam;
75 if ( rhs.isUnit() && ! this->isUnit() ) tfac = 1/sqrt(2.0);
76 if ( ! rhs.isUnit() && this->isUnit() ) tfac = sqrt(2.0);
77 for (
Index ifrq=0; ifrq<namp; ++ifrq ) {
96 Index namp = nsam > 0 ? nsam/2 + 1 : 0;
97 Index npha = (nsam + 1)/2;
100 for ( F& amp :
m_amps ) amp = 0.0;
101 for ( F& pha :
m_phas ) pha = 0.0;
106 Index namp = amps.size();
107 Index npha = phas.size();
108 if ( namp < npha || namp > npha + 1 ) {
119 Index namp = amps.size();
120 Index npha = phas.size();
121 if ( namp < npha || namp > npha + 1 ) {
137 if ( ifrq >=
nPhase() )
return 1;
168 2*ifrq == this->
size() ? 0.0 :
178 2*ifrq == this->
size() ? 0.0 :
bool inRange(Index ifrq) const
CompactRealDftData(Norm norm, const FloatVector &s, const FloatVector &phas)
virtual F phase(Index ifrq) const =0
virtual F amplitude(Index ifrq) const =0
CompactRealDftData(Norm norm)
int setPhase(Index ifrq, F val)
CompactRealDftData(const RealDftData< F > &rhs)
void reset(Index nsam) override
int copyOut(FloatVector &s, FloatVector &phas) const
F amplitude(Index ifrq) const override
virtual bool isValid() const
F imag(Index ifrq) const override
Index nCompact() const override
virtual Index nSample() const =0
F phase(Index ifrq) const override
F compactAmplitude(Index ifrq) const
F compactPhase(Index ifrq) const
int setAmplitude(Index ifrq, F val)
virtual F badValue() const
bool isAliased(Index ifrq) const
auto norm(Vector const &v)
Return norm of the specified vector.
Index nSample() const override
CompactRealDftData(const FloatVector &s, const FloatVector &phas)
virtual Index nCompact() const
F real(Index ifrq) const override
std::vector< F > FloatVector
CompactRealDftData(Norm norm, Index nsam)
CompactRealDftData()=default
int moveIn(FloatVector &s, FloatVector &phas)
const Norm & normalization() const override
int moveOut(FloatVector &s, FloatVector &phas)
int copyIn(const FloatVector &s, const FloatVector &phas)