[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/extragear/kde3/graphics/kst/src/plugins/crossspectrum
From:       Andrew Walker <arwalker () sumusltd ! com>
Date:       2008-03-04 22:31:43
Message-ID: 1204669903.214411.8443.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 782362 by arwalker:

protect against sample rate of zero in the cross power spectrum

 M  +5 -1      crosspowerspectrum.cpp  


--- branches/extragear/kde3/graphics/kst/src/plugins/crossspectrum/crosspowerspectrum.cpp #782361:782362
@@ -304,6 +304,10 @@
   int iSubset, nSubsets;
   int iSamp, copyLen;
 
+  if (sampleRate == 0.0) {
+    sampleRate = 1.0;
+  }
+
   // parse fft length
   xpsLen = int(fft->value() - 0.99);
   if (xpsLen > KSTPSDMAXLEN ) {
@@ -391,7 +395,7 @@
     real->value()[xpsLen-1] += a[1]*b[1];
     for (iSamp=1; iSamp<xpsLen-1; iSamp++) {
       real->value()[iSamp] += a[iSamp*2] * b[iSamp*2] + a[iSamp*2+1] * b[iSamp*2+1];
-      imaginary->value()[iSamp]+= -a[iSamp*2] * b[iSamp*2+1] + a[iSamp*2+1] * b[iSamp*2];
+      imaginary->value()[iSamp] += -a[iSamp*2] * b[iSamp*2+1] + a[iSamp*2+1] * b[iSamp*2];
     } // (a+ci)(b+di)* = ab+cd +i(-ad + cb)
   }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic