Bug 129530 - Equation X output vector length error
Summary: Equation X output vector length error
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: VHI normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-21 02:10 UTC by Netterfield
Modified: 2006-06-21 05:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Netterfield 2006-06-21 02:10:37 UTC
Version:           1.3.0_devel (using KDE 3.5.3, Kubuntu Package 4:3.5.3-0ubuntu0.1 dapper)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-25-686

The recent patch to fix 128483 has problems:

Create to vectors of different lengths (eg, read two fields from a data source with different number of samples per frame).

Create an equation with the shorter length vector as X and use the longer length vector in the equation (eg, [V2] + 1).

Result: The output X vector will have the lenght of V2, but only the first [length_of_V1] samples will be set.

Expected: the output X vector will be exactly the same as the input X vector, except for its name.

Note that the current implementation attempts to copy the input vector to the output vector.  I think that it would be better to instead create a new class aliasVector which simply returns the properties of the source vector, except for its name, without making a copy.  Not sure what the cleanest C++ for this would be though.
Comment 1 Netterfield 2006-06-21 02:15:23 UTC
This bug makes equations unusable for most dirfiles, where it is common for INDEX to have a different number of samples per frame than most fields.  This needs to be fixed immediately, or the 'fix' to 128483 needs to be reverted until it is fixed.

Additionally, a test case for this needs to be added.
Comment 2 Netterfield 2006-06-21 03:45:31 UTC
SVN commit 553439 by netterfield:

BUG: 129530 

re-set the length of the output vector to the right thing.... 



 M  +4 -0      kstequation.cpp  


--- trunk/extragear/graphics/kst/src/libkstmath/kstequation.cpp #553438:553439
@@ -450,6 +450,10 @@
     rawyv[ctx.i] = _pe->value(&ctx);
   }
 
+  if (!(*_xOutVector)->resize(iv->length())) {
+    // FIXME: handle error?
+    return false;    
+  }
   return true;
 }
 
Comment 3 George Staikos 2006-06-21 05:23:22 UTC
On Tuesday 20 June 2006 20:10, netterfield@astro.utoronto.ca wrote:

> Note that the current implementation attempts to copy the input vector to
> the output vector.  I think that it would be better to instead create a new
> class aliasVector which simply returns the properties of the source vector,
> except for its name, without making a copy.  Not sure what the cleanest C++
> for this would be though.


  I agree.  It should be a proxy class.