本文整理汇总了C++中KstVectorPtr::zero方法的典型用法代码示例。如果您正苦于以下问题:C++ KstVectorPtr::zero方法的具体用法?C++ KstVectorPtr::zero怎么用?C++ KstVectorPtr::zero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstVectorPtr
的用法示例。
在下文中一共展示了KstVectorPtr::zero方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillY
bool KstEquation::FillY(bool force) {
int v_shift=0, v_new;
int i0=0;
int ns;
writeLockInputsAndOutputs();
// determine value of Interp
if (_doInterp) {
ns = (*_xInVector)->length();
for (KstVectorMap::ConstIterator i = VectorsUsed.begin(); i != VectorsUsed.end(); ++i) {
if (i.data()->length() > ns) {
ns = i.data()->length();
}
}
} else {
ns = (*_xInVector)->length();
}
if (_ns != (*_xInVector)->length() || ns != (*_xInVector)->length() ||
(*_xInVector)->numShift() != (*_xInVector)->numNew()) {
_ns = ns;
KstVectorPtr xv = *_xOutVector;
KstVectorPtr yv = *_yOutVector;
if (!xv->resize(_ns)) {
// FIXME: handle error?
unlockInputsAndOutputs();
return false;
}
if (!yv->resize(_ns)) {
// FIXME: handle error?
unlockInputsAndOutputs();
return false;
}
yv->zero();
i0 = 0; // other vectors may have diffent lengths, so start over
v_shift = _ns;
} else {
// calculate shift and new samples
// only do shift optimization if all used vectors are same size and shift
v_shift = (*_xInVector)->numShift();
v_new = (*_xInVector)->numNew();
for (KstVectorMap::ConstIterator i = VectorsUsed.begin(); i != VectorsUsed.end(); ++i) {
if (v_shift != i.data()->numShift()) {
v_shift = _ns;
}
if (v_new != i.data()->numNew()) {
v_shift = _ns;
}
if (_ns != i.data()->length()) {
v_shift = _ns;
}
}
if (v_shift > _ns/2 || force) {
i0 = 0;
v_shift = _ns;
} else {
KstVectorPtr xv = *_xOutVector;
KstVectorPtr yv = *_yOutVector;
for (int i = v_shift; i < _ns; i++) {
yv->value()[i - v_shift] = yv->value()[i];
xv->value()[i - v_shift] = xv->value()[i];
}
i0 = _ns - v_shift;
}
}
_numShifted = (*_yOutVector)->numShift() + v_shift;
if (_numShifted > _ns) {
_numShifted = _ns;
}
_numNew = _ns - i0 + (*_yOutVector)->numNew();
if (_numNew > _ns) {
_numNew = _ns;
}
(*_xOutVector)->setNewAndShift(_numNew, _numShifted);
(*_yOutVector)->setNewAndShift(_numNew, _numShifted);
double *rawxv = (*_xOutVector)->value();
double *rawyv = (*_yOutVector)->value();
KstVectorPtr iv = (*_xInVector);
Equation::Context ctx;
ctx.sampleCount = _ns;
ctx.xVector = iv;
if (!_pe) {
if (_equation.isEmpty()) {
unlockInputsAndOutputs();
return true;
}
QMutexLocker ml(&Equation::mutex());
yy_scan_string(_equation.latin1());
int rc = yyparse();
//.........这里部分代码省略.........