add constness

This commit is contained in:
Ingmar Splitt 2017-01-06 12:20:33 +01:00
parent c225efda5a
commit 68cca02565

View File

@ -12,8 +12,8 @@ class kissfft
using cpx_t = std::complex<scalar_t>; using cpx_t = std::complex<scalar_t>;
kissfft( std::size_t nfft, kissfft( const std::size_t nfft,
bool inverse ) const bool inverse )
:_nfft(nfft) :_nfft(nfft)
,_inverse(inverse) ,_inverse(inverse)
{ {
@ -50,8 +50,8 @@ class kissfft
/// had been newly constructed with the passed arguments. /// had been newly constructed with the passed arguments.
/// However, the implementation may be faster than constructing a /// However, the implementation may be faster than constructing a
/// new fft object. /// new fft object.
void assign( std::size_t nfft, void assign( const std::size_t nfft,
bool inverse ) const bool inverse )
{ {
if ( nfft != _nfft ) if ( nfft != _nfft )
{ {
@ -79,7 +79,7 @@ class kissfft
/// constructor. Hence when applying the same transform twice, but with /// constructor. Hence when applying the same transform twice, but with
/// the inverse flag changed the second time, then the result will /// the inverse flag changed the second time, then the result will
/// be equal to the original input times @c N. /// be equal to the original input times @c N.
void transform(const cpx_t * fft_in, cpx_t * fft_out, std::size_t stage = 0, std::size_t fstride = 1, std::size_t in_stride = 1) const void transform(const cpx_t * fft_in, cpx_t * fft_out, const std::size_t stage = 0, const std::size_t fstride = 1, const std::size_t in_stride = 1) const
{ {
const std::size_t p = _stageRadix[stage]; const std::size_t p = _stageRadix[stage];
const std::size_t m = _stageRemainder[stage]; const std::size_t m = _stageRemainder[stage];
@ -143,8 +143,8 @@ class kissfft
/// Since C++11, these requirements are guaranteed to be satisfied for /// Since C++11, these requirements are guaranteed to be satisfied for
/// @c scalar_ts being @c float, @c double or @c long @c double /// @c scalar_ts being @c float, @c double or @c long @c double
/// together with @c cpx_t being @c std::complex<scalar_t>. /// together with @c cpx_t being @c std::complex<scalar_t>.
void transform_real( const scalar_t * src, void transform_real( const scalar_t * const src,
cpx_t * dst ) const cpx_t * const dst ) const
{ {
const std::size_t N = _nfft; const std::size_t N = _nfft;
if ( N == 0 ) if ( N == 0 )
@ -182,7 +182,7 @@ class kissfft
private: private:
void kf_bfly2( cpx_t * Fout, const size_t fstride, std::size_t m) const void kf_bfly2( cpx_t * Fout, const size_t fstride, const std::size_t m) const
{ {
for (std::size_t k=0;k<m;++k) { for (std::size_t k=0;k<m;++k) {
const cpx_t t = Fout[m+k] * _twiddles[k*fstride]; const cpx_t t = Fout[m+k] * _twiddles[k*fstride];
@ -222,7 +222,7 @@ class kissfft
}while(--k); }while(--k);
} }
void kf_bfly4( cpx_t * Fout, const std::size_t fstride, const std::size_t m) const void kf_bfly4( cpx_t * const Fout, const std::size_t fstride, const std::size_t m) const
{ {
cpx_t scratch[7]; cpx_t scratch[7];
const scalar_t negative_if_inverse = _inverse ? -1 : +1; const scalar_t negative_if_inverse = _inverse ? -1 : +1;
@ -245,7 +245,7 @@ class kissfft
} }
} }
void kf_bfly5( cpx_t * Fout, const std::size_t fstride, const std::size_t m) const void kf_bfly5( cpx_t * const Fout, const std::size_t fstride, const std::size_t m) const
{ {
cpx_t *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; cpx_t *Fout0,*Fout1,*Fout2,*Fout3,*Fout4;
cpx_t scratch[13]; cpx_t scratch[13];
@ -311,10 +311,10 @@ class kissfft
/* perform the butterfly for one stage of a mixed radix FFT */ /* perform the butterfly for one stage of a mixed radix FFT */
void kf_bfly_generic( void kf_bfly_generic(
cpx_t * Fout, cpx_t * const Fout,
const size_t fstride, const size_t fstride,
std::size_t m, const std::size_t m,
std::size_t p const std::size_t p
) const ) const
{ {
const cpx_t * twiddles = &_twiddles[0]; const cpx_t * twiddles = &_twiddles[0];