Changeset 344 for trunk/archive/pslib/include/psFunctions.h
- Timestamp:
- Mar 31, 2004, 5:01:04 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psFunctions.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psFunctions.h
r298 r344 10 10 is not a Gaussian deviate. The evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] */ 11 11 float 12 psGaussian(float x, // !< Value at which to evaluate13 float mean, // !< Mean for the Gaussian14 float stddev // !< Standard deviation for the Gaussian12 psGaussian(float x, ///< Value at which to evaluate 13 float mean, ///< Mean for the Gaussian 14 float stddev ///< Standard deviation for the Gaussian 15 15 ); 16 16 … … 19 19 /** One-dimensional polynomial */ 20 20 typedef struct { 21 int n; // !< Number of terms22 float *restrict coeff; // !< Coefficients23 float *restrict coeffErr; // !< Error in coefficients24 char *restrict mask; // !< Coefficient mask21 int n; ///< Number of terms 22 float *restrict coeff; ///< Coefficients 23 float *restrict coeffErr; ///< Error in coefficients 24 char *restrict mask; ///< Coefficient mask 25 25 } psPolynomial1D; 26 26 27 27 /** Two-dimensional polynomial */ 28 28 typedef struct { 29 int nX, nY; // !< Number of terms in x and y30 float *restrict *restrict coeff; // !< Coefficients31 float *restrict *restrict coeffErr; // !< Error in coefficients32 char *restrict *restrict mask; // !< Coefficients mask29 int nX, nY; ///< Number of terms in x and y 30 float *restrict *restrict coeff; ///< Coefficients 31 float *restrict *restrict coeffErr; ///< Error in coefficients 32 char *restrict *restrict mask; ///< Coefficients mask 33 33 } psPolynomial2D; 34 34 35 35 /** Three-dimensional polynomial */ 36 36 typedef struct { 37 int nX, nY, nZ; // !< Number of terms in x, y and z38 float *restrict *restrict *restrict coeff; // !< Coefficients39 float *restrict *restrict *restrict coeffErr; // !< Error in coefficients40 char *restrict *restrict *restrict mask; // !< Coefficients mask37 int nX, nY, nZ; ///< Number of terms in x, y and z 38 float *restrict *restrict *restrict coeff; ///< Coefficients 39 float *restrict *restrict *restrict coeffErr; ///< Error in coefficients 40 char *restrict *restrict *restrict mask; ///< Coefficients mask 41 41 } psPolynomial3D; 42 42 43 43 /** Four-dimensional polynomial */ 44 44 typedef struct { 45 int nW, nX, nY, nZ; // !< Number of terms in w, x, y and z46 float *restrict *restrict *restrict *restrict coeff; // !< Coefficients47 float *restrict *restrict *restrict *restrict coeffErr; // !< Error in coefficients48 char *restrict *restrict *restrict *restrict mask; // !< Coefficients mask45 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 46 float *restrict *restrict *restrict *restrict coeff; ///< Coefficients 47 float *restrict *restrict *restrict *restrict coeffErr; ///< Error in coefficients 48 char *restrict *restrict *restrict *restrict mask; ///< Coefficients mask 49 49 } psPolynomial4D; 50 50 … … 56 56 57 57 /** Constructor */ 58 psPolynomial1D *psPolynomial1DAlloc(int n // !< Number of terms59 ); 60 /** Constructor */ 61 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY // !< Number of terms in x and y62 ); 63 /** Constructor */ 64 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ // !< Number of terms in x, y and z65 ); 66 /** Constructor */ 67 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ // !< Number of terms in w, x, y and z68 ); 69 70 /** Destructor */ 71 void psPolynomial1DFree(psPolynomial1D *restrict myPoly // !< Polynomial to destroy58 psPolynomial1D *psPolynomial1DAlloc(int n ///< Number of terms 59 ); 60 /** Constructor */ 61 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y 62 ); 63 /** Constructor */ 64 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z 65 ); 66 /** Constructor */ 67 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 68 ); 69 70 /** Destructor */ 71 void psPolynomial1DFree(psPolynomial1D *restrict myPoly ///< Polynomial to destroy 72 72 ); 73 73 74 74 /** Destructor */ 75 void psPolynomial2DFree(psPolynomial2D *restrict myPoly // !< Polynomial to destroy76 ); 77 /** Destructor */ 78 void psPolynomial3DFree(psPolynomial3D *restrict myPoly // !< Polynomial to destroy79 ); 80 /** Destructor */ 81 void psPolynomial4DFree(psPolynomial4D *restrict myPoly // !< Polynomial to destroy75 void psPolynomial2DFree(psPolynomial2D *restrict myPoly ///< Polynomial to destroy 76 ); 77 /** Destructor */ 78 void psPolynomial3DFree(psPolynomial3D *restrict myPoly ///< Polynomial to destroy 79 ); 80 /** Destructor */ 81 void psPolynomial4DFree(psPolynomial4D *restrict myPoly ///< Polynomial to destroy 82 82 ); 83 83 84 84 /** Evaluate 1D polynomial */ 85 85 float 86 psEvalPolynomial1D(float x, // !< Value at which to evaluate87 const psPolynomial1D *restrict myPoly // !< Coefficients for the polynomial86 psEvalPolynomial1D(float x, ///< Value at which to evaluate 87 const psPolynomial1D *restrict myPoly ///< Coefficients for the polynomial 88 88 ); 89 89 90 90 /** Evaluate 2D polynomial */ 91 91 float 92 psEvalPolynomial2D(float x, // !< Value x at which to evaluate93 float y, // !< Value y at which to evaluate94 const psPolynomial2D *restrict myPoly // !< Coefficients for the polynomial92 psEvalPolynomial2D(float x, ///< Value x at which to evaluate 93 float y, ///< Value y at which to evaluate 94 const psPolynomial2D *restrict myPoly ///< Coefficients for the polynomial 95 95 ); 96 96 97 97 /** Evaluate 3D polynomial */ 98 98 float 99 psEvalPolynomial3D(float x, // !< Value x at which to evaluate100 float y, // !< Value y at which to evaluate101 float z, // !< Value z at which to evaluate102 const psPolynomial3D *restrict myPoly // !< Coefficients for the polynomial99 psEvalPolynomial3D(float x, ///< Value x at which to evaluate 100 float y, ///< Value y at which to evaluate 101 float z, ///< Value z at which to evaluate 102 const psPolynomial3D *restrict myPoly ///< Coefficients for the polynomial 103 103 ); 104 104 105 105 /** Evaluate 4D polynomial */ 106 106 float 107 psEvalPolynomial4D(float w, // !< Value w at which to evaluate108 float x, // !< Value x at which to evaluate109 float y, // !< Value y at which to evaluate110 float z, // !< Value z at which to evaluate111 const psPolynomial4D *restrict myPoly // !< Coefficients for the polynomial107 psEvalPolynomial4D(float w, ///< Value w at which to evaluate 108 float x, ///< Value x at which to evaluate 109 float y, ///< Value y at which to evaluate 110 float z, ///< Value z at which to evaluate 111 const psPolynomial4D *restrict myPoly ///< Coefficients for the polynomial 112 112 ); 113 113 … … 120 120 /** Double-precision one-dimensional polynomial */ 121 121 typedef struct { 122 int n; // !< Number of terms123 double *restrict coeff; // !< Coefficients124 double *restrict coeffErr; // !< Error in coefficients125 char *restrict mask; // !< Coefficient mask122 int n; ///< Number of terms 123 double *restrict coeff; ///< Coefficients 124 double *restrict coeffErr; ///< Error in coefficients 125 char *restrict mask; ///< Coefficient mask 126 126 } psDPolynomial1D; 127 127 128 128 /** Double-precision two-dimensional polynomial */ 129 129 typedef struct { 130 int nX, nY; // !< Number of terms in x and y131 double *restrict *restrict coeff; // !< Coefficients132 double *restrict *restrict coeffErr; // !< Error in coefficients133 char *restrict *restrict mask; // !< Coefficients mask130 int nX, nY; ///< Number of terms in x and y 131 double *restrict *restrict coeff; ///< Coefficients 132 double *restrict *restrict coeffErr; ///< Error in coefficients 133 char *restrict *restrict mask; ///< Coefficients mask 134 134 } psDPolynomial2D; 135 135 136 136 /** Double-precision three-dimensional polynomial */ 137 137 typedef struct { 138 int nX, nY, nZ; // !< Number of terms in x, y and z139 double *restrict *restrict *restrict coeff; // !< Coefficients140 double *restrict *restrict *restrict coeffErr; // !< Error in coefficients141 char *restrict *restrict *restrict mask; // !< Coefficient mask138 int nX, nY, nZ; ///< Number of terms in x, y and z 139 double *restrict *restrict *restrict coeff; ///< Coefficients 140 double *restrict *restrict *restrict coeffErr; ///< Error in coefficients 141 char *restrict *restrict *restrict mask; ///< Coefficient mask 142 142 } psDPolynomial3D; 143 143 144 144 /** Double-precision four-dimensional polynomial */ 145 145 typedef struct { 146 int nW, nX, nY, nZ; // !< Number of terms in w, x, y and z147 double *restrict *restrict *restrict *restrict coeff; // !< Coefficients148 double *restrict *restrict *restrict *restrict coeffErr; // !< Error in coefficients149 char *restrict *restrict *restrict *restrict mask; // !< Coefficients mask146 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 147 double *restrict *restrict *restrict *restrict coeff; ///< Coefficients 148 double *restrict *restrict *restrict *restrict coeffErr; ///< Error in coefficients 149 char *restrict *restrict *restrict *restrict mask; ///< Coefficients mask 150 150 } psDPolynomial4D; 151 151 … … 156 156 157 157 /** Constructor */ 158 psDPolynomial1D *psDPolynomial1DAlloc(int n // !< Number of terms159 ); 160 /** Constructor */ 161 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY // !< Number of terms in x and y162 ); 163 /** Constructor */ 164 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ // !< Number of terms in x, y and z165 ); 166 /** Constructor */ 167 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ // !< Number of terms in w, x, y and z168 ); 169 170 171 /** Destructor */ 172 void psDPolynomial1DFree(psDPolynomial1D *restrict myPoly // !< Polynomial to destroy173 ); 174 /** Destructor */ 175 void psDPolynomial2DFree(psDPolynomial2D *restrict myPoly // !< Polynomial to destroy176 ); 177 /** Destructor */ 178 void psDPolynomial3DFree(psDPolynomial3D *restrict myPoly // !< Polynomial to destroy179 ); 180 /** Destructor */ 181 void psDPolynomial4DFree(psDPolynomial4D *restrict myPoly // !< Polynomial to destroy158 psDPolynomial1D *psDPolynomial1DAlloc(int n ///< Number of terms 159 ); 160 /** Constructor */ 161 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y 162 ); 163 /** Constructor */ 164 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z 165 ); 166 /** Constructor */ 167 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 168 ); 169 170 171 /** Destructor */ 172 void psDPolynomial1DFree(psDPolynomial1D *restrict myPoly ///< Polynomial to destroy 173 ); 174 /** Destructor */ 175 void psDPolynomial2DFree(psDPolynomial2D *restrict myPoly ///< Polynomial to destroy 176 ); 177 /** Destructor */ 178 void psDPolynomial3DFree(psDPolynomial3D *restrict myPoly ///< Polynomial to destroy 179 ); 180 /** Destructor */ 181 void psDPolynomial4DFree(psDPolynomial4D *restrict myPoly ///< Polynomial to destroy 182 182 ); 183 183 … … 185 185 /** Evaluate 1D polynomial (double precision) */ 186 186 double 187 psEvalDPolynomial1D(double x, // !< Value at which to evaluate188 const psDPolynomial1D *restrict myPoly // !< Coefficients for the polynomial187 psEvalDPolynomial1D(double x, ///< Value at which to evaluate 188 const psDPolynomial1D *restrict myPoly ///< Coefficients for the polynomial 189 189 ); 190 190 191 191 /** Evaluate 2D polynomial (double precision) */ 192 192 double 193 psEvalDPolynomial2D(double x, // !< Value x at which to evaluate194 double y, // !< Value y at which to evaluate195 const psDPolynomial2D *restrict myPoly // !< Coefficients for the polynomial193 psEvalDPolynomial2D(double x, ///< Value x at which to evaluate 194 double y, ///< Value y at which to evaluate 195 const psDPolynomial2D *restrict myPoly ///< Coefficients for the polynomial 196 196 ); 197 197 198 198 /** Evaluate 3D polynomial (double precision) */ 199 199 double 200 psEvalDPolynomial3D(double x, // !< Value x at which to evaluate201 double y, // !< Value y at which to evaluate202 double z, // !< Value z at which to evaluate203 const psDPolynomial3D *restrict myPoly // !< Coefficients for the polynomial200 psEvalDPolynomial3D(double x, ///< Value x at which to evaluate 201 double y, ///< Value y at which to evaluate 202 double z, ///< Value z at which to evaluate 203 const psDPolynomial3D *restrict myPoly ///< Coefficients for the polynomial 204 204 ); 205 205 206 206 /** Evaluate 4D polynomial (double precision) */ 207 207 double 208 psEvalDPolynomial4D(double w, // !< Value w at which to evaluate209 double x, // !< Value x at which to evaluate210 double y, // !< Value y at which to evaluate211 double z, // !< Value z at which to evaluate212 const psDPolynomial4D *restrict myPoly // !< Coefficients for the polynomial208 psEvalDPolynomial4D(double w, ///< Value w at which to evaluate 209 double x, ///< Value x at which to evaluate 210 double y, ///< Value y at which to evaluate 211 double z, ///< Value z at which to evaluate 212 const psDPolynomial4D *restrict myPoly ///< Coefficients for the polynomial 213 213 ); 214 214
Note:
See TracChangeset
for help on using the changeset viewer.
