Summary: | scalar that would give the last value of a vector | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Marc-Antoine Miville-Deschenes <mamd> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Other | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Marc-Antoine Miville-Deschenes
2004-08-26 13:02:15 UTC
CVS commit by arwalker: Add automatically generated scalar gicing last read value of a vector. CCMAIL: 88120-done@bugs.kde.org M +13 -4 kstvector.cpp 1.79 --- kdeextragear-2/kst/kst/kstvector.cpp #1.78:1.79 @@ -136,9 +136,11 @@ double KstVector::interpolate(int in_i, /** Limits checks - optional? **/ - if (in_i < 0) + if (in_i < 0) { return _v[0]; + } - if (in_i >= ns_i - 1) + if (in_i >= ns_i - 1) { return _v[_size - 1]; + } /** speedup check **/ @@ -186,4 +188,6 @@ void KstVector::CreateScalars() { _scalars.insert("min", new KstScalar(tagName() + "-Min")); _scalars["min"]->_KShared_ref(); + _scalars.insert("last", new KstScalar(tagName() + "-Last")); + _scalars["last"]->_KShared_ref(); _scalars.insert("mean", new KstScalar(tagName() + "-Mean")); _scalars["mean"]->_KShared_ref(); @@ -207,4 +211,5 @@ void KstVector::RenameScalars() { _scalars["max"]->setTagName(tagName() + "-Max"); _scalars["min"]->setTagName(tagName() + "-Min"); + _scalars["last"]->setTagName(tagName() + "-Last"); _scalars["mean"]->setTagName(tagName() + "-Mean"); _scalars["sigma"]->setTagName(tagName() + "-Sigma"); @@ -279,9 +284,9 @@ bool KstVector::resize(int sz, bool rein KstObject::UpdateType KstVector::update(int update_counter) { int i, i0; - double max, min, sum, sum2, minpos, v; + double max, min, sum, sum2, minpos, last, v; double last_v; double dv2=0.0, dv, no_spike_max_dv; - max = min = sum = sum2 = minpos = 0.0; + max = min = sum = sum2 = minpos = last = 0.0; if (KstObject::checkUpdateCounter(update_counter)) @@ -303,4 +308,5 @@ KstObject::UpdateType KstVector::update( _scalars["min"]->setValue(min); _scalars["minpos"]->setValue(minpos); + _scalars["last"]->setValue(last); } _ns_max = _ns_min = 0; @@ -364,4 +370,6 @@ KstObject::UpdateType KstVector::update( _ns_max = _ns_min = last_v = _v[i0]; + last = _v[_size-1]; + for (i = i0; i < _size; i++) { v = _v[i]; // get rid of redirections @@ -390,4 +398,5 @@ KstObject::UpdateType KstVector::update( _scalars["min"]->setValue(min); _scalars["minpos"]->setValue(minpos); + _scalars["last"]->setValue(last); } |