Changeset 1281 for trunk/psLib/src/math/psSpline.c
- Timestamp:
- Jul 22, 2004, 1:47:23 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psSpline.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psSpline.c
r1233 r1281 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.1 5$ $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 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 #include "psFunctions.h" 30 30 31 #include "float.h"32 #include <math.h>33 31 #include <gsl/gsl_rng.h> 34 32 #include <gsl/gsl_randist.h> 35 33 /*****************************************************************************/ 34 /* DEFINE STATEMENTS */ 35 /*****************************************************************************/ 36 37 // None 38 39 /*****************************************************************************/ 40 /* TYPE DEFINITIONS */ 41 /*****************************************************************************/ 36 42 static void polynomial1DFree(psPolynomial1D *myPoly); 37 43 static void polynomial2DFree(psPolynomial2D *myPoly); … … 44 50 45 51 /*****************************************************************************/ 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 /*****************************************************************************/ 46 70 /* FUNCTION IMPLEMENTATION - PUBLIC */ 47 71 /*****************************************************************************/ … … 55 79 psGaussian(float x, 56 80 float mean, 57 float s tddev,81 float sigma, 58 82 int normal) 59 83 { 60 float tmp = 0.0;84 float tmp = 1.0; 61 85 62 86 if (normal == 1) { 63 87 #ifdef DARWIN 64 tmp = 1.0 / (float)sqrt(2.0 * M_PI * (s tddev * stddev));88 tmp = 1.0 / (float)sqrt(2.0 * M_PI * (sigma * sigma)); 65 89 #else 66 90 67 tmp = 1.0 / sqrtf(2.0 * M_PI * (s tddev * stddev));91 tmp = 1.0 / sqrtf(2.0 * M_PI * (sigma * sigma)); 68 92 #endif 69 93 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))); 74 97 } 75 98 … … 328 351 float xSum = 1.0; 329 352 353 if (NULL == myPoly) { 354 psAbort(__func__, "psEvalPolynomial1D(): myPoly is NULL\n"); 355 } 356 357 330 358 // NOTE: Do we want to flag this case? 331 359 if (myPoly->n == 0) { 332 360 return(1.0); 361 } 362 363 if (NULL == myPoly->coeff) { 364 psAbort(__func__, "psEvalPolynomial1D(): myPoly->coeff is NULL\n"); 333 365 } 334 366
Note:
See TracChangeset
for help on using the changeset viewer.
