[Kst] kdeextragear-2/kst/plugins/fits/linear_unweighted
Andrew Walker
arwalker at sumusltd.com
Wed Jan 21 21:57:17 CET 2004
CVS commit by arwalker:
Added residuals to the output arrays
M +9 -11 kstfit_linear_unweighted.cpp 1.2
M +3 -0 kstfit_linear_unweighted.xml 1.2
--- kdeextragear-2/kst/plugins/fits/linear_unweighted/kstfit_linear_unweighted.cpp #1.1:1.2
@@ -25,5 +25,5 @@ int kstfit_linear_unweighted(const doubl
int iLength;
int iReturn = -1;
- double* pResult[3];
+ double* pResult[4];
double c0 = 0.0;
double c1 = 0.0;
@@ -41,5 +41,5 @@ int kstfit_linear_unweighted(const doubl
}
- for( i=0; i<3; i++ ) {
+ for( i=0; i<4; i++ ) {
if( outArrayLens[0] != iLength ) {
pResult[i] = (double*)realloc( outArrays[i], iLength * sizeof( double ) );
@@ -49,17 +49,14 @@ int kstfit_linear_unweighted(const doubl
}
- if( pResult[0] != NULL && pResult[1] != NULL && pResult[2] != NULL )
+ if( pResult[0] != NULL &&
+ pResult[1] != NULL &&
+ pResult[2] != NULL &&
+ pResult[3] != NULL )
{
- for( i=0; i<3; i++ ) {
+ for( i=0; i<4; i++ ) {
outArrays[i] = pResult[i];
outArrayLens[i] = iLength;
}
- for( i=0; i<iLength; i++ ) {
- outArrays[0][i] = 0.0;
- outArrays[0][i] = 1.0;
- outArrays[0][i] = 2.0;
- }
-
if( !gsl_fit_linear( inArrays[X], 1, inArrays[Y], 1, iLength, &c0, &c1, &cov00, &cov01, &cov11, &dSumSq ) ) {
@@ -69,4 +66,5 @@ int kstfit_linear_unweighted(const doubl
outArrays[1][i] = y - yErr;
outArrays[2][i] = y + yErr;
+ outArrays[3][i] = inArrays[Y][i] - y;
}
--- kdeextragear-2/kst/plugins/fits/linear_unweighted/kstfit_linear_unweighted.xml #1.1:1.2
@@ -28,4 +28,7 @@
</output>
<output>
+<table type="float" name="Residuals" descr="The residuals of the fitted data." />
+</output>
+<output>
<float name="a" descr="The a value in the fit to y = a + b*x." />
</output>
More information about the Kst
mailing list