IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 22, 2004, 1:47:23 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psSpline.c

    r1233 r1281  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-07-15 23:52:34 $
     9 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-07-22 23:45:16 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929#include "psFunctions.h"
    3030
    31 #include "float.h"
    32 #include <math.h>
    3331#include <gsl/gsl_rng.h>
    3432#include <gsl/gsl_randist.h>
    35 
     33/*****************************************************************************/
     34/* DEFINE STATEMENTS                                                         */
     35/*****************************************************************************/
     36
     37// None
     38
     39/*****************************************************************************/
     40/* TYPE DEFINITIONS                                                          */
     41/*****************************************************************************/
    3642static void polynomial1DFree(psPolynomial1D *myPoly);
    3743static void polynomial2DFree(psPolynomial2D *myPoly);
     
    4450
    4551/*****************************************************************************/
     52/* GLOBAL VARIABLES                                                          */
     53/*****************************************************************************/
     54
     55// None
     56
     57/*****************************************************************************/
     58/* FILE STATIC VARIABLES                                                     */
     59/*****************************************************************************/
     60
     61// None
     62
     63/*****************************************************************************/
     64/* FUNCTION IMPLEMENTATION - LOCAL                                           */
     65/*****************************************************************************/
     66
     67// None
     68
     69/*****************************************************************************/
    4670/*  FUNCTION IMPLEMENTATION - PUBLIC                                         */
    4771/*****************************************************************************/
     
    5579psGaussian(float x,
    5680           float mean,
    57            float stddev,
     81           float sigma,
    5882           int normal)
    5983{
    60     float tmp = 0.0;
     84    float tmp = 1.0;
    6185
    6286    if (normal == 1) {
    6387        #ifdef DARWIN
    64         tmp = 1.0 / (float)sqrt(2.0 * M_PI * (stddev * stddev));
     88        tmp = 1.0 / (float)sqrt(2.0 * M_PI * (sigma * sigma));
    6589        #else
    6690
    67         tmp = 1.0 / sqrtf(2.0 * M_PI * (stddev * stddev));
     91        tmp = 1.0 / sqrtf(2.0 * M_PI * (sigma * sigma));
    6892        #endif
    6993
    70         return(tmp * exp(-((x-mean) * (x-mean)) / (2.0 * stddev * stddev)));
    71     } else {
    72         return(exp(-((x-mean) * (x-mean)) / (2.0 * stddev * stddev)));
    73     }
     94    }
     95
     96    return(tmp * exp(-((x-mean) * (x-mean)) / (2.0 * sigma * sigma)));
    7497}
    7598
     
    328351    float xSum = 1.0;
    329352
     353    if (NULL == myPoly) {
     354        psAbort(__func__, "psEvalPolynomial1D(): myPoly is NULL\n");
     355    }
     356
     357
    330358    // NOTE: Do we want to flag this case?
    331359    if (myPoly->n == 0) {
    332360        return(1.0);
     361    }
     362
     363    if (NULL == myPoly->coeff) {
     364        psAbort(__func__, "psEvalPolynomial1D(): myPoly->coeff is NULL\n");
    333365    }
    334366
Note: See TracChangeset for help on using the changeset viewer.