Version: 0.99-devel (using KDE 3.2 BRANCH >= 20040204, Mandrake Linux Cooker i586 - Cooker) Compiler: gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk) OS: Linux (i686) release 2.6.3-7mdk In equations, the length of the equation vectors is the desired length-1. So if vectors of length 10 are used as the input X vector and in the equation,then the equation will have length 9, and will be resampled.... This really confused us today using kst to debug something else, so it is a pretty serious problem. The patch is trival, and I will submit it next.
The patch I submitted earlier fixes the case where NS_i == int(a)NS_j. But this is rarely the case. More often, for RVectors NS_i = int(a)(NS_j-SPF) + 1 So that the 1st and last samples correspond properly. Fixing it will be non-trival, but I think it is pretty important. Thoughts?
CVS commit by netterfield: fix for [Bug 87177] equations are incorrectly re-sampled CCMAIL: 87177-done@bugs.kde.org M +5 -10 kstequationcurve.cpp 1.61.2.1 --- kdeextragear-2/kst/kst/kstequationcurve.cpp #1.61:1.61.2.1 @@ -371,16 +371,11 @@ bool KstEquationCurve::FillY(bool force) } } - if ((*_xVector)->sampleCount() > 0) { - _interp = (ns+1) / (*_xVector)->sampleCount(); - } else { // avoid divide by zero - _interp = 1; - } } else { - _interp = 1; + ns = (*_xVector)->sampleCount(); } - if (NS != (*_xVector)->sampleCount() || _interp != 1 || + if (NS != (*_xVector)->sampleCount() || (ns != (*_xVector)->sampleCount()) || (*_xVector)->numShift() != (*_xVector)->numNew()) { - NS = (*_xVector)->sampleCount()*_interp;// - 1; + NS = ns; KstVectorPtr yv = *_yVector; @@ -395,6 +390,6 @@ bool KstEquationCurve::FillY(bool force) // calculate shift and new samples // only do shift optimization if all used vectors are same size and shift - v_shift = (*_xVector)->numShift()*_interp; - v_new = (*_xVector)->numNew()*_interp; + v_shift = (*_xVector)->numShift(); + v_new = (*_xVector)->numNew(); for (i_v = 0; i_v < VectorsUsed.count(); i_v++) {