[Kst] extragear/graphics/kst/src/libkst
Andrew Walker
arwalker at sumusltd.com
Tue Jun 20 19:11:39 CEST 2006
SVN commit 553302 by arwalker:
BUG:129484 Correctly calculate statistical values for curves holding only NaN values.
M +13 -7 kstvector.cpp
--- trunk/extragear/graphics/kst/src/libkst/kstvector.cpp #553301:553302
@@ -305,7 +305,7 @@
} else {
_scalars["sigma"]->setValue(_max - _min);
_scalars["rms"]->setValue(sqrt(_scalars["sumsquared"]->value()));
- _scalars["mean"]->setValue(_mean = 0);
+ _scalars["mean"]->setValue(_mean = KST::NOPOINT);
}
}
}
@@ -415,14 +415,18 @@
double sum, sum2, last, v;
double last_v;
double dv2 = 0.0, dv, no_spike_max_dv;
- _max = _min = sum = sum2 = _minPos = last = 0.0;
+
+ _max = _min = sum = sum2 = _minPos = last = KST::NOPOINT;
_nsum = 0;
+
if (_size > 0) {
_is_rising = true;
// FIXME: expensive!! Can we somehow cache this at least?
- for (i = 0; i < _size && !finite(_v[i]); i++)
- /* Do Nothing */ ;
+ for (i = 0; i < _size && !finite(_v[i]); i++) {
+ // do nothing
+ }
+
if (i == _size) {
if (!_isScalarList) {
_scalars["sum"]->setValue(sum);
@@ -435,6 +439,7 @@
_ns_max = _ns_min = 0;
updateScalars();
+
return setLastUpdateResult(providerRC);
}
@@ -447,13 +452,14 @@
_max = _min = _v[i0];
sum = sum2 = 0.0;
- if (_v[i0] > 0) {
+ if (_v[i0] > 0.0) {
_minPos = _v[i0];
} else {
_minPos = 1.0E300;
}
last_v = _v[i0];
+
for (i = i0; i < _size; i++) {
v = _v[i]; // get rid of redirections
@@ -478,8 +484,8 @@
} else if (v < _min) {
_min = v;
}
- if (v < _minPos && v > 0) {
- _minPos = v;
+ if (v < _minPos && v > 0.0) {
+ _minPos = v;
}
} else {
_is_rising = false;
More information about the Kst
mailing list