IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1861


Ignore:
Timestamp:
Sep 22, 2004, 8:12:22 PM (22 years ago)
Author:
gusciora
Message:

removed the old 1d Spline Gen function.

Location:
trunk/psLib
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psFunctions.c

    r1859 r1861  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-23 04:56:40 $
     9 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-23 06:12:22 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    16611661
    16621662/*****************************************************************************
    1663 XXX: Ensure that domain[i+1] != domain[i]
    16641663 *****************************************************************************/
    16651664psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
     
    16811680
    16821681    tmp->domains = (float *) psAlloc((bounds->n) * sizeof(float));
     1682
    16831683    for (i=0;i<bounds->n;i++) {
    16841684        (tmp->domains)[i] = bounds->data.F32[i];
     1685        if (i<(bounds->n-1)) {
     1686            if (FLT_EPSILON < fabs(bounds->data.F32[i+1]-bounds->data.F32[i])) {
     1687                // XXX: psErrorMsg(data points must be distinct)
     1688            }
     1689        }
    16851690    }
    16861691
     
    16971702 
    16981703XXX: Macro this for a few different types.
     1704 
     1705XXX: name since we don't take psVectors as input.
    16991706 *****************************************************************************/
    17001707int p_psVectorBinDisectF32(float *bins,
     
    18671874
    18681875
    1869 // This is a
     1876/*****************************************************************************
     1877p_ps1DInterpolateF32(): this is the base 1-D flat memory routine to perform
     1878LaGrange interpolation.
     1879 *****************************************************************************/
    18701880float p_ps1DInterpolateF32(float *domain,
    18711881                           float *range,
     
    19101920order around the point x.
    19111921 
    1912 XXX: This stuff does not work with a mask.
     1922XXX: This stuff does not currently work with a mask.
     1923 
     1924XXX: nobody asked for us to generate this routine.
    19131925 *****************************************************************************/
    19141926psScalar *p_psVectorInterpolate(psVector *domain,
     
    19481960
    19491961
     1962/*****************************************************************************
     1963psSpline1DEval(): this routine takes an existing spline of arbitrary order
     1964and an independent x value.  Each determines which spline that x corresponds
     1965to by doing a bracket disection on the domains of the spline data structure
     1966(p_psVectorBinDisectF32()).  Then it evaluates the spline at that x location
     1967by a call to the 1D polynomial functions.
     1968 
     1969XXX: SDR is silent about data types.  PS_TYPE_F32 is implemented.
     1970 *****************************************************************************/
    19501971float psSpline1DEval(const psSpline1D *spline,
    19511972                     float x)
     
    19852006    return(tmpVector);
    19862007}
    1987 
    1988 
    1989 
    1990 /*****************************************************************************
    1991 psSpline1DGen(): This routine will take an existing spline data structure,
    1992 along with a set of data values for each of the domains, and fit splines of
    1993 the specified order (currently, linear only), and set the coefficients in the
    1994 appropriate spline polynomials.  This function is not part of the API in the
    1995 latest SDR, but I'm guessing it will be, and I need it to generate test
    1996 cases, so I included it here.
    1997  *****************************************************************************/
    1998 
    1999 psSpline1D *psSpline1DGen(const psSpline1D *spline,
    2000                           psVector *data)
    2001 {
    2002     int i;
    2003     float slope;
    2004 
    2005     psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2006             "---- Calling psSpline1DGen()\n");
    2007 
    2008     if (data->n != (1 + spline->n)) {
    2009         psLogMsg(__func__, PS_LOG_WARN,
    2010                  "data size / spline size mismatch (%d %d)\n",
    2011                  data->n, spline->n);
    2012         return(NULL);
    2013     }
    2014     // XXX: verify your math
    2015     if (2 == (spline->spline[0])->n) {
    2016         for (i=0;i<spline->n;i++) {
    2017             slope = (data->data.F32[i+1] - data->data.F32[i]) /
    2018                     (spline->domains[i+1] - spline->domains[i]);
    2019             (spline->spline[i])->coeff[0] = data->data.F32[i] -
    2020                                             (slope * spline->domains[i]);
    2021             //printf("HMMM (%f, %f, %f)\n", data->data.F32[i], slope, spline->domains[i]);
    2022 
    2023             (spline->spline[i])->coeff[1] = slope;
    2024             psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2025                     "---- spline %d coeffs are (%f, %f)\n", i,
    2026                     (spline->spline[i])->coeff[0],
    2027                     (spline->spline[i])->coeff[1]);
    2028         }
    2029         psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2030                 "---- Exiting psSpline1DGen()\n");
    2031         return((psSpline1D *) spline);
    2032     } else if (4 == (spline->spline[0])->n) {
    2033         psLogMsg(__func__, PS_LOG_WARN,
    2034                  "Cubic splines have not been implemented.");
    2035         return(NULL);
    2036     } else {
    2037         psLogMsg(__func__, PS_LOG_WARN,
    2038                  "Don't know how to generate %d-order splines.",
    2039                  (spline->spline[0])->n-1);
    2040         return(NULL);
    2041     }
    2042 }
  • trunk/psLib/src/dataManip/psFunctions.h

    r1859 r1861  
    1212*  @author George Gusciora, MHPCC
    1313*
    14 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-09-23 04:56:41 $
     14*  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-09-23 06:12:22 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    404404                               const psSpline1D *spline);
    405405
    406 psSpline1D *psSpline1DGen(const psSpline1D *spline,
    407                           psVector *data);
    408 
    409406int p_psVectorBinDisectF32(float *bins,
    410407                           int numBins,
  • trunk/psLib/src/dataManip/psMinimize.c

    r1860 r1861  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-23 05:43:25 $
     11 *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-23 06:12:22 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    345345
    346346            (mySpline->spline[i])->coeff[1] = slope;
    347             psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
     347            psTrace(".psLib.dataManip.psMinimize.psVectorFitSpline1D", 4,
    348348                    "---- mySpline %d coeffs are (%f, %f)\n", i,
    349349                    (mySpline->spline[i])->coeff[0],
    350350                    (mySpline->spline[i])->coeff[1]);
    351351        }
    352         psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    353                 "---- Exiting psSpline1DGen()\n");
     352        psTrace(".psLib.dataManip.psMinimize.psVectorFitSpline1D", 4,
     353                "---- Exiting psVectorFitSpline1D()()\n");
    354354        return((psSpline1D *) mySpline);
    355355    }
  • trunk/psLib/src/math/psMinimize.c

    r1860 r1861  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-23 05:43:25 $
     11 *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-23 06:12:22 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    345345
    346346            (mySpline->spline[i])->coeff[1] = slope;
    347             psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
     347            psTrace(".psLib.dataManip.psMinimize.psVectorFitSpline1D", 4,
    348348                    "---- mySpline %d coeffs are (%f, %f)\n", i,
    349349                    (mySpline->spline[i])->coeff[0],
    350350                    (mySpline->spline[i])->coeff[1]);
    351351        }
    352         psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    353                 "---- Exiting psSpline1DGen()\n");
     352        psTrace(".psLib.dataManip.psMinimize.psVectorFitSpline1D", 4,
     353                "---- Exiting psVectorFitSpline1D()()\n");
    354354        return((psSpline1D *) mySpline);
    355355    }
  • trunk/psLib/src/math/psPolynomial.c

    r1859 r1861  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-23 04:56:40 $
     9 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-23 06:12:22 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    16611661
    16621662/*****************************************************************************
    1663 XXX: Ensure that domain[i+1] != domain[i]
    16641663 *****************************************************************************/
    16651664psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
     
    16811680
    16821681    tmp->domains = (float *) psAlloc((bounds->n) * sizeof(float));
     1682
    16831683    for (i=0;i<bounds->n;i++) {
    16841684        (tmp->domains)[i] = bounds->data.F32[i];
     1685        if (i<(bounds->n-1)) {
     1686            if (FLT_EPSILON < fabs(bounds->data.F32[i+1]-bounds->data.F32[i])) {
     1687                // XXX: psErrorMsg(data points must be distinct)
     1688            }
     1689        }
    16851690    }
    16861691
     
    16971702 
    16981703XXX: Macro this for a few different types.
     1704 
     1705XXX: name since we don't take psVectors as input.
    16991706 *****************************************************************************/
    17001707int p_psVectorBinDisectF32(float *bins,
     
    18671874
    18681875
    1869 // This is a
     1876/*****************************************************************************
     1877p_ps1DInterpolateF32(): this is the base 1-D flat memory routine to perform
     1878LaGrange interpolation.
     1879 *****************************************************************************/
    18701880float p_ps1DInterpolateF32(float *domain,
    18711881                           float *range,
     
    19101920order around the point x.
    19111921 
    1912 XXX: This stuff does not work with a mask.
     1922XXX: This stuff does not currently work with a mask.
     1923 
     1924XXX: nobody asked for us to generate this routine.
    19131925 *****************************************************************************/
    19141926psScalar *p_psVectorInterpolate(psVector *domain,
     
    19481960
    19491961
     1962/*****************************************************************************
     1963psSpline1DEval(): this routine takes an existing spline of arbitrary order
     1964and an independent x value.  Each determines which spline that x corresponds
     1965to by doing a bracket disection on the domains of the spline data structure
     1966(p_psVectorBinDisectF32()).  Then it evaluates the spline at that x location
     1967by a call to the 1D polynomial functions.
     1968 
     1969XXX: SDR is silent about data types.  PS_TYPE_F32 is implemented.
     1970 *****************************************************************************/
    19501971float psSpline1DEval(const psSpline1D *spline,
    19511972                     float x)
     
    19852006    return(tmpVector);
    19862007}
    1987 
    1988 
    1989 
    1990 /*****************************************************************************
    1991 psSpline1DGen(): This routine will take an existing spline data structure,
    1992 along with a set of data values for each of the domains, and fit splines of
    1993 the specified order (currently, linear only), and set the coefficients in the
    1994 appropriate spline polynomials.  This function is not part of the API in the
    1995 latest SDR, but I'm guessing it will be, and I need it to generate test
    1996 cases, so I included it here.
    1997  *****************************************************************************/
    1998 
    1999 psSpline1D *psSpline1DGen(const psSpline1D *spline,
    2000                           psVector *data)
    2001 {
    2002     int i;
    2003     float slope;
    2004 
    2005     psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2006             "---- Calling psSpline1DGen()\n");
    2007 
    2008     if (data->n != (1 + spline->n)) {
    2009         psLogMsg(__func__, PS_LOG_WARN,
    2010                  "data size / spline size mismatch (%d %d)\n",
    2011                  data->n, spline->n);
    2012         return(NULL);
    2013     }
    2014     // XXX: verify your math
    2015     if (2 == (spline->spline[0])->n) {
    2016         for (i=0;i<spline->n;i++) {
    2017             slope = (data->data.F32[i+1] - data->data.F32[i]) /
    2018                     (spline->domains[i+1] - spline->domains[i]);
    2019             (spline->spline[i])->coeff[0] = data->data.F32[i] -
    2020                                             (slope * spline->domains[i]);
    2021             //printf("HMMM (%f, %f, %f)\n", data->data.F32[i], slope, spline->domains[i]);
    2022 
    2023             (spline->spline[i])->coeff[1] = slope;
    2024             psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2025                     "---- spline %d coeffs are (%f, %f)\n", i,
    2026                     (spline->spline[i])->coeff[0],
    2027                     (spline->spline[i])->coeff[1]);
    2028         }
    2029         psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2030                 "---- Exiting psSpline1DGen()\n");
    2031         return((psSpline1D *) spline);
    2032     } else if (4 == (spline->spline[0])->n) {
    2033         psLogMsg(__func__, PS_LOG_WARN,
    2034                  "Cubic splines have not been implemented.");
    2035         return(NULL);
    2036     } else {
    2037         psLogMsg(__func__, PS_LOG_WARN,
    2038                  "Don't know how to generate %d-order splines.",
    2039                  (spline->spline[0])->n-1);
    2040         return(NULL);
    2041     }
    2042 }
  • trunk/psLib/src/math/psPolynomial.h

    r1859 r1861  
    1212*  @author George Gusciora, MHPCC
    1313*
    14 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-09-23 04:56:41 $
     14*  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-09-23 06:12:22 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    404404                               const psSpline1D *spline);
    405405
    406 psSpline1D *psSpline1DGen(const psSpline1D *spline,
    407                           psVector *data);
    408 
    409406int p_psVectorBinDisectF32(float *bins,
    410407                           int numBins,
  • trunk/psLib/src/math/psSpline.c

    r1859 r1861  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-23 04:56:40 $
     9 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-23 06:12:22 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    16611661
    16621662/*****************************************************************************
    1663 XXX: Ensure that domain[i+1] != domain[i]
    16641663 *****************************************************************************/
    16651664psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
     
    16811680
    16821681    tmp->domains = (float *) psAlloc((bounds->n) * sizeof(float));
     1682
    16831683    for (i=0;i<bounds->n;i++) {
    16841684        (tmp->domains)[i] = bounds->data.F32[i];
     1685        if (i<(bounds->n-1)) {
     1686            if (FLT_EPSILON < fabs(bounds->data.F32[i+1]-bounds->data.F32[i])) {
     1687                // XXX: psErrorMsg(data points must be distinct)
     1688            }
     1689        }
    16851690    }
    16861691
     
    16971702 
    16981703XXX: Macro this for a few different types.
     1704 
     1705XXX: name since we don't take psVectors as input.
    16991706 *****************************************************************************/
    17001707int p_psVectorBinDisectF32(float *bins,
     
    18671874
    18681875
    1869 // This is a
     1876/*****************************************************************************
     1877p_ps1DInterpolateF32(): this is the base 1-D flat memory routine to perform
     1878LaGrange interpolation.
     1879 *****************************************************************************/
    18701880float p_ps1DInterpolateF32(float *domain,
    18711881                           float *range,
     
    19101920order around the point x.
    19111921 
    1912 XXX: This stuff does not work with a mask.
     1922XXX: This stuff does not currently work with a mask.
     1923 
     1924XXX: nobody asked for us to generate this routine.
    19131925 *****************************************************************************/
    19141926psScalar *p_psVectorInterpolate(psVector *domain,
     
    19481960
    19491961
     1962/*****************************************************************************
     1963psSpline1DEval(): this routine takes an existing spline of arbitrary order
     1964and an independent x value.  Each determines which spline that x corresponds
     1965to by doing a bracket disection on the domains of the spline data structure
     1966(p_psVectorBinDisectF32()).  Then it evaluates the spline at that x location
     1967by a call to the 1D polynomial functions.
     1968 
     1969XXX: SDR is silent about data types.  PS_TYPE_F32 is implemented.
     1970 *****************************************************************************/
    19501971float psSpline1DEval(const psSpline1D *spline,
    19511972                     float x)
     
    19852006    return(tmpVector);
    19862007}
    1987 
    1988 
    1989 
    1990 /*****************************************************************************
    1991 psSpline1DGen(): This routine will take an existing spline data structure,
    1992 along with a set of data values for each of the domains, and fit splines of
    1993 the specified order (currently, linear only), and set the coefficients in the
    1994 appropriate spline polynomials.  This function is not part of the API in the
    1995 latest SDR, but I'm guessing it will be, and I need it to generate test
    1996 cases, so I included it here.
    1997  *****************************************************************************/
    1998 
    1999 psSpline1D *psSpline1DGen(const psSpline1D *spline,
    2000                           psVector *data)
    2001 {
    2002     int i;
    2003     float slope;
    2004 
    2005     psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2006             "---- Calling psSpline1DGen()\n");
    2007 
    2008     if (data->n != (1 + spline->n)) {
    2009         psLogMsg(__func__, PS_LOG_WARN,
    2010                  "data size / spline size mismatch (%d %d)\n",
    2011                  data->n, spline->n);
    2012         return(NULL);
    2013     }
    2014     // XXX: verify your math
    2015     if (2 == (spline->spline[0])->n) {
    2016         for (i=0;i<spline->n;i++) {
    2017             slope = (data->data.F32[i+1] - data->data.F32[i]) /
    2018                     (spline->domains[i+1] - spline->domains[i]);
    2019             (spline->spline[i])->coeff[0] = data->data.F32[i] -
    2020                                             (slope * spline->domains[i]);
    2021             //printf("HMMM (%f, %f, %f)\n", data->data.F32[i], slope, spline->domains[i]);
    2022 
    2023             (spline->spline[i])->coeff[1] = slope;
    2024             psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2025                     "---- spline %d coeffs are (%f, %f)\n", i,
    2026                     (spline->spline[i])->coeff[0],
    2027                     (spline->spline[i])->coeff[1]);
    2028         }
    2029         psTrace(".psLib.dataManip.psFunctions.psSpline1DGen", 4,
    2030                 "---- Exiting psSpline1DGen()\n");
    2031         return((psSpline1D *) spline);
    2032     } else if (4 == (spline->spline[0])->n) {
    2033         psLogMsg(__func__, PS_LOG_WARN,
    2034                  "Cubic splines have not been implemented.");
    2035         return(NULL);
    2036     } else {
    2037         psLogMsg(__func__, PS_LOG_WARN,
    2038                  "Don't know how to generate %d-order splines.",
    2039                  (spline->spline[0])->n-1);
    2040         return(NULL);
    2041     }
    2042 }
  • trunk/psLib/src/math/psSpline.h

    r1859 r1861  
    1212*  @author George Gusciora, MHPCC
    1313*
    14 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-09-23 04:56:41 $
     14*  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-09-23 06:12:22 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    404404                               const psSpline1D *spline);
    405405
    406 psSpline1D *psSpline1DGen(const psSpline1D *spline,
    407                           psVector *data);
    408 
    409406int p_psVectorBinDisectF32(float *bins,
    410407                           int numBins,
  • trunk/psLib/test/dataManip/tst_psFunc04.c

    r1811 r1861  
    22    This routine must ensure that the psSpline1DEval() function works
    33    properly.  It creates a spline with psSpline1DAlloc(), creates a set of
    4     data values, sets the spline polynomials with psSpline1DGen(), then
     4    data values, sets the spline polynomials with psVectorFitSpline1D(), then
    55    calls psSpline1DEval() on new data values and ensures that the results
    66    are correct.
     
    4141        data->data.F32[i] = tmpSpline->domains[i];
    4242    }
     43    psVectorFitSpline1D(tmpSpline, data, data, NULL);
    4344
    44     psSpline1DGen(tmpSpline, data);
    4545    for (i=0;i<N+1;i++) {
    4646        x = 0.5 + (float) i+1;
  • trunk/psLib/test/dataManip/tst_psFunc05.c

    r1811 r1861  
    22    This routine must ensure that the psSpline1DEval() function works
    33    properly.  It creates a spline with psSpline1DAlloc(), creates a set of
    4     data values, sets the spline polynomials with psSpline1DGen(), then
     4    data values, sets the spline polynomials with psVectorFitSpline1D(), then
    55    calls psSpline1DEval() on new data values and ensures that the results
    66    are correct.
     
    4444    }
    4545
    46     psSpline1DGen(tmpSpline, data);
     46    psVectorFitSpline1D(tmpSpline, data, data, NULL);
    4747
    4848    for (i=0;i<N+1;i++) {
  • trunk/psLib/test/dataManip/tst_psFunc07.c

    r1858 r1861  
    11/*****************************************************************************
    2     This routine must ensure that the psSpline1DEval() function works
    3     properly.  It creates a spline with psSpline1DAlloc(), creates a set of
    4     data values, sets the spline polynomials with psSpline1DGen(), then
    5     calls psSpline1DEval() on new data values and ensures that the results
    6     are correct.
     2This routine must ensure that the psVectorFitSpline1D() function works
     3properly.  It creates a spline with psSpline1DAlloc(), creates a set of data
     4values, sets the spline polynomials with psVectorFitSpline1D(), then calls
     5psSpline1DEval() on new data values and ensures that the results are correct.
    76 
    8     XXX: figure out the memory deallocator
     7XXX: figure out the memory deallocator
     8 
     9XXX: The interpolated values are not all that good.  However, they do agree
     10with the NR version of the code.
    911 *****************************************************************************/
    1012#include <stdio.h>
Note: See TracChangeset for help on using the changeset viewer.