本文整理汇总了C++中realvec::minval方法的典型用法代码示例。如果您正苦于以下问题:C++ realvec::minval方法的具体用法?C++ realvec::minval怎么用?C++ realvec::minval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类realvec
的用法示例。
在下文中一共展示了realvec::minval方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: in
void
AutoCorrelation::myProcess(realvec& in, realvec& out)
{
mrs_natural t,o;
k_ = ctrl_magcompress_->to<mrs_real>();
// Copy to output to perform inplace fft and zeropad to double size
scratch_.create(fftSize_); //scratch_ needs to be reset every time
for (o=0; o < inObservations_; o++)
{
for (t=lowSamples_; t < (lowSamples_+numSamples_); t++)
{
scratch_(t-(lowSamples_)) = in(o,t);
}
//zeropad
for(t=(lowSamples_+numSamples_); t < fftSize_; t++)
scratch_(t) = 0.0;
//get pointer to data (THIS BREAKS ENCAPSULATION! FIXME [!])
mrs_real *tmp = scratch_.getData();
//compute forward FFT (of size fftSize_)
myfft_->rfft(tmp, fftSize_/2, FFT_FORWARD); //rfft() takes as second argument half of the desired FFT size (see fft.cpp)
// Special case for zero and Nyquist/2,
// which only have real part
if (k_ == 2.0)
{
re_ = tmp[0];
tmp[0] = re_ * re_;
re_ = tmp[1];
tmp[1] = re_ * re_;
}
else
{
re_ = tmp[0];
re_ = sqrt(re_ * re_);
tmp[0] = pow(re_, k_);
re_ = tmp[1];
re_ = sqrt(re_ * re_);
tmp[1] = pow(re_, k_);
}
// Compress the magnitude spectrum and zero
// the imaginary part.
for (t=1; t < fftSize_/2; t++)
{
re_ = tmp[2*t];
im_ = tmp[2*t+1];
if (k_ == 2.0)
am_ = re_ * re_ + im_ * im_;
else
{
am_ = sqrt(re_ * re_ + im_ * im_);
am_ = pow(am_, k_);
}
tmp[2*t] = am_;
tmp[2*t+1] = 0;
}
// Take the inverse Fourier Transform (of size fftSize_)
myfft_->rfft(tmp, fftSize_/2, FFT_INVERSE);
// Copy result to output
if(normalize_)
{
for (t=0; t < onSamples_; t++)
{
out(o,t) = scratch_(t)*norm_(t);
}
}
else
for (t=0; t < onSamples_; t++)
{
// out(o,t) = 0.1 * scratch_(t) + 0.99 * out(o,t);
out(o,t) = 1.0 * scratch_(t) + 0.0 * out(o,t);
// out(o,t) = 0.5 * scratch_(t) + 0.5 * out(o,t);
// out(o,t) += scratch_(t);
}
}
if (ctrl_makePositive_->to<mrs_bool>())
{
out -= out.minval();
}
//.........这里部分代码省略.........