Changeset 1407 for trunk/psLib/src/dataManip/psFunctions.h
- Timestamp:
- Aug 6, 2004, 2:06:06 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/dataManip/psFunctions.h (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psFunctions.h
r1406 r1407 1 1 2 /** @file psFunctions.h 2 3 * \brief Standard Mathematical Functions. … … 12 13 * @author George Gusciora, MHPCC 13 14 * 14 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-0 6 22:34:05$15 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-07 00:06:06 $ 16 17 * 17 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 20 20 21 #if !defined(PS_FUNCTIONS_H) 21 # define PS_FUNCTIONS_H22 23 # include <stdbool.h>24 25 # include "psVector.h"22 # define PS_FUNCTIONS_H 23 24 # include <stdbool.h> 25 26 # include "psVector.h" 26 27 27 28 /** \addtogroup Stats … … 33 34 evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] */ 34 35 35 float 36 psGaussian( float x, ///< Value at which to evaluate 37 float mean, ///< Mean for the Gaussian 38 float stddev, ///< Standard deviation for the Gaussian 39 bool normal ///< Indicates whether result should be normalized 40 ); 41 36 float psGaussian(float x, // /< Value at which to evaluate 37 float mean, // /< Mean for the Gaussian 38 float stddev, // /< Standard deviation for the Gaussian 39 bool normal // /< Indicates whether result should be normalized 40 ); 42 41 43 42 /** Produce a vector of random numbers from a Gaussian distribution with 44 43 the specified mean and sigma */ 45 psVector *psGaussianDev( float mean, ///< The mean of the Gaussian 46 float sigma, ///< The sigma of the Gaussian 47 int Npts ); ///< The size of the vector 48 49 50 51 44 psVector *psGaussianDev(float mean, // /< The mean of the Gaussian 45 float sigma, // /< The sigma of the Gaussian 46 int Npts); // /< The size of the vector 52 47 53 48 /** One-dimensional polynomial */ 54 49 typedef struct 55 50 { 56 int n; ///< Number of terms57 float *coeff; ///< Coefficients58 float *coeffErr; ///< Error in coefficients59 char *mask; ///< Coefficient mask51 int n; // /< Number of terms 52 float *coeff; // /< Coefficients 53 float *coeffErr; // /< Error in coefficients 54 char *mask; // /< Coefficient mask 60 55 } 61 56 psPolynomial1D; … … 64 59 typedef struct 65 60 { 66 int nX, nY; ///< Number of terms in x and y 67 float **coeff; ///< Coefficients 68 float **coeffErr; ///< Error in coefficients 69 char **mask; ///< Coefficients mask 61 int nX, 62 nY; // /< Number of terms in x and y 63 float **coeff; // /< Coefficients 64 float **coeffErr; // /< Error in coefficients 65 char **mask; // /< Coefficients mask 70 66 } 71 67 psPolynomial2D; … … 74 70 typedef struct 75 71 { 76 int nX, nY, nZ; ///< Number of terms in x, y and z 77 float ***coeff; ///< Coefficients 78 float ***coeffErr; ///< Error in coefficients 79 char ***mask; ///< Coefficients mask 72 int nX, 73 nY, 74 nZ; // /< Number of terms in x, y and z 75 float ***coeff; // /< Coefficients 76 float ***coeffErr; // /< Error in coefficients 77 char ***mask; // /< Coefficients mask 80 78 } 81 79 psPolynomial3D; … … 84 82 typedef struct 85 83 { 86 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 87 float ****coeff; ///< Coefficients 88 float ****coeffErr; ///< Error in coefficients 89 char ****mask; ///< Coefficients mask 84 int nW, 85 nX, 86 nY, 87 nZ; // /< Number of terms in w, x, y and z 88 float ****coeff; // /< Coefficients 89 float ****coeffErr; // /< Error in coefficients 90 char ****mask; // /< Coefficients mask 90 91 } 91 92 psPolynomial4D; 92 93 93 94 94 /** Functions **************************************************************/ 95 95 96 96 /** Constructor */ 97 psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms 98 ); 99 /** Constructor */ 100 psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y 101 ); 102 /** Constructor */ 103 psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z 104 ); 105 /** Constructor */ 106 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 97 psPolynomial1D *psPolynomial1DAlloc(int n // /< Number of terms 98 ); 99 100 /** Constructor */ 101 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY // /< Number of terms in x and y 102 ); 103 104 /** Constructor */ 105 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ // /< Number of terms in x, y and z 106 ); 107 108 /** Constructor */ 109 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ // /< Number of terms in w, x, y and 110 // z 107 111 ); 108 112 109 113 /** Evaluate 1D polynomial */ 110 float 111 psPolynomial1DEval( float x, ///< Value at which to evaluate 112 const psPolynomial1D *myPoly ///< Coefficients for the polynomial 113 ); 114 float psPolynomial1DEval(float x, // /< Value at which to evaluate 115 const psPolynomial1D * myPoly // /< Coefficients for the polynomial 116 ); 114 117 115 118 /** Evaluate 2D polynomial */ 116 float 117 psPolynomial2DEval( float x, ///< Value x at which to evaluate 118 float y, ///< Value y at which to evaluate 119 const psPolynomial2D *myPoly ///< Coefficients for the polynomial 120 ); 119 float psPolynomial2DEval(float x, // /< Value x at which to evaluate 120 float y, // /< Value y at which to evaluate 121 const psPolynomial2D * myPoly // /< Coefficients for the polynomial 122 ); 121 123 122 124 /** Evaluate 3D polynomial */ 123 float 124 psPolynomial3DEval( float x, ///< Value x at which to evaluate 125 float y, ///< Value y at which to evaluate 126 float z, ///< Value z at which to evaluate 127 const psPolynomial3D *myPoly ///< Coefficients for the polynomial 128 ); 125 float psPolynomial3DEval(float x, // /< Value x at which to evaluate 126 float y, // /< Value y at which to evaluate 127 float z, // /< Value z at which to evaluate 128 const psPolynomial3D * myPoly // /< Coefficients for the polynomial 129 ); 129 130 130 131 /** Evaluate 4D polynomial */ 131 float 132 psPolynomial4DEval( float w, ///< Value w at which to evaluate 133 float x, ///< Value x at which to evaluate 134 float y, ///< Value y at which to evaluate 135 float z, ///< Value z at which to evaluate 136 const psPolynomial4D *myPoly ///< Coefficients for the polynomial 137 ); 132 float psPolynomial4DEval(float w, // /< Value w at which to evaluate 133 float x, // /< Value x at which to evaluate 134 float y, // /< Value y at which to evaluate 135 float z, // /< Value z at which to evaluate 136 const psPolynomial4D * myPoly // /< Coefficients for the polynomial 137 ); 138 138 139 139 /*****************************************************************************/ … … 144 144 typedef struct 145 145 { 146 int n; ///< Number of terms147 double *coeff; ///< Coefficients148 double *coeffErr; ///< Error in coefficients149 char *mask; ///< Coefficient mask146 int n; // /< Number of terms 147 double *coeff; // /< Coefficients 148 double *coeffErr; // /< Error in coefficients 149 char *mask; // /< Coefficient mask 150 150 } 151 151 psDPolynomial1D; … … 154 154 typedef struct 155 155 { 156 int nX, nY; ///< Number of terms in x and y 157 double **coeff; ///< Coefficients 158 double **coeffErr; ///< Error in coefficients 159 char **mask; ///< Coefficients mask 156 int nX, 157 nY; // /< Number of terms in x and y 158 double **coeff; // /< Coefficients 159 double **coeffErr; // /< Error in coefficients 160 char **mask; // /< Coefficients mask 160 161 } 161 162 psDPolynomial2D; … … 164 165 typedef struct 165 166 { 166 int nX, nY, nZ; ///< Number of terms in x, y and z 167 double ***coeff; ///< Coefficients 168 double ***coeffErr; ///< Error in coefficients 169 char ***mask; ///< Coefficient mask 167 int nX, 168 nY, 169 nZ; // /< Number of terms in x, y and z 170 double ***coeff; // /< Coefficients 171 double ***coeffErr; // /< Error in coefficients 172 char ***mask; // /< Coefficient mask 170 173 } 171 174 psDPolynomial3D; … … 174 177 typedef struct 175 178 { 176 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 177 double ****coeff; ///< Coefficients 178 double ****coeffErr; ///< Error in coefficients 179 char ****mask; ///< Coefficients mask 179 int nW, 180 nX, 181 nY, 182 nZ; // /< Number of terms in w, x, y and z 183 double ****coeff; // /< Coefficients 184 double ****coeffErr; // /< Error in coefficients 185 char ****mask; // /< Coefficients mask 180 186 } 181 187 psDPolynomial4D; 182 188 183 189 /** Constructor */ 184 psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms 185 ); 186 /** Constructor */ 187 psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y 188 ); 189 /** Constructor */ 190 psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z 191 ); 192 /** Constructor */ 193 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 190 psDPolynomial1D *psDPolynomial1DAlloc(int n // /< Number of terms 191 ); 192 193 /** Constructor */ 194 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY // /< Number of terms in x and y 195 ); 196 197 /** Constructor */ 198 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ // /< Number of terms in x, y and z 199 ); 200 201 /** Constructor */ 202 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ // /< Number of terms in w, x, y and 203 // z 194 204 ); 195 205 196 206 /** Evaluate 1D polynomial (double precision) */ 197 double 198 psDPolynomial1DEval( double x, ///< Value at which to evaluate 199 const psDPolynomial1D *myPoly ///< Coefficients for the polynomial 200 ); 207 double psDPolynomial1DEval(double x, // /< Value at which to evaluate 208 const psDPolynomial1D * myPoly // /< Coefficients for the polynomial 209 ); 201 210 202 211 /** Evaluate 2D polynomial (double precision) */ 203 double 204 psDPolynomial2DEval( double x, ///< Value x at which to evaluate 205 double y, ///< Value y at which to evaluate 206 const psDPolynomial2D *myPoly ///< Coefficients for the polynomial 207 ); 212 double psDPolynomial2DEval(double x, // /< Value x at which to evaluate 213 double y, // /< Value y at which to evaluate 214 const psDPolynomial2D * myPoly // /< Coefficients for the polynomial 215 ); 208 216 209 217 /** Evaluate 3D polynomial (double precision) */ 210 double 211 psDPolynomial3DEval( double x, ///< Value x at which to evaluate 212 double y, ///< Value y at which to evaluate 213 double z, ///< Value z at which to evaluate 214 const psDPolynomial3D *myPoly ///< Coefficients for the polynomial 215 ); 218 double psDPolynomial3DEval(double x, // /< Value x at which to evaluate 219 double y, // /< Value y at which to evaluate 220 double z, // /< Value z at which to evaluate 221 const psDPolynomial3D * myPoly // /< Coefficients for the polynomial 222 ); 216 223 217 224 /** Evaluate 4D polynomial (double precision) */ 218 double 219 psDPolynomial4DEval( double w, ///< Value w at which to evaluate 220 double x, ///< Value x at which to evaluate 221 double y, ///< Value y at which to evaluate 222 double z, ///< Value z at which to evaluate 223 const psDPolynomial4D *myPoly ///< Coefficients for the polynomial 224 ); 225 226 /* \} */ // End of MathGroup Functions 225 double psDPolynomial4DEval(double w, // /< Value w at which to evaluate 226 double x, // /< Value x at which to evaluate 227 double y, // /< Value y at which to evaluate 228 double z, // /< Value z at which to evaluate 229 const psDPolynomial4D * myPoly // /< Coefficients for the polynomial 230 ); 231 232 /* \} */// End of MathGroup Functions 227 233 228 234 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
