[Kst] extragear/graphics/kst/plugins/discretizing_filters
Nicolas Brisset
nicolas.brisset at eurocopter.com
Mon Dec 12 17:29:54 CET 2005
SVN commit 487934 by brisset:
Use double instead of long double, as it makes the filter ca 15 times faster (and 7 x faster than the FFT implementation) svn diff kstfilter_generic.cpp! Hopefully, doubles will be enough as long as filter orders are reasonable. Note that we still have an init problem somewhere.
M +9 -9 kstfilter_generic.cpp
--- trunk/extragear/graphics/kst/plugins/discretizing_filters/kstfilter_generic.cpp #487933:487934
@@ -31,18 +31,18 @@
QStringList numCoeffs = QStringList::split(QRegExp("\\s*(,|;|:)\\s*"), inStrings[0]);
QStringList denCoeffs = QStringList::split(QRegExp("\\s*(,|;|:)\\s*"), inStrings[1]);
int numDegree = numCoeffs.count() - 1, denDegree = denCoeffs.count() - 1;
-polynom<long double> Num(numDegree), Den(denDegree);
+polynom<double> Num(numDegree), Den(denDegree);
double tmpDouble = 0.0;
bool ok = false;
for (i=0; i<=numDegree; i++) {
tmpDouble = numCoeffs[i].toDouble(&ok);
- if (ok) Num[i]= (long double) tmpDouble;
- else Num[i] = (long double) 0.0;
+ if (ok) Num[i]= tmpDouble;
+ else Num[i] = 0.0;
}
for (i=0; i<=denDegree; i++) {
tmpDouble = denCoeffs[i].toDouble(&ok);
- if (ok) Den[i] = (long double) tmpDouble;
- else Den[i] = (long double) 0.0;
+ if (ok) Den[i] = tmpDouble;
+ else Den[i] = 0.0;
}
// Time step
@@ -53,14 +53,14 @@
outArrayLens[0] = length;
// Create filter
-filter<long double> theFilter(Num,Den,DeltaT);
-long double in = 0.0;
+filter<double> theFilter(Num,Den,DeltaT);
+double in = 0.0;
theFilter.ConnectTo(in);
theFilter.Reset();
for (int i=0; i<length; i++) {
- in = (long double) inArrays[0][i];
+ in = inArrays[0][i];
theFilter.NextTimeStep();
- outArrays[0][i] = (double) theFilter.out;
+ outArrays[0][i] = theFilter.out;
}
return 0;
More information about the Kst
mailing list