本文整理汇总了C++中DoubleArray::data方法的典型用法代码示例。如果您正苦于以下问题:C++ DoubleArray::data方法的具体用法?C++ DoubleArray::data怎么用?C++ DoubleArray::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleArray
的用法示例。
在下文中一共展示了DoubleArray::data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeAmplitude
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool AmplitudeProcessor_msbb::computeAmplitude(const DoubleArray &data,
size_t i1, size_t i2,
size_t si1, size_t si2, double offset,
AmplitudeIndex *dt,
AmplitudeValue *amplitude,
double *period, double *snr) {
/*
* Low-level signal amplitude computation. This is magnitude specific.
*
* Input:
* f double array of length n
* i1,i2 indices defining the measurement window,
* 0 <= i1 < i2 <= n
* offset this is subtracted from the samples in f before
* computation
*
* Output:
* dt Point at which the measurement was mad/completed. May
* be the peak time or end of integration.
* amplitude amplitude. This may be a peak amplitude as well as a
* sum or integral.
* period dominant period of the signal. Optional. If the period
* is not computed, set it to -1.
*/
size_t imax = find_absmax(data.size(), (const double*)data.data(), si1, si2, offset);
double amax = fabs(data[imax] - offset);
double pmax = -1;
double pstd = 0; // standard error of period
if ( !measure_period(data.size(), static_cast<const double*>(data.data()), imax, offset, &pmax, &pstd) )
pmax = -1;
if ( amax < *_noiseAmplitude * _config.snrMin ) {
amplitude->value = amax / *_noiseAmplitude;
setStatus(LowSNR, amplitude->value);
return false;
}
dt->index = imax;
*period = pmax;
amplitude->value = amax;
if ( _usedComponent <= SecondHorizontal ) {
if ( _streamConfig[_usedComponent].gain != 0.0 )
amplitude->value /= _streamConfig[_usedComponent].gain;
else {
setStatus(MissingGain, 0.0);
return false;
}
}
else
return false;
return true;
}
示例2: fractile
double fractile(const DoubleArray &v, double x)
{
return fractile(v.size(), (const double*)v.data(), x);
}
示例3: mean
double mean(const DoubleArray &v)
{
return mean(v.size(), (const double*)v.data());
}
示例4: trimmedMean
double
trimmedMean(const DoubleArray &v, double percent)
{
// XXX deprecated XXX
return trimmedMean(v.size(), (const double*)v.data(), percent);
}