IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2343


Ignore:
Timestamp:
Nov 12, 2004, 9:50:34 AM (22 years ago)
Author:
gusciora
Message:

Added error codes, and corrected the return values in the polynomial
evaluation functions when the polynomial has an incorrect type.

The error stuff does not compile.

Location:
trunk/psLib/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psDataManipErrors.dat

    r2339 r2343  
    2727psStats_STATS_SAMPLE_MEDIAN_SORT_PROBLEM            Failed to sort input data.
    2828psStats_STATS_VECTOR_BIN_DISECT_PROBLEM         Failed to determine the bin number of a data element.
     29psStats_STATS_FIT_QUADRATIC_POLYNOMIAL_1D_FIT Failed to fit a 1-dimensional polynomial to the three specified data points.  Returning NAN.
     30psStats_STATS_POLY_MEDIAN_OUT_OF_RANGE The requested y-value does not fall with the specified range of x-values.  Returning NAN.
    2931#
    3032psFunctions_INVALID_POLYNOMIAL_TYPE    Unknown polynomial type 0x%x found.  Evaluation failed.
  • trunk/psLib/src/dataManip/psDataManipErrors.h

    r2339 r2343  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-11-11 20:13:57 $
     9 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-11-12 19:50:34 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4747#define PS_ERRORTEXT_psStats_STATS_SAMPLE_MEDIAN_SORT_PROBLEM "Failed to sort input data."
    4848#define PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM "Failed to determine the bin number of a data element."
     49#define PS_ERRORTEXT_psStats_STATS_FIT_QUADRATIC_POLYNOMIAL_1D_FIT "Failed to fit a 1-dimensional polynomial to the three specified data points.  Returning NAN."
     50#define PS_ERRORTEXT_psStats_STATS_POLY_MEDIAN_OUT_OF_RANGE "The requested y-value does not fall with the specified range of x-values.  Returning NAN."
    4951#define PS_ERRORTEXT_psFunctions_INVALID_POLYNOMIAL_TYPE "Unknown polynomial type 0x%x found.  Evaluation failed."
    5052#define PS_ERRORTEXT_psFunctions_TYPE_NOT_SUPPORTED "Input psVector type, %s, is not supported."
  • trunk/psLib/src/dataManip/psFunctions.c

    r2338 r2343  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-11-11 19:32:20 $
     9 *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-11-12 19:50:34 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    11691169                myPoly->type);
    11701170    }
    1171     return(0.0);
     1171    return(NAN);
    11721172}
    11731173
     
    12071207                myPoly->type);
    12081208    }
    1209     return(0.0);
     1209    return(NAN);
    12101210}
    12111211
     
    12601260                myPoly->type);
    12611261    }
    1262     return(0.0);
     1262    return(NAN);
    12631263}
    12641264
     
    13241324                myPoly->type);
    13251325    }
    1326     return(0.0);
     1326    return(NAN);
    13271327}
    13281328
     
    15641564                myPoly->type);
    15651565    }
    1566     return(0.0);
     1566    return(NAN);
    15671567}
    15681568
     
    16031603                myPoly->type);
    16041604    }
    1605     return(0.0);
     1605    return(NAN);
    16061606}
    16071607
     
    16571657                myPoly->type);
    16581658    }
    1659     return(0.0);
     1659    return(NAN);
    16601660}
    16611661
     
    17211721                myPoly->type);
    17221722    }
    1723     return(0.0);
     1723    return(NAN);
    17241724}
    17251725
  • trunk/psLib/src/dataManip/psStats.c

    r2342 r2343  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-11-12 19:36:07 $
     11 *  @version $Revision: 1.94 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-11-12 19:50:34 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    992992                       float getThisValue)
    993993{
     994    PS_POLY_CHECK_NULL(myPoly, NAN);
    994995    PS_FLOAT_COMPARE(rangeLow, rangeHigh, NAN);
     996    // We ensure that the requested f(y) value, which is getThisValue, is
     997    // falls within the range of y-values of the polynomial "myPoly" in the
     998    // specified x-range (rangeLow:rangeHigh).
     999    float fLo = psPolynomial1DEval(rangeLow, myPoly);
     1000    float fHi = psPolynomial1DEval(rangeHigh, myPoly);
     1001    if (!((fLo <= getThisValue) && (fHi >= getThisValue))) {
     1002        psError(PS_ERR_UNKNOWN,
     1003                true,
     1004                psStats_STATS_POLY_MEDIAN_OUT_OF_RANGE);
     1005        return(NAN);
     1006    }
     1007
    9951008    psS32 numIterations = 0;
    9961009    float midpoint = 0.0;
     
    10731086        // Determine the coefficients of the polynomial.
    10741087        myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
     1088        if (myPoly == NULL) {
     1089            psError(PS_ERR_UNEXPECTED_NULL,
     1090                    false,
     1091                    psStats_STATS_FIT_QUADRATIC_POLYNOMIAL_1D_FIT);
     1092            return(NAN);
     1093        }
    10751094        // Call p_ps1DPolyMedian(), which does a binary search on the
    10761095        // polynomial, looking for the value x such that f(x) = yVal
  • trunk/psLib/src/math/psPolynomial.c

    r2338 r2343  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-11-11 19:32:20 $
     9 *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-11-12 19:50:34 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    11691169                myPoly->type);
    11701170    }
    1171     return(0.0);
     1171    return(NAN);
    11721172}
    11731173
     
    12071207                myPoly->type);
    12081208    }
    1209     return(0.0);
     1209    return(NAN);
    12101210}
    12111211
     
    12601260                myPoly->type);
    12611261    }
    1262     return(0.0);
     1262    return(NAN);
    12631263}
    12641264
     
    13241324                myPoly->type);
    13251325    }
    1326     return(0.0);
     1326    return(NAN);
    13271327}
    13281328
     
    15641564                myPoly->type);
    15651565    }
    1566     return(0.0);
     1566    return(NAN);
    15671567}
    15681568
     
    16031603                myPoly->type);
    16041604    }
    1605     return(0.0);
     1605    return(NAN);
    16061606}
    16071607
     
    16571657                myPoly->type);
    16581658    }
    1659     return(0.0);
     1659    return(NAN);
    16601660}
    16611661
     
    17211721                myPoly->type);
    17221722    }
    1723     return(0.0);
     1723    return(NAN);
    17241724}
    17251725
  • trunk/psLib/src/math/psSpline.c

    r2338 r2343  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-11-11 19:32:20 $
     9 *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-11-12 19:50:34 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    11691169                myPoly->type);
    11701170    }
    1171     return(0.0);
     1171    return(NAN);
    11721172}
    11731173
     
    12071207                myPoly->type);
    12081208    }
    1209     return(0.0);
     1209    return(NAN);
    12101210}
    12111211
     
    12601260                myPoly->type);
    12611261    }
    1262     return(0.0);
     1262    return(NAN);
    12631263}
    12641264
     
    13241324                myPoly->type);
    13251325    }
    1326     return(0.0);
     1326    return(NAN);
    13271327}
    13281328
     
    15641564                myPoly->type);
    15651565    }
    1566     return(0.0);
     1566    return(NAN);
    15671567}
    15681568
     
    16031603                myPoly->type);
    16041604    }
    1605     return(0.0);
     1605    return(NAN);
    16061606}
    16071607
     
    16571657                myPoly->type);
    16581658    }
    1659     return(0.0);
     1659    return(NAN);
    16601660}
    16611661
     
    17211721                myPoly->type);
    17221722    }
    1723     return(0.0);
     1723    return(NAN);
    17241724}
    17251725
  • trunk/psLib/src/math/psStats.c

    r2342 r2343  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-11-12 19:36:07 $
     11 *  @version $Revision: 1.94 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-11-12 19:50:34 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    992992                       float getThisValue)
    993993{
     994    PS_POLY_CHECK_NULL(myPoly, NAN);
    994995    PS_FLOAT_COMPARE(rangeLow, rangeHigh, NAN);
     996    // We ensure that the requested f(y) value, which is getThisValue, is
     997    // falls within the range of y-values of the polynomial "myPoly" in the
     998    // specified x-range (rangeLow:rangeHigh).
     999    float fLo = psPolynomial1DEval(rangeLow, myPoly);
     1000    float fHi = psPolynomial1DEval(rangeHigh, myPoly);
     1001    if (!((fLo <= getThisValue) && (fHi >= getThisValue))) {
     1002        psError(PS_ERR_UNKNOWN,
     1003                true,
     1004                psStats_STATS_POLY_MEDIAN_OUT_OF_RANGE);
     1005        return(NAN);
     1006    }
     1007
    9951008    psS32 numIterations = 0;
    9961009    float midpoint = 0.0;
     
    10731086        // Determine the coefficients of the polynomial.
    10741087        myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
     1088        if (myPoly == NULL) {
     1089            psError(PS_ERR_UNEXPECTED_NULL,
     1090                    false,
     1091                    psStats_STATS_FIT_QUADRATIC_POLYNOMIAL_1D_FIT);
     1092            return(NAN);
     1093        }
    10751094        // Call p_ps1DPolyMedian(), which does a binary search on the
    10761095        // polynomial, looking for the value x such that f(x) = yVal
Note: See TracChangeset for help on using the changeset viewer.