Changeset 1440
- Timestamp:
- Aug 9, 2004, 1:34:58 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 84 edited
-
astro/psCoord.c (modified) (16 diffs)
-
astro/psCoord.h (modified) (7 diffs)
-
astronomy/psAstrometry.c (modified) (17 diffs)
-
astronomy/psAstrometry.h (modified) (7 diffs)
-
astronomy/psCoord.c (modified) (16 diffs)
-
astronomy/psCoord.h (modified) (7 diffs)
-
astronomy/psMetadata.c (modified) (22 diffs)
-
astronomy/psMetadata.h (modified) (17 diffs)
-
collections/psArray.c (modified) (8 diffs)
-
collections/psArray.h (modified) (6 diffs)
-
collections/psBitSet.c (modified) (9 diffs)
-
collections/psBitSet.h (modified) (7 diffs)
-
collections/psHash.c (modified) (13 diffs)
-
collections/psHash.h (modified) (4 diffs)
-
collections/psList.c (modified) (15 diffs)
-
collections/psList.h (modified) (11 diffs)
-
collections/psMetadata.c (modified) (22 diffs)
-
collections/psMetadata.h (modified) (17 diffs)
-
collections/psScalar.c (modified) (3 diffs)
-
collections/psScalar.h (modified) (3 diffs)
-
collections/psVector.c (modified) (10 diffs)
-
collections/psVector.h (modified) (7 diffs)
-
dataManip/psFFT.c (modified) (30 diffs)
-
dataManip/psFFT.h (modified) (2 diffs)
-
dataManip/psFunctions.c (modified) (29 diffs)
-
dataManip/psFunctions.h (modified) (12 diffs)
-
dataManip/psMatrix.c (modified) (10 diffs)
-
dataManip/psMatrix.h (modified) (10 diffs)
-
dataManip/psMatrixVectorArithmetic.c (modified) (28 diffs)
-
dataManip/psMatrixVectorArithmetic.h (modified) (3 diffs)
-
dataManip/psMinimize.c (modified) (12 diffs)
-
dataManip/psMinimize.h (modified) (3 diffs)
-
dataManip/psStats.c (modified) (34 diffs)
-
dataManip/psStats.h (modified) (5 diffs)
-
dataManip/psVectorFFT.c (modified) (30 diffs)
-
dataManip/psVectorFFT.h (modified) (2 diffs)
-
fft/psVectorFFT.c (modified) (30 diffs)
-
fft/psVectorFFT.h (modified) (2 diffs)
-
image/psImage.c (modified) (15 diffs)
-
image/psImage.h (modified) (8 diffs)
-
image/psImageExtraction.c (modified) (8 diffs)
-
image/psImageExtraction.h (modified) (5 diffs)
-
image/psImageIO.c (modified) (3 diffs)
-
image/psImageIO.h (modified) (3 diffs)
-
image/psImageManip.c (modified) (13 diffs)
-
image/psImageManip.h (modified) (7 diffs)
-
image/psImageStats.c (modified) (8 diffs)
-
image/psImageStats.h (modified) (2 diffs)
-
imageops/psImageStats.c (modified) (8 diffs)
-
imageops/psImageStats.h (modified) (2 diffs)
-
math/psMatrix.c (modified) (10 diffs)
-
math/psMatrix.h (modified) (10 diffs)
-
math/psMinimize.c (modified) (12 diffs)
-
math/psMinimize.h (modified) (3 diffs)
-
math/psPolynomial.c (modified) (29 diffs)
-
math/psPolynomial.h (modified) (12 diffs)
-
math/psSpline.c (modified) (29 diffs)
-
math/psSpline.h (modified) (12 diffs)
-
math/psStats.c (modified) (34 diffs)
-
math/psStats.h (modified) (5 diffs)
-
mathtypes/psImage.c (modified) (15 diffs)
-
mathtypes/psImage.h (modified) (8 diffs)
-
mathtypes/psScalar.c (modified) (3 diffs)
-
mathtypes/psScalar.h (modified) (3 diffs)
-
mathtypes/psVector.c (modified) (10 diffs)
-
mathtypes/psVector.h (modified) (7 diffs)
-
sys/psMemory.c (modified) (22 diffs)
-
sys/psMemory.h (modified) (6 diffs)
-
sys/psTrace.c (modified) (8 diffs)
-
sys/psTrace.h (modified) (2 diffs)
-
sysUtils/psMemory.c (modified) (22 diffs)
-
sysUtils/psMemory.h (modified) (6 diffs)
-
sysUtils/psTrace.c (modified) (8 diffs)
-
sysUtils/psTrace.h (modified) (2 diffs)
-
types/psArray.c (modified) (8 diffs)
-
types/psArray.h (modified) (6 diffs)
-
types/psBitSet.c (modified) (9 diffs)
-
types/psBitSet.h (modified) (7 diffs)
-
types/psHash.c (modified) (13 diffs)
-
types/psHash.h (modified) (4 diffs)
-
types/psList.c (modified) (15 diffs)
-
types/psList.h (modified) (11 diffs)
-
types/psMetadata.c (modified) (22 diffs)
-
types/psMetadata.h (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r1407 r1440 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-0 7 00:06:06$13 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 33 33 // This is the only function in this file which I understand. 34 psPlane *psPlaneTransformApply(psPlane * out, const psPlaneTransform * transform, const psPlane* coords)34 psPlane* psPlaneTransformApply(psPlane* out, const psPlaneTransform* transform, const psPlane* coords) 35 35 { 36 36 if (out == NULL) { 37 out = (psPlane *) psAlloc(sizeof(psPlane));37 out = (psPlane* ) psAlloc(sizeof(psPlane)); 38 38 } 39 39 out->x = transform->x->coeff[0][0] + … … 48 48 // This transformation takes into account parameters beyond an objects 49 49 // spatial coordinates: term3 and term4. 50 psPlane *psPlaneDistortApply(psPlane* out,51 const psPlaneDistort * transform,52 const psPlane * coords, float term3, float term4)50 psPlane* psPlaneDistortApply(psPlane* out, 51 const psPlaneDistort* transform, 52 const psPlane* coords, float term3, float term4) 53 53 { 54 54 if (out == NULL) { 55 out = (psPlane *) psAlloc(sizeof(psPlane));55 out = (psPlane* ) psAlloc(sizeof(psPlane)); 56 56 } 57 57 … … 70 70 71 71 // This function prototype has been modified since the SDRS. 72 psSphereTransform *psSphereTransformAlloc(double NPlat, double Xo, double xo)73 { 74 psSphereTransform *tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));72 psSphereTransform* psSphereTransformAlloc(double NPlat, double Xo, double xo) 73 { 74 psSphereTransform* tmp = (psSphereTransform* ) psAlloc(sizeof(psSphereTransform)); 75 75 76 76 tmp->sinPhi = sin(NPlat); … … 89 89 // there are no typo's. 90 90 91 psSphere *psSphereTransformApply(psSphere * out, const psSphereTransform * transform, const psSphere* coord)91 psSphere* psSphereTransformApply(psSphere* out, const psSphereTransform* transform, const psSphere* coord) 92 92 { 93 93 double sinY = 0.0; … … 100 100 101 101 if (out == NULL) { 102 out = (psSphere *) psAlloc(sizeof(psSphere));102 out = (psSphere* ) psAlloc(sizeof(psSphere)); 103 103 } 104 104 … … 117 117 } 118 118 119 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)119 psSphereTransform* psSphereTransformICRStoEcliptic(psTime time) 120 120 { 121 121 struct tm *tmTime = psTimeToTM(time); … … 129 129 } 130 130 131 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)131 psSphereTransform* psSphereTransformEcliptictoICRS(psTime time) 132 132 { 133 133 struct tm *tmTime = psTimeToTM(time); … … 141 141 } 142 142 143 psSphereTransform *psSphereTransformICRStoGalatic(void)143 psSphereTransform* psSphereTransformICRStoGalatic(void) 144 144 { 145 145 return (psSphereTransformAlloc(62.6, 282.25, 33.0)); 146 146 } 147 147 148 psSphereTransform *psSphereTransformGalatictoICRS(void)148 psSphereTransform* psSphereTransformGalatictoICRS(void) 149 149 { 150 150 return (psSphereTransformAlloc(-62.6, 33.0, 282.25)); … … 178 178 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 179 179 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 180 psPlane *psProject(const psSphere * coord, const psProjection* projection)180 psPlane* psProject(const psSphere* coord, const psProjection* projection) 181 181 { 182 182 float R = 0.0; 183 183 float alpha = 0.0; 184 psPlane *tmp = (psPlane *) psAlloc(sizeof(psPlane));184 psPlane* tmp = (psPlane* ) psAlloc(sizeof(psPlane)); 185 185 186 186 if (projection->type == PS_PROJ_TAN) { … … 220 220 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 221 221 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 222 psSphere *psDeproject(const psPlane * coord, const psProjection* projection)222 psSphere* psDeproject(const psPlane* coord, const psProjection* projection) 223 223 { 224 224 float R = 0.0; … … 226 226 float chu1 = 0.0; 227 227 float chu2 = 0.0; 228 psSphere *tmp = (psSphere *) psAlloc(sizeof(psSphere));228 psSphere* tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 229 229 230 230 if (projection->type == PS_PROJ_TAN) { … … 267 267 // XXX: Do I need to check for unacceptable transformation parameters? 268 268 // Maybe, if the points are on the North/South Pole, etc? 269 psSphere *psSphereGetOffset(const psSphere* restrict position1,270 const psSphere * restrict position2,269 psSphere* psSphereGetOffset(const psSphere* restrict position1, 270 const psSphere* restrict position2, 271 271 psSphereOffsetMode mode, psSphereOffsetUnit unit) 272 272 { 273 // psPlane *lin;273 // psPlane* lin; 274 274 psProjection proj; 275 psSphere *tmp;275 psSphere* tmp; 276 276 double tmpR = 0.0; 277 277 double tmpD = 0.0; … … 313 313 } 314 314 315 tmp = (psSphere *) psAlloc(sizeof(psSphere));315 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 316 316 tmp->r = tmpR; 317 317 tmp->d = tmpD; … … 328 328 // Maybe, if the points are on the North/South Pole, etc? 329 329 // XXX: I copied the algorithm from the ADD exactly. 330 psSphere *psSphereSetOffset(const psSphere* restrict position,331 const psSphere * restrict offset,330 psSphere* psSphereSetOffset(const psSphere* restrict position, 331 const psSphere* restrict offset, 332 332 psSphereOffsetMode mode, psSphereOffsetUnit unit) 333 333 { 334 334 psPlane lin; 335 psSphere *tmp;335 psSphere* tmp; 336 336 psProjection proj; 337 337 double tmpR = 0.0; … … 368 368 } 369 369 370 tmp = (psSphere *) psAlloc(sizeof(psSphere));370 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 371 371 tmp->r = position->r + tmpR; 372 372 tmp->r = position->d + tmpD; -
trunk/psLib/src/astro/psCoord.h
r1426 r1440 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 72 72 typedef struct 73 73 { 74 psDPolynomial2D *x; ///< 2D polynomial transform of X coordinates75 psDPolynomial2D *y; ///< 2D polynomial transform of Y coordinates74 psDPolynomial2D* x; ///< 2D polynomial transform of X coordinates 75 psDPolynomial2D* y; ///< 2D polynomial transform of Y coordinates 76 76 } 77 77 psPlaneTransform; … … 91 91 typedef struct 92 92 { 93 psDPolynomial4D *x; ///< 4D polynomial transform of X coordinates94 psDPolynomial4D *y; ///< 4D polynomial transform of Y coordinates93 psDPolynomial4D* x; ///< 4D polynomial transform of X coordinates 94 psDPolynomial4D* y; ///< 4D polynomial transform of Y coordinates 95 95 } 96 96 psPlaneDistort; … … 171 171 * 172 172 */ 173 psPlane *psPlaneTransformApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated.174 const psPlaneTransform * transform, ///< the transform to apply175 const psPlane * coords ///< the coordinate to apply the transform above.173 psPlane* psPlaneTransformApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 174 const psPlaneTransform* transform, ///< the transform to apply 175 const psPlane* coords ///< the coordinate to apply the transform above. 176 176 ); 177 177 … … 179 179 * 180 180 */ 181 psPlane *psPlaneDistortApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated.182 const psPlaneDistort * transform, ///< the transform to apply183 const psPlane * coords, ///< the coordinate to apply the transform above.181 psPlane* psPlaneDistortApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 182 const psPlaneDistort* transform, ///< the transform to apply 183 const psPlane* coords, ///< the coordinate to apply the transform above. 184 184 float term3, ///< third term -- maybe magnitude 185 185 float term4 ///< forth term -- maybe color … … 189 189 * 190 190 */ 191 psSphereTransform *psSphereTransformAlloc(double NPlat, ///< north pole latitude191 psSphereTransform* psSphereTransformAlloc(double NPlat, ///< north pole latitude 192 192 double Xo, ///< First PT of Ares lon 193 193 double xo ///< First PT of Ares equiv lon … … 197 197 * 198 198 */ 199 psSphere *psSphereTransformApply(psSphere* out, ///< a psSphere to recycle. If NULL, a new one is199 psSphere* psSphereTransformApply(psSphere* out, ///< a psSphere to recycle. If NULL, a new one is 200 200 // generated. 201 const psSphereTransform * transform, ///< the transform to apply202 const psSphere * coord ///< the coordinate to apply the transform above.x201 const psSphereTransform* transform, ///< the transform to apply 202 const psSphere* coord ///< the coordinate to apply the transform above.x 203 203 ); 204 204 205 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);206 207 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);208 209 psSphereTransform *psSphereTransformICRStoGalatic(void);210 211 psSphereTransform *psSphereTransformGalatictoICRS(void);212 213 psPlane *psProject(const psSphere * coord, const psProjection* projection);214 215 psSphere *psDeproject(const psPlane * coord, const psProjection* projection);216 217 psSphere *psSphereGetOffset(const psSphere* restrict position1,218 const psSphere * restrict position2,205 psSphereTransform* psSphereTransformICRStoEcliptic(psTime time); 206 207 psSphereTransform* psSphereTransformEcliptictoICRS(psTime time); 208 209 psSphereTransform* psSphereTransformICRStoGalatic(void); 210 211 psSphereTransform* psSphereTransformGalatictoICRS(void); 212 213 psPlane* psProject(const psSphere* coord, const psProjection* projection); 214 215 psSphere* psDeproject(const psPlane* coord, const psProjection* projection); 216 217 psSphere* psSphereGetOffset(const psSphere* restrict position1, 218 const psSphere* restrict position2, 219 219 psSphereOffsetMode mode, psSphereOffsetUnit unit); 220 220 221 psSphere *psSphereSetOffset(const psSphere* restrict position,222 const psSphere * restrict offset,221 psSphere* psSphereSetOffset(const psSphere* restrict position, 222 const psSphere* restrict offset, 223 223 psSphereOffsetMode mode, psSphereOffsetUnit unit); 224 224 -
trunk/psLib/src/astronomy/psAstrometry.c
r1407 r1440 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:57 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 21 21 #include "psMemory.h" 22 22 23 static void grommitFree(psGrommit * grommit);24 static int checkValidChipCoords(double x, double y, psChip * tmpChip);25 static int checkValidImageCoords(double x, double y, psImage * tmpImage);26 27 psExposure *psExposureAlloc(double ra, double dec, double hourAngle,23 static void grommitFree(psGrommit* grommit); 24 static int checkValidChipCoords(double x, double y, psChip* tmpChip); 25 static int checkValidImageCoords(double x, double y, psImage* tmpImage); 26 27 psExposure* psExposureAlloc(double ra, double dec, double hourAngle, 28 28 double zenith, double azimuth, double localTime, float date, 29 29 float rotAngle, float temperature, float pressure, float humidity, 30 30 float exposureTime) 31 31 { 32 psExposure *exp = psAlloc(sizeof(psExposure));32 psExposure* exp = psAlloc(sizeof(psExposure)); 33 33 34 34 *(double *)&exp->ra = ra; … … 49 49 } 50 50 51 psGrommit *psGrommitAlloc(const psExposure* exp)51 psGrommit* psGrommitAlloc(const psExposure* exp) 52 52 { 53 53 double *slaGrommit = (double *)psAlloc(14 * sizeof(double)); 54 psGrommit *grommit = (psGrommit *) psAlloc(sizeof(psGrommit));54 psGrommit* grommit = (psGrommit* ) psAlloc(sizeof(psGrommit)); 55 55 56 56 /* … … 79 79 } 80 80 81 void p_psGrommitFree(psGrommit * grommit)81 void p_psGrommitFree(psGrommit* grommit) 82 82 { 83 83 psFree(grommit); 84 84 } 85 85 86 psCell *psCellinFPA(psCell * out, const psPlane * coord, const psFPA* FPA)87 { 88 psChip *tmpChip = NULL;89 psCell *tmpCell = NULL;86 psCell* psCellinFPA(psCell* out, const psPlane* coord, const psFPA* FPA) 87 { 88 psChip* tmpChip = NULL; 89 psCell* tmpCell = NULL; 90 90 91 91 tmpChip = psChipinFPA(tmpChip, coord, FPA); … … 94 94 } 95 95 96 int checkValidChipCoords(double x, double y, psChip * tmpChip)96 int checkValidChipCoords(double x, double y, psChip* tmpChip) 97 97 { 98 98 return (0); 99 99 } 100 100 101 psChip *psChipinFPA(psChip * out, const psPlane * coord, const psFPA* FPA)102 { 103 psArray *chips = FPA->chips;101 psChip* psChipinFPA(psChip* out, const psPlane* coord, const psFPA* FPA) 102 { 103 psArray* chips = FPA->chips; 104 104 int nChips = chips->n; 105 psPlane *tmpCoord = NULL;105 psPlane* tmpCoord = NULL; 106 106 107 107 for (int i = 0; i < nChips; i++) { 108 psChip *tmpChip = chips->data[i];108 psChip* tmpChip = chips->data[i]; 109 109 110 110 tmpCoord = psPlaneTransformApply(tmpCoord, tmpChip->fromFPA, coord); … … 120 120 } 121 121 122 int checkValidImageCoords(double x, double y, psImage * tmpImage)122 int checkValidImageCoords(double x, double y, psImage* tmpImage) 123 123 { 124 124 if ((x < 0.0) || (x > (double)tmpImage->numCols) || (y < 0.0) || (y > (double)tmpImage->numRows)) { … … 140 140 XXX: must deallocate memory. 141 141 *****************************************************************************/ 142 psCell *psCellinChip(psCell * out, const psPlane * coord, const psChip* chip)143 { 144 psPlane *tmpCoord = NULL;145 psArray *cells;142 psCell* psCellinChip(psCell* out, const psPlane* coord, const psChip* chip) 143 { 144 psPlane* tmpCoord = NULL; 145 psArray* cells; 146 146 147 147 if (chip == NULL) { … … 156 156 157 157 for (int i = 0; i < cells->n; i++) { 158 psCell *tmpCell = (psCell *) cells->data[i];159 psArray *readouts = tmpCell->readouts;158 psCell* tmpCell = (psCell* ) cells->data[i]; 159 psArray* readouts = tmpCell->readouts; 160 160 161 161 if (readouts != NULL) { 162 162 for (int j = 0; j < readouts->n; j++) { 163 psReadout *tmpReadout = readouts->data[j];163 psReadout* tmpReadout = readouts->data[j]; 164 164 165 165 tmpCoord = psPlaneTransformApply(tmpCoord, tmpCell->fromChip, coord); … … 173 173 } 174 174 175 psPlane *psCoordCelltoChip(psPlane * out, const psPlane * in, const psCell* cell)175 psPlane* psCoordCelltoChip(psPlane* out, const psPlane* in, const psCell* cell) 176 176 { 177 177 return (psPlaneTransformApply(out, cell->toChip, in)); 178 178 } 179 179 180 psPlane *psCoordChipToFPA(psPlane * out, const psPlane * in, const psChip* chip)180 psPlane* psCoordChipToFPA(psPlane* out, const psPlane* in, const psChip* chip) 181 181 { 182 182 return (psPlaneTransformApply(out, chip->toFPA, in)); 183 183 } 184 184 185 psPlane *psCoordFPAtoTP(psPlane * out, const psPlane * in, const psFPA* fpa)185 psPlane* psCoordFPAtoTP(psPlane* out, const psPlane* in, const psFPA* fpa) 186 186 { 187 187 // XXX: This code doesn't work; fpa->toTangentPlane is of the wrong type. … … 191 191 192 192 // XXX: must wrap SLA_QAPQK here. 193 psSphere *psCoordTPtoSky(psSphere * out, const psPlane * in, const psGrommit* grommit)193 psSphere* psCoordTPtoSky(psSphere* out, const psPlane* in, const psGrommit* grommit) 194 194 { 195 195 /* … … 202 202 } 203 203 204 psPlane *psCoordCellToFPA(psPlane * out, const psPlane * in, const psCell* cell)204 psPlane* psCoordCellToFPA(psPlane* out, const psPlane* in, const psCell* cell) 205 205 { 206 206 return (psPlaneTransformApply(out, cell->toFPA, in)); … … 210 210 // transformation, as well as a few psPlane structs. Can this be implemented 211 211 // better? 212 psSphere *psCoordCelltoSky(psSphere * out, const psPlane * in, const psCell* cell)213 { 214 psPlane *tmp1 = NULL;215 psPlane *tmp2 = NULL;216 psFPA *parFPA = (cell->parent)->parent;217 psGrommit *tmpGrommit = NULL;212 psSphere* psCoordCelltoSky(psSphere* out, const psPlane* in, const psCell* cell) 213 { 214 psPlane* tmp1 = NULL; 215 psPlane* tmp2 = NULL; 216 psFPA* parFPA = (cell->parent)->parent; 217 psGrommit* tmpGrommit = NULL; 218 218 219 219 tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in); … … 230 230 } 231 231 232 psSphere *psCoordCelltoSkyQuick(psSphere * out, const psPlane * in, const psCell* cell)233 { 234 psPlane *tmp1 = NULL;232 psSphere* psCoordCelltoSkyQuick(psSphere* out, const psPlane* in, const psCell* cell) 233 { 234 psPlane* tmp1 = NULL; 235 235 236 236 tmp1 = psPlaneTransformApply(tmp1, cell->toSky, in); … … 245 245 246 246 // XXX: must wrap SLA_AOPQK here. 247 psPlane *psCoordSkytoTP(psPlane * out, const psSphere * in, const psGrommit* grommit)247 psPlane* psCoordSkytoTP(psPlane* out, const psSphere* in, const psGrommit* grommit) 248 248 { 249 249 extern void sla_AOPQK(RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB); … … 255 255 256 256 if (out == NULL) { 257 out = (psPlane *) psAlloc(sizeof(psPlane));257 out = (psPlane* ) psAlloc(sizeof(psPlane)); 258 258 } 259 259 … … 264 264 } 265 265 266 psPlane *psCoordTPtoFPA(psPlane * out, const psPlane * in, const psFPA* fpa)266 psPlane* psCoordTPtoFPA(psPlane* out, const psPlane* in, const psFPA* fpa) 267 267 { 268 268 return (psPlaneTransformApply(out, fpa->fromTangentPlane, in)); 269 269 } 270 270 271 psPlane *psCoordFPAtoChip(psPlane * out, const psPlane * in, const psChip* chip)271 psPlane* psCoordFPAtoChip(psPlane* out, const psPlane* in, const psChip* chip) 272 272 { 273 273 return (psPlaneTransformApply(out, chip->fromFPA, in)); 274 274 } 275 275 276 psPlane *psCoordChiptoCell(psPlane * out, const psPlane * in, const psCell* cell)276 psPlane* psCoordChiptoCell(psPlane* out, const psPlane* in, const psCell* cell) 277 277 { 278 278 return (psPlaneTransformApply(out, cell->fromChip, in)); 279 279 } 280 280 281 psPlane *psCoordSkytoCell(psPlane * out, const psSphere * in, const psCell* cell)281 psPlane* psCoordSkytoCell(psPlane* out, const psSphere* in, const psCell* cell) 282 282 { 283 283 out = psCoordSkytoTP(out, in, tmpGrommit); … … 289 289 } 290 290 291 psPlane *psCoordSkytoCellQuick(psPlane * out, const psSphere * in, const psCell* cell)291 psPlane* psCoordSkytoCellQuick(psPlane* out, const psSphere* in, const psCell* cell) 292 292 { 293 293 if (out == NULL) { 294 out = (psPlane *) psAlloc(sizeof(psPlane));295 } 296 297 return (out); 298 } 294 out = (psPlane* ) psAlloc(sizeof(psPlane)); 295 } 296 297 return (out); 298 } -
trunk/psLib/src/astronomy/psAstrometry.h
r1426 r1440 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-09 2 2:44:25$11 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:57 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 100 100 const int row0; ///< Offset from the bottom of chip. 101 101 102 psImage *image; ///< imaging area of Readout103 psList *objects; ///< objects derived from Readout104 psMetadata *metadata; ///< readout-level metadata102 psImage* image; ///< imaging area of Readout 103 psList* objects; ///< objects derived from Readout 104 psMetadata* metadata; ///< readout-level metadata 105 105 } 106 106 psReadout; … … 117 117 typedef struct psCell 118 118 { 119 psArray *readouts; ///< readouts from the cell120 psMetadata *metadata; ///< cell-level metadata121 122 psPlaneTransform *toChip; ///< transformations from cell to chip coordinates123 psPlaneTransform *fromChip; ///< transformations from chip to cell coordinates124 psPlaneTransform *toFPA; ///< transformations from cell to FPA coordinates125 psPlaneTransform *toSky; ///< transformations from cell to sky coordinates126 127 struct psChip *parent; ///< chip in which contains this cell119 psArray* readouts; ///< readouts from the cell 120 psMetadata* metadata; ///< cell-level metadata 121 122 psPlaneTransform* toChip; ///< transformations from cell to chip coordinates 123 psPlaneTransform* fromChip; ///< transformations from chip to cell coordinates 124 psPlaneTransform* toFPA; ///< transformations from cell to FPA coordinates 125 psPlaneTransform* toSky; ///< transformations from cell to sky coordinates 126 127 struct psChip* parent; ///< chip in which contains this cell 128 128 } 129 129 psCell; … … 139 139 typedef struct psChip 140 140 { 141 psArray *cells; ///< cells in the chip142 psMetadata *metadata; ///< chip-level metadata143 144 psPlaneTransform *toFPA; ///< transformation from chip to FPA coordinates145 psPlaneTransform *fromFPA; ///< transformation from FPA to chip coordinates146 147 struct psFPA *parent; ///< FPA which contains this chip141 psArray* cells; ///< cells in the chip 142 psMetadata* metadata; ///< chip-level metadata 143 144 psPlaneTransform* toFPA; ///< transformation from chip to FPA coordinates 145 psPlaneTransform* fromFPA; ///< transformation from FPA to chip coordinates 146 147 struct psFPA* parent; ///< FPA which contains this chip 148 148 } 149 149 psChip; … … 164 164 typedef struct psFPA 165 165 { 166 psArray *chips; ///< chips in the focal plane array167 psMetadata *metadata; ///< focal-plane's metadata168 169 psPlaneDistort *fromTangentPlane; ///< transformation from tangent plane to focal plane170 psPlaneDistort *toTangentPlane; ///< transformation from focal plane to tangent plane171 psFixedPattern *pattern; ///< fixed pattern residual offsets172 173 const struct psExposure *exposure; ///< information about this exposure174 175 psPhotSystem *colorPlus; ///< Color reference176 psPhotSystem *colorMinus; ///< Color reference166 psArray* chips; ///< chips in the focal plane array 167 psMetadata* metadata; ///< focal-plane's metadata 168 169 psPlaneDistort* fromTangentPlane; ///< transformation from tangent plane to focal plane 170 psPlaneDistort* toTangentPlane; ///< transformation from focal plane to tangent plane 171 psFixedPattern* pattern; ///< fixed pattern residual offsets 172 173 const struct psExposure* exposure; ///< information about this exposure 174 175 psPhotSystem* colorPlus; ///< Color reference 176 psPhotSystem* colorMinus; ///< Color reference 177 177 178 178 float rmsX; ///< RMS for x transformation fits … … 214 214 psExposure; 215 215 216 psExposure *psExposureAlloc(double ra, ///< Telescope boresight, right ascention216 psExposure* psExposureAlloc(double ra, ///< Telescope boresight, right ascention 217 217 double dec, ///< Telescope boresight, declination 218 218 double hourAngle, ///< Hour angle … … 233 233 * exposure. 234 234 * 235 * @return psGrommit* New grommit structure.236 */ 237 psGrommit *psGrommitAlloc(const psExposure* exp ///< the cooresponding exposure structure.235 * @return psGrommit* New grommit structure. 236 */ 237 psGrommit* psGrommitAlloc(const psExposure* exp ///< the cooresponding exposure structure. 238 238 ); 239 239 240 psCell *psCellinFPA(psCell * out, const psPlane * coord, const psFPA* FPA);241 242 psChip *psChipinFPA(psChip * out, const psPlane * coord, const psFPA* FPA);243 244 psCell *psCellinChip(psCell * out, const psPlane * coord, const psChip* chip);245 246 psPlane *psCoordCelltoChip(psPlane * out, const psPlane * in, const psCell* cell);247 248 psPlane *psCoordChipToFPA(psPlane * out, const psPlane * in, const psChip* chip);249 250 psPlane *psCoordFPAtoTP(psPlane * out, const psPlane * in, const psFPA* fpa);251 252 psSphere *psCoordTPtoSky(psSphere * out, const psPlane * in, const psGrommit* grommit);253 254 psPlane *psCoordCellToFPA(psPlane * out, const psPlane * in, const psCell* cell);255 256 psSphere *psCoordCelltoSky(psSphere * out, const psPlane * in, const psCell* cell);257 258 psSphere *psCoordCelltoSkyQuick(psSphere * out, const psPlane * in, const psCell* cell);259 260 psPlane *psCoordSkytoTP(psPlane * out, const psSphere * in, const psGrommit* grommit);261 262 psPlane *psCoordTPtoFPA(psPlane * out, const psPlane * in, const psFPA* fpa);263 264 psPlane *psCoordFPAtoChip(psPlane * out, const psPlane * in, const psChip* chip);265 266 psPlane *psCoordChiptoCell(psPlane * out, const psPlane * in, const psCell* cell);267 268 psPlane *psCoordSkytoCell(psPlane * out, const psSphere * in, const psCell* cell);269 270 psPlane *psCoordSkytoCellQuick(psPlane * out, const psSphere * in, const psCell* cell);240 psCell* psCellinFPA(psCell* out, const psPlane* coord, const psFPA* FPA); 241 242 psChip* psChipinFPA(psChip* out, const psPlane* coord, const psFPA* FPA); 243 244 psCell* psCellinChip(psCell* out, const psPlane* coord, const psChip* chip); 245 246 psPlane* psCoordCelltoChip(psPlane* out, const psPlane* in, const psCell* cell); 247 248 psPlane* psCoordChipToFPA(psPlane* out, const psPlane* in, const psChip* chip); 249 250 psPlane* psCoordFPAtoTP(psPlane* out, const psPlane* in, const psFPA* fpa); 251 252 psSphere* psCoordTPtoSky(psSphere* out, const psPlane* in, const psGrommit* grommit); 253 254 psPlane* psCoordCellToFPA(psPlane* out, const psPlane* in, const psCell* cell); 255 256 psSphere* psCoordCelltoSky(psSphere* out, const psPlane* in, const psCell* cell); 257 258 psSphere* psCoordCelltoSkyQuick(psSphere* out, const psPlane* in, const psCell* cell); 259 260 psPlane* psCoordSkytoTP(psPlane* out, const psSphere* in, const psGrommit* grommit); 261 262 psPlane* psCoordTPtoFPA(psPlane* out, const psPlane* in, const psFPA* fpa); 263 264 psPlane* psCoordFPAtoChip(psPlane* out, const psPlane* in, const psChip* chip); 265 266 psPlane* psCoordChiptoCell(psPlane* out, const psPlane* in, const psCell* cell); 267 268 psPlane* psCoordSkytoCell(psPlane* out, const psSphere* in, const psCell* cell); 269 270 psPlane* psCoordSkytoCellQuick(psPlane* out, const psSphere* in, const psCell* cell); 271 271 272 272 #endif -
trunk/psLib/src/astronomy/psCoord.c
r1407 r1440 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-0 7 00:06:06$13 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 33 33 // This is the only function in this file which I understand. 34 psPlane *psPlaneTransformApply(psPlane * out, const psPlaneTransform * transform, const psPlane* coords)34 psPlane* psPlaneTransformApply(psPlane* out, const psPlaneTransform* transform, const psPlane* coords) 35 35 { 36 36 if (out == NULL) { 37 out = (psPlane *) psAlloc(sizeof(psPlane));37 out = (psPlane* ) psAlloc(sizeof(psPlane)); 38 38 } 39 39 out->x = transform->x->coeff[0][0] + … … 48 48 // This transformation takes into account parameters beyond an objects 49 49 // spatial coordinates: term3 and term4. 50 psPlane *psPlaneDistortApply(psPlane* out,51 const psPlaneDistort * transform,52 const psPlane * coords, float term3, float term4)50 psPlane* psPlaneDistortApply(psPlane* out, 51 const psPlaneDistort* transform, 52 const psPlane* coords, float term3, float term4) 53 53 { 54 54 if (out == NULL) { 55 out = (psPlane *) psAlloc(sizeof(psPlane));55 out = (psPlane* ) psAlloc(sizeof(psPlane)); 56 56 } 57 57 … … 70 70 71 71 // This function prototype has been modified since the SDRS. 72 psSphereTransform *psSphereTransformAlloc(double NPlat, double Xo, double xo)73 { 74 psSphereTransform *tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));72 psSphereTransform* psSphereTransformAlloc(double NPlat, double Xo, double xo) 73 { 74 psSphereTransform* tmp = (psSphereTransform* ) psAlloc(sizeof(psSphereTransform)); 75 75 76 76 tmp->sinPhi = sin(NPlat); … … 89 89 // there are no typo's. 90 90 91 psSphere *psSphereTransformApply(psSphere * out, const psSphereTransform * transform, const psSphere* coord)91 psSphere* psSphereTransformApply(psSphere* out, const psSphereTransform* transform, const psSphere* coord) 92 92 { 93 93 double sinY = 0.0; … … 100 100 101 101 if (out == NULL) { 102 out = (psSphere *) psAlloc(sizeof(psSphere));102 out = (psSphere* ) psAlloc(sizeof(psSphere)); 103 103 } 104 104 … … 117 117 } 118 118 119 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)119 psSphereTransform* psSphereTransformICRStoEcliptic(psTime time) 120 120 { 121 121 struct tm *tmTime = psTimeToTM(time); … … 129 129 } 130 130 131 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)131 psSphereTransform* psSphereTransformEcliptictoICRS(psTime time) 132 132 { 133 133 struct tm *tmTime = psTimeToTM(time); … … 141 141 } 142 142 143 psSphereTransform *psSphereTransformICRStoGalatic(void)143 psSphereTransform* psSphereTransformICRStoGalatic(void) 144 144 { 145 145 return (psSphereTransformAlloc(62.6, 282.25, 33.0)); 146 146 } 147 147 148 psSphereTransform *psSphereTransformGalatictoICRS(void)148 psSphereTransform* psSphereTransformGalatictoICRS(void) 149 149 { 150 150 return (psSphereTransformAlloc(-62.6, 33.0, 282.25)); … … 178 178 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 179 179 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 180 psPlane *psProject(const psSphere * coord, const psProjection* projection)180 psPlane* psProject(const psSphere* coord, const psProjection* projection) 181 181 { 182 182 float R = 0.0; 183 183 float alpha = 0.0; 184 psPlane *tmp = (psPlane *) psAlloc(sizeof(psPlane));184 psPlane* tmp = (psPlane* ) psAlloc(sizeof(psPlane)); 185 185 186 186 if (projection->type == PS_PROJ_TAN) { … … 220 220 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 221 221 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 222 psSphere *psDeproject(const psPlane * coord, const psProjection* projection)222 psSphere* psDeproject(const psPlane* coord, const psProjection* projection) 223 223 { 224 224 float R = 0.0; … … 226 226 float chu1 = 0.0; 227 227 float chu2 = 0.0; 228 psSphere *tmp = (psSphere *) psAlloc(sizeof(psSphere));228 psSphere* tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 229 229 230 230 if (projection->type == PS_PROJ_TAN) { … … 267 267 // XXX: Do I need to check for unacceptable transformation parameters? 268 268 // Maybe, if the points are on the North/South Pole, etc? 269 psSphere *psSphereGetOffset(const psSphere* restrict position1,270 const psSphere * restrict position2,269 psSphere* psSphereGetOffset(const psSphere* restrict position1, 270 const psSphere* restrict position2, 271 271 psSphereOffsetMode mode, psSphereOffsetUnit unit) 272 272 { 273 // psPlane *lin;273 // psPlane* lin; 274 274 psProjection proj; 275 psSphere *tmp;275 psSphere* tmp; 276 276 double tmpR = 0.0; 277 277 double tmpD = 0.0; … … 313 313 } 314 314 315 tmp = (psSphere *) psAlloc(sizeof(psSphere));315 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 316 316 tmp->r = tmpR; 317 317 tmp->d = tmpD; … … 328 328 // Maybe, if the points are on the North/South Pole, etc? 329 329 // XXX: I copied the algorithm from the ADD exactly. 330 psSphere *psSphereSetOffset(const psSphere* restrict position,331 const psSphere * restrict offset,330 psSphere* psSphereSetOffset(const psSphere* restrict position, 331 const psSphere* restrict offset, 332 332 psSphereOffsetMode mode, psSphereOffsetUnit unit) 333 333 { 334 334 psPlane lin; 335 psSphere *tmp;335 psSphere* tmp; 336 336 psProjection proj; 337 337 double tmpR = 0.0; … … 368 368 } 369 369 370 tmp = (psSphere *) psAlloc(sizeof(psSphere));370 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 371 371 tmp->r = position->r + tmpR; 372 372 tmp->r = position->d + tmpD; -
trunk/psLib/src/astronomy/psCoord.h
r1426 r1440 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 72 72 typedef struct 73 73 { 74 psDPolynomial2D *x; ///< 2D polynomial transform of X coordinates75 psDPolynomial2D *y; ///< 2D polynomial transform of Y coordinates74 psDPolynomial2D* x; ///< 2D polynomial transform of X coordinates 75 psDPolynomial2D* y; ///< 2D polynomial transform of Y coordinates 76 76 } 77 77 psPlaneTransform; … … 91 91 typedef struct 92 92 { 93 psDPolynomial4D *x; ///< 4D polynomial transform of X coordinates94 psDPolynomial4D *y; ///< 4D polynomial transform of Y coordinates93 psDPolynomial4D* x; ///< 4D polynomial transform of X coordinates 94 psDPolynomial4D* y; ///< 4D polynomial transform of Y coordinates 95 95 } 96 96 psPlaneDistort; … … 171 171 * 172 172 */ 173 psPlane *psPlaneTransformApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated.174 const psPlaneTransform * transform, ///< the transform to apply175 const psPlane * coords ///< the coordinate to apply the transform above.173 psPlane* psPlaneTransformApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 174 const psPlaneTransform* transform, ///< the transform to apply 175 const psPlane* coords ///< the coordinate to apply the transform above. 176 176 ); 177 177 … … 179 179 * 180 180 */ 181 psPlane *psPlaneDistortApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated.182 const psPlaneDistort * transform, ///< the transform to apply183 const psPlane * coords, ///< the coordinate to apply the transform above.181 psPlane* psPlaneDistortApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 182 const psPlaneDistort* transform, ///< the transform to apply 183 const psPlane* coords, ///< the coordinate to apply the transform above. 184 184 float term3, ///< third term -- maybe magnitude 185 185 float term4 ///< forth term -- maybe color … … 189 189 * 190 190 */ 191 psSphereTransform *psSphereTransformAlloc(double NPlat, ///< north pole latitude191 psSphereTransform* psSphereTransformAlloc(double NPlat, ///< north pole latitude 192 192 double Xo, ///< First PT of Ares lon 193 193 double xo ///< First PT of Ares equiv lon … … 197 197 * 198 198 */ 199 psSphere *psSphereTransformApply(psSphere* out, ///< a psSphere to recycle. If NULL, a new one is199 psSphere* psSphereTransformApply(psSphere* out, ///< a psSphere to recycle. If NULL, a new one is 200 200 // generated. 201 const psSphereTransform * transform, ///< the transform to apply202 const psSphere * coord ///< the coordinate to apply the transform above.x201 const psSphereTransform* transform, ///< the transform to apply 202 const psSphere* coord ///< the coordinate to apply the transform above.x 203 203 ); 204 204 205 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);206 207 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);208 209 psSphereTransform *psSphereTransformICRStoGalatic(void);210 211 psSphereTransform *psSphereTransformGalatictoICRS(void);212 213 psPlane *psProject(const psSphere * coord, const psProjection* projection);214 215 psSphere *psDeproject(const psPlane * coord, const psProjection* projection);216 217 psSphere *psSphereGetOffset(const psSphere* restrict position1,218 const psSphere * restrict position2,205 psSphereTransform* psSphereTransformICRStoEcliptic(psTime time); 206 207 psSphereTransform* psSphereTransformEcliptictoICRS(psTime time); 208 209 psSphereTransform* psSphereTransformICRStoGalatic(void); 210 211 psSphereTransform* psSphereTransformGalatictoICRS(void); 212 213 psPlane* psProject(const psSphere* coord, const psProjection* projection); 214 215 psSphere* psDeproject(const psPlane* coord, const psProjection* projection); 216 217 psSphere* psSphereGetOffset(const psSphere* restrict position1, 218 const psSphere* restrict position2, 219 219 psSphereOffsetMode mode, psSphereOffsetUnit unit); 220 220 221 psSphere *psSphereSetOffset(const psSphere* restrict position,222 const psSphere * restrict offset,221 psSphere* psSphereSetOffset(const psSphere* restrict position, 222 const psSphere* restrict offset, 223 223 psSphereOffsetMode mode, psSphereOffsetUnit unit); 224 224 -
trunk/psLib/src/astronomy/psMetadata.c
r1431 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 23: 06:10$14 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:57 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 89 89 /*****************************************************************************/ 90 static void metadataItemFree(psMetadataItem * metadataItem)90 static void metadataItemFree(psMetadataItem* metadataItem) 91 91 { 92 92 psMetadataType type; … … 109 109 } 110 110 111 static void metadataFree(psMetadata * metadata)111 static void metadataFree(psMetadata* metadata) 112 112 { 113 113 if (metadata == NULL) { … … 124 124 /*****************************************************************************/ 125 125 126 psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)126 psMetadataItem* psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...) 127 127 { 128 128 va_list argPtr; 129 psMetadataItem *metadataItem = NULL;129 psMetadataItem* metadataItem = NULL; 130 130 131 131 // Get the variable list parameters to pass to allocation function … … 141 141 } 142 142 143 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,143 psMetadataItem* psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment, 144 144 va_list argPtr) 145 145 { 146 psMetadataItem *metadataItem = NULL;146 psMetadataItem* metadataItem = NULL; 147 147 148 148 if (name == NULL) { … … 151 151 } 152 152 // Allocate metadata item 153 metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));153 metadataItem = (psMetadataItem* ) psAlloc(sizeof(psMetadataItem)); 154 154 if (metadataItem == NULL) { 155 155 psAbort(__func__, "Failed to allocate memory"); … … 211 211 } 212 212 213 psMetadata *psMetadataAlloc(void)214 { 215 psList *list = NULL;216 psHash *table = NULL;217 psMetadata *metadata = NULL;213 psMetadata* psMetadataAlloc(void) 214 { 215 psList* list = NULL; 216 psHash* table = NULL; 217 psMetadata* metadata = NULL; 218 218 219 219 // Allocate metadata 220 metadata = (psMetadata *) psAlloc(sizeof(psMetadata));220 metadata = (psMetadata* ) psAlloc(sizeof(psMetadata)); 221 221 if (metadata == NULL) { 222 222 psAbort(__func__, "Failed to allocate metadata"); … … 226 226 227 227 // Allocate metadata's internal containers 228 list = (psList *) psListAlloc(NULL);228 list = (psList* ) psListAlloc(NULL); 229 229 if (list == NULL) { 230 230 psAbort(__func__, "Failed to allocate list"); 231 231 } 232 232 233 table = (psHash *) psHashAlloc(10);233 table = (psHash* ) psHashAlloc(10); 234 234 if (table == NULL) { 235 235 psAbort(__func__, "Failed to allocate table"); … … 242 242 } 243 243 244 bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem* restrict metadataItem)244 bool psMetadataAddItem(psMetadata* restrict md, int where, psMetadataItem* restrict metadataItem) 245 245 { 246 246 char *key = NULL; 247 psHash *mdTable = NULL;248 psList *mdList = NULL;249 psMetadataItem *value = NULL;247 psHash* mdTable = NULL; 248 psList* mdList = NULL; 249 psMetadataItem* value = NULL; 250 250 psMetadataType type = PS_META_ITEM_SET; 251 251 … … 280 280 } 281 281 // Check if key is already in table 282 value = (psMetadataItem *) psHashLookup(mdTable, key);282 value = (psMetadataItem* ) psHashLookup(mdTable, key); 283 283 if (value != NULL && type != PS_META_ITEM_SET) { 284 284 … … 316 316 } 317 317 318 bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,318 bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type, 319 319 const char *comment, ...) 320 320 { 321 321 va_list argPtr; 322 psMetadataItem *metadataItem = NULL;322 psMetadataItem* metadataItem = NULL; 323 323 324 324 va_start(argPtr, comment); … … 339 339 } 340 340 341 bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)341 bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key) 342 342 { 343 343 int numChildren = 0; 344 psList *mdList = NULL;345 psHash *mdTable = NULL;346 psMetadataItem *entry = NULL;347 psMetadataItem *entryChild = NULL;344 psList* mdList = NULL; 345 psHash* mdTable = NULL; 346 psMetadataItem* entry = NULL; 347 psMetadataItem* entryChild = NULL; 348 348 349 349 … … 368 368 369 369 // Remove by key name 370 entry = (psMetadataItem *) psHashLookup(mdTable, key);370 entry = (psMetadataItem* ) psHashLookup(mdTable, key); 371 371 if (entry == NULL) { 372 372 psError(__func__, "Couldn't find metadata item. Name: %s", key); … … 419 419 } 420 420 421 psMetadataItem *psMetadataLookup(psMetadata* restrict md, const char *restrict key)422 { 423 psHash *mdTable = NULL;424 psMetadataItem *entry = NULL;421 psMetadataItem* psMetadataLookup(psMetadata* restrict md, const char *restrict key) 422 { 423 psHash* mdTable = NULL; 424 psMetadataItem* entry = NULL; 425 425 426 426 … … 441 441 } 442 442 443 entry = (psMetadataItem *) psHashLookup(mdTable, key);443 entry = (psMetadataItem* ) psHashLookup(mdTable, key); 444 444 if (entry == NULL) { 445 445 psError(__func__, "Could not find metadata item. Key: %s", key); … … 450 450 } 451 451 452 psMetadataItem *psMetadataGet(psMetadata* restrict md, int where)453 { 454 psList *mdList = NULL;455 psMetadataItem *entry = NULL;452 psMetadataItem* psMetadataGet(psMetadata* restrict md, int where) 453 { 454 psList* mdList = NULL; 455 psMetadataItem* entry = NULL; 456 456 457 457 … … 467 467 } 468 468 469 entry = (psMetadataItem *) psListGet(mdList, where);469 entry = (psMetadataItem* ) psListGet(mdList, where); 470 470 if (entry == NULL) { 471 471 psError(__func__, "Couldn't find metadata item with given index. Index: %d", where); … … 476 476 } 477 477 478 bool psMetadataSetIterator(psMetadata * restrict md, int where)479 { 480 psList *mdList = NULL;478 bool psMetadataSetIterator(psMetadata* restrict md, int where) 479 { 480 psList* mdList = NULL; 481 481 482 482 if (md == NULL) { … … 496 496 } 497 497 498 psMetadataItem *psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)499 { 500 psList *mdList = NULL;501 psMetadataItem *entry = NULL;498 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which) 499 { 500 psList* mdList = NULL; 501 psMetadataItem* entry = NULL; 502 502 503 503 mdList = md->list; … … 532 532 } 533 533 534 psMetadataItem *psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)535 { 536 psList *mdList = NULL;537 psMetadataItem *entry = NULL;534 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which) 535 { 536 psList* mdList = NULL; 537 psMetadataItem* entry = NULL; 538 538 539 539 mdList = md->list; … … 568 568 } 569 569 570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem* restrict metadataItem) 571 571 { 572 572 psMetadataType type; … … 616 616 } 617 617 618 psMetadata *psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd)618 psMetadata* psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd) 619 619 { 620 620 bool tempBool; -
trunk/psLib/src/astronomy/psMetadata.h
r1426 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 66 66 } data; ///< Union for data types. 67 67 char *comment; ///< Optional comment ("", not NULL). 68 psList *restrict items; ///< List of psMetadataItems with same name.68 psList* restrict items; ///< List of psMetadataItems with same name. 69 69 } 70 70 psMetadataItem; … … 78 78 typedef struct psMetadata 79 79 { 80 psList *restrict list;81 psHash *restrict table;80 psList* restrict list; 81 psHash* restrict table; 82 82 } 83 83 psMetadata; … … 100 100 * specified size and type. 101 101 * 102 * @return psMetadataItem* : Pointer metadata item.103 */ 104 psMetadataItem *psMetadataItemAlloc(const char *name, ///< Name of metadata item.102 * @return psMetadataItem* : Pointer metadata item. 103 */ 104 psMetadataItem* psMetadataItemAlloc(const char *name, ///< Name of metadata item. 105 105 psMetadataType type, ///< Type of metadata item. 106 106 const char *comment, ///< Comment for metadata item. … … 119 119 * specified size and type. 120 120 * 121 * @return psMetadataItem* : Pointer metadata item.122 */ 123 psMetadataItem *psMetadataItemAllocV(const char *name, ///< Name of metadata item.121 * @return psMetadataItem* : Pointer metadata item. 122 */ 123 psMetadataItem* psMetadataItemAllocV(const char *name, ///< Name of metadata item. 124 124 psMetadataType type, ///< Type of metadata item. 125 125 const char *comment, ///< Comment for metadata item. … … 132 132 * Returns an empty metadata container with fully allocated internal metadata containers. 133 133 * 134 * @return psMetadata* : Pointer metadata.135 */ 136 psMetadata *psMetadataAlloc(void ///< Void.134 * @return psMetadata* : Pointer metadata. 135 */ 136 psMetadata* psMetadataAlloc(void ///< Void. 137 137 ); 138 138 … … 143 143 * @return bool: True for success, false for failure. 144 144 */ 145 bool psMetadataAddItem(psMetadata * restrict md, ///< Metadata collection to insert metadat item.145 bool psMetadataAddItem(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 146 146 int where, ///< Location to be added. 147 psMetadataItem * restrict item ///< Metadata item to be added.147 psMetadataItem* restrict item ///< Metadata item to be added. 148 148 ); 149 149 … … 154 154 * @return bool: True for success, false for failure. 155 155 */ 156 bool psMetadataAdd(psMetadata * restrict md, ///< Metadata collection to insert metadat item.156 bool psMetadataAdd(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 157 157 int where, ///< Location to be added. 158 158 const char *name, ///< Name of metadata item. … … 171 171 * @return bool: True for success, false for failure. 172 172 */ 173 bool psMetadataRemove(psMetadata * restrict md, ///< Metadata collection to insert metadat item.173 bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 174 174 int where, ///< Location to be removed. 175 175 const char *restrict key ///< Name of metadata key. … … 181 181 * returned. If the item is not found, null is returned. 182 182 * 183 * @return psMetadataItem* : Pointer metadata item.184 */ 185 psMetadataItem *psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat183 * @return psMetadataItem* : Pointer metadata item. 184 */ 185 psMetadataItem* psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat 186 186 // item. 187 187 const char *restrict key ///< Name of metadata key. … … 192 192 * Items may be found in the metadata by their entry position in the list container. 193 193 * 194 * @return psMetadataItem* : Pointer metadata item.195 */ 196 psMetadataItem *psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item.194 * @return psMetadataItem* : Pointer metadata item. 195 */ 196 psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 197 197 int where ///< Location to be retrieved. 198 198 ); … … 204 204 * @return void: void. 205 205 */ 206 bool psMetadataSetIterator(psMetadata * restrict md, ///< Metadata collection to iterate.206 bool psMetadataSetIterator(psMetadata* restrict md, ///< Metadata collection to iterate. 207 207 int where ///< Location of iterator. 208 208 ); … … 212 212 * Get next metadata item in iterator list. 213 213 * 214 * @return psMetadataItem* : Pointer metadata item.215 */ 216 psMetadataItem *psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate.214 * @return psMetadataItem* : Pointer metadata item. 215 */ 216 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate. 217 217 const char *restrict match, ///< Beginning of key name. 218 218 int which ///< Iterator to be used. … … 223 223 * Get previous metadata item in iterator list. 224 224 * 225 * @return psMetadataItem* : Pointer metadata item.226 */ 227 psMetadataItem *psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate.225 * @return psMetadataItem* : Pointer metadata item. 226 */ 227 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate. 228 228 const char *restrict match, ///< Beginning of key name. 229 229 int which ///< Iterator to be used. … … 238 238 * metadata type is any other data type, printing is not allowed. 239 239 * 240 * @return psMetadataItem* : Pointer metadata item.240 * @return psMetadataItem* : Pointer metadata item. 241 241 */ 242 242 void psMetadataItemPrint(FILE * fd, ///< Pointer to file to write metadata item. 243 243 const char *format, ///< Format to print metadata item. 244 const psMetadataItem * restrict metadataItem ///< Metadata item to print.244 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 245 245 ); 246 246 … … 250 250 * unimplemented. 251 251 * 252 * @return psMetadata* : Pointer metadata.253 */ 254 psMetadata *psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read.252 * @return psMetadata* : Pointer metadata. 253 */ 254 psMetadata* psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read. 255 255 char *extname, ///< File name extension string. 256 256 int extnum, ///< File name extension number. Starts at 1. … … 262 262 * Read a metadata header from file. If the file is not found, an error is reported. 263 263 * 264 * @return psMetadata* : Pointer metadata.265 */ 266 psMetadata *psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read.264 * @return psMetadata* : Pointer metadata. 265 */ 266 psMetadata* psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read. 267 267 char *extName, ///< File name extension string. 268 268 int extNum, ///< File name extension number. -
trunk/psLib/src/collections/psArray.c
r1407 r1440 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:57 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 33 33 /*****************************************************************************/ 34 static void arrayFree(psArray * restrict psArr);34 static void arrayFree(psArray* restrict psArr); 35 35 36 36 /*****************************************************************************/ … … 39 39 40 40 /*****************************************************************************/ 41 psArray *psArrayAlloc(unsigned int nalloc)41 psArray* psArrayAlloc(unsigned int nalloc) 42 42 { 43 psArray *psArr = NULL;43 psArray* psArr = NULL; 44 44 45 45 // Invalid nalloc … … 49 49 } 50 50 // Create vector struct 51 psArr = (psArray *) psAlloc(sizeof(psArray));51 psArr = (psArray* ) psAlloc(sizeof(psArray)); 52 52 p_psMemSetDeallocator(psArr, (psFreeFcn) arrayFree); 53 53 … … 61 61 } 62 62 63 psArray *psArrayRealloc(unsigned int nalloc, psArray* restrict in)63 psArray* psArrayRealloc(unsigned int nalloc, psArray* restrict in) 64 64 { 65 65 // Invalid nalloc … … 87 87 } 88 88 89 static void arrayFree(psArray * restrict psArr)89 static void arrayFree(psArray* restrict psArr) 90 90 { 91 91 if (psArr == NULL) { … … 98 98 } 99 99 100 void psArrayElementFree(psArray * restrict psArr)100 void psArrayElementFree(psArray* restrict psArr) 101 101 { 102 102 … … 111 111 } 112 112 113 psArray *psArraySort(psArray* in, psComparePtrFcn compare)113 psArray* psArraySort(psArray* in, psComparePtrFcn compare) 114 114 { 115 115 if (in == NULL) { -
trunk/psLib/src/collections/psArray.h
r1426 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 2 2:44:25$14 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:57 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 36 36 unsigned int nalloc; ///< Total number of elements available. 37 37 unsigned int n; ///< Number of elements in use. 38 psPTR *data; ///< An Array of pointer elements38 psPTR* data; ///< An Array of pointer elements 39 39 } 40 40 psArray; … … 51 51 * data 52 52 * 53 * @return psArray* : Pointer to psArray.53 * @return psArray* : Pointer to psArray. 54 54 * 55 55 */ 56 psArray *psArrayAlloc(unsigned int nalloc ///< Total number of elements to make available.56 psArray* psArrayAlloc(unsigned int nalloc ///< Total number of elements to make available. 57 57 ); 58 58 … … 62 62 * of data. 63 63 * 64 * @return psArray* : Pointer to psArray.64 * @return psArray* : Pointer to psArray. 65 65 * 66 66 */ 67 psArray *psArrayRealloc(unsigned int nalloc, ///< Total number of elements to make available.68 psArray * restrict psArr ///< array to reallocate.67 psArray* psArrayRealloc(unsigned int nalloc, ///< Total number of elements to make available. 68 psArray* restrict psArr ///< array to reallocate. 69 69 ); 70 70 … … 76 76 * 77 77 */ 78 void psArrayElementFree(psArray * restrict psArr ///< Void pointer array to destroy.78 void psArrayElementFree(psArray* restrict psArr ///< Void pointer array to destroy. 79 79 ); 80 80 … … 84 84 * to specify how the objects on the array should be sorted. 85 85 * 86 * @return psArray* The sorted array.86 * @return psArray* The sorted array. 87 87 */ 88 psArray *psArraySort(psArray* in, psComparePtrFcn compare);88 psArray* psArraySort(psArray* in, psComparePtrFcn compare); 89 89 90 90 /// @} -
trunk/psLib/src/collections/psBitSet.c
r1407 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-0 7 00:06:06$13 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 70 70 71 71 /*****************************************************************************/ 72 static void psBitSetFree(psBitSet * restrict inBitSet);72 static void psBitSetFree(psBitSet* restrict inBitSet); 73 73 74 74 /** Private function to create a mask. … … 95 95 96 96 /*****************************************************************************/ 97 psBitSet *psBitSetAlloc(int n)97 psBitSet* psBitSetAlloc(int n) 98 98 { 99 99 int numBytes = 0; 100 psBitSet *newObj = NULL;100 psBitSet* newObj = NULL; 101 101 102 102 if (n <= 0) { … … 125 125 } 126 126 127 static void psBitSetFree(psBitSet * restrict inBitSet)127 static void psBitSetFree(psBitSet* restrict inBitSet) 128 128 { 129 129 if (inBitSet == NULL) { … … 134 134 } 135 135 136 psBitSet *psBitSetSet(psBitSet* inBitSet, int bit)136 psBitSet* psBitSetSet(psBitSet* inBitSet, int bit) 137 137 { 138 138 char *byte = NULL; … … 155 155 } 156 156 157 bool psBitSetTest(const psBitSet * inBitSet, int bit)157 bool psBitSetTest(const psBitSet* inBitSet, int bit) 158 158 { 159 159 char *byte = NULL; … … 178 178 } 179 179 180 psBitSet *psBitSetOp(psBitSet * outBitSet, const psBitSet* restrict inBitSet1, char *operator,181 const psBitSet * restrict inBitSet2)180 psBitSet* psBitSetOp(psBitSet* outBitSet, const psBitSet* restrict inBitSet1, char *operator, 181 const psBitSet* restrict inBitSet2) 182 182 { 183 183 int i = 0; … … 241 241 } 242 242 243 psBitSet *psBitSetNot(psBitSet * outBitSet, const psBitSet* restrict inBitSet)243 psBitSet* psBitSetNot(psBitSet* outBitSet, const psBitSet* restrict inBitSet) 244 244 { 245 245 int i = 0; … … 278 278 } 279 279 280 char *psBitSetToString(const psBitSet * restrict inBitSet)280 char *psBitSetToString(const psBitSet* restrict inBitSet) 281 281 { 282 282 int i = 0; -
trunk/psLib/src/collections/psBitSet.h
r1407 r1440 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-08-0 7 00:06:06$15 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-09 23:34:57 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 * allocation. 57 57 * 58 * @return psBitSet* : Pointer to struct containing array of bits and size of array.58 * @return psBitSet* : Pointer to struct containing array of bits and size of array. 59 59 */ 60 60 61 61 /*@null@*/ 62 62 63 psBitSet *psBitSetAlloc(int n63 psBitSet* psBitSetAlloc(int n 64 64 /**< Number of bits in psBitSet array */ 65 65 ); … … 71 71 * an array with two elements would result in an psBitSet that looks like 00000000 00001000. 72 72 * 73 * @return psBitSet* : Pointer to struct containing psBitSet.73 * @return psBitSet* : Pointer to struct containing psBitSet. 74 74 */ 75 psBitSet *psBitSetSet(75 psBitSet* psBitSetSet( 76 76 77 /* @returned@ */ psBitSet * restrict inMask,77 /* @returned@ */ psBitSet* restrict inMask, 78 78 /**< Pointer to psBitSet to be set. */ 79 79 … … 91 91 */ 92 92 93 bool psBitSetTest(const psBitSet * restrict inMask,93 bool psBitSetTest(const psBitSet* restrict inMask, 94 94 /**< Pointer psBitSet to be tested. */ 95 95 … … 102 102 * be performed and an error message will be logged. 103 103 * 104 * @return psBitSet* : Pointer to struct containing result of binary operation.104 * @return psBitSet* : Pointer to struct containing result of binary operation. 105 105 */ 106 psBitSet *psBitSetOp(106 psBitSet* psBitSetOp( 107 107 108 /* @returned@ */ psBitSet * restrict outMask,108 /* @returned@ */ psBitSet* restrict outMask, 109 109 /**< Resulting psBitSet from binary operation */ 110 110 111 const psBitSet * restrict inMask1,111 const psBitSet* restrict inMask1, 112 112 /**< First psBitSet on which to operate */ 113 113 114 114 char *operator, /**< Bit operation */ 115 115 116 const psBitSet * restrict inMask2116 const psBitSet* restrict inMask2 117 117 /**< First psBitSet on which to operate */ 118 118 ); … … 122 122 * Toggles bits in a psBitset. All zero bits are set to one and all one bits are set to zero. 123 123 * 124 * @return psBitSet* : Pointer to struct containing result of operation.124 * @return psBitSet* : Pointer to struct containing result of operation. 125 125 */ 126 126 127 psBitSet *psBitSetNot(psBitSet* outBitSet,127 psBitSet* psBitSetNot(psBitSet* outBitSet, 128 128 /**< Resulting psBitSet from operation */ 129 129 130 const psBitSet * restrict inBitSet130 const psBitSet* restrict inBitSet 131 131 /**< Input psBitSet */ 132 132 ); … … 140 140 */ 141 141 142 char *psBitSetToString(const psBitSet * restrict inMask142 char *psBitSetToString(const psBitSet* restrict inMask 143 143 /**< psBitSet to convert */ 144 144 ); -
trunk/psLib/src/collections/psHash.c
r1420 r1440 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 0:29:43$13 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 #include "psAbort.h" 27 27 28 static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket* next);29 static void hashBucketFree(psHashBucket * bucket);30 static void *doHashWork(psHash * table, const char *key, void *data, bool remove28 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next); 29 static void hashBucketFree(psHashBucket* bucket); 30 static void *doHashWork(psHash* table, const char *key, void *data, bool remove 31 31 ); 32 static void hashFree(psHash * table);32 static void hashFree(psHash* table); 33 33 34 34 /****************************************************************************** … … 40 40 The linked list 41 41 *****************************************************************************/ 42 psList *psHashKeyList(psHash* table)42 psList* psHashKeyList(psHash* table) 43 43 { 44 44 int i = 0; // Loop index variable 45 psList *myLinkList = NULL; // The output data structure46 psHashBucket *ptr = NULL; // Used to step thru linked list.45 psList* myLinkList = NULL; // The output data structure 46 psHashBucket* ptr = NULL; // Used to step thru linked list. 47 47 48 48 if (table == NULL) { … … 81 81 the new hash bucket. 82 82 *****************************************************************************/ 83 static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket* next)83 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next) 84 84 { 85 85 if (key == NULL) { … … 87 87 } 88 88 // Allocate memory for the new hash bucket. 89 psHashBucket *bucket = psAlloc(sizeof(psHashBucket));89 psHashBucket* bucket = psAlloc(sizeof(psHashBucket)); 90 90 91 91 p_psMemSetDeallocator(bucket, (psFreeFcn) hashBucketFree); … … 114 114 NONE 115 115 *****************************************************************************/ 116 static void hashBucketFree(psHashBucket * bucket)116 static void hashBucketFree(psHashBucket* bucket) 117 117 { 118 118 if (bucket == NULL) { … … 133 133 The new hash table. 134 134 *****************************************************************************/ 135 psHash *psHashAlloc(int nbucket) // initial number of buckets135 psHash* psHashAlloc(int nbucket) // initial number of buckets 136 136 { 137 137 int i = 0; // loop index variable 138 138 139 139 // Create the new hash table. 140 psHash *table = psAlloc(sizeof(psHash));140 psHash* table = psAlloc(sizeof(psHash)); 141 141 142 142 p_psMemSetDeallocator(table, (psFreeFcn) hashFree); 143 143 144 144 // Allocate memory for the buckets. 145 table->buckets = psAlloc(nbucket * sizeof(psHashBucket *));145 table->buckets = psAlloc(nbucket * sizeof(psHashBucket* )); 146 146 table->nbucket = nbucket; 147 147 … … 168 168 NONE 169 169 *****************************************************************************/ 170 static void hashFree(psHash * table)170 static void hashFree(psHash* table) 171 171 { 172 172 int i = 0; // Loop index variable. … … 210 210 there is little common code between those functions. 211 211 *****************************************************************************/ 212 static void *doHashWork(psHash * table, const char *key, void *data, bool remove212 static void *doHashWork(psHash* table, const char *key, void *data, bool remove 213 213 ) 214 214 { … … 217 217 // "hashed" from the key. 218 218 char *tmpchar = NULL; // Used in computing the hash function. 219 psHashBucket *ptr = NULL; // Used to retrieve the hash bucket.220 psHashBucket *optr = NULL; // "original pointer": used to step219 psHashBucket* ptr = NULL; // Used to retrieve the hash bucket. 220 psHashBucket* optr = NULL; // "original pointer": used to step 221 221 222 222 // thru the linked list for a bucket. … … 338 338 boolean value defining success or failure 339 339 *****************************************************************************/ 340 bool psHashAdd(psHash * table, const char *key, void *data)340 bool psHashAdd(psHash* table, const char *key, void *data) 341 341 { 342 342 if (table == NULL) { … … 364 364 The data associated with that key. 365 365 *****************************************************************************/ 366 void *psHashLookup(psHash * table, // table to lookup key in366 void *psHashLookup(psHash* table, // table to lookup key in 367 367 const char *key) // key to lookup 368 368 { … … 387 387 boolean value defining success or failure 388 388 *****************************************************************************/ 389 bool psHashRemove(psHash * table, const char *key)389 bool psHashRemove(psHash* table, const char *key) 390 390 { 391 391 void *data = NULL; -
trunk/psLib/src/collections/psHash.h
r1426 r1440 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 char *key; ///< key for this item of data 32 32 void *data; ///< the data itself 33 struct psHashBucket *next; ///< list of other possible keys33 struct psHashBucket* next; ///< list of other possible keys 34 34 } 35 35 psHashBucket; … … 41 41 { 42 42 int nbucket; ///< Number of buckets in hash table. 43 psHashBucket **buckets; ///< The bucket data.43 psHashBucket* *buckets; ///< The bucket data. 44 44 } 45 45 psHash; 46 46 47 47 /// Allocate hash buckets in table. 48 psHash *psHashAlloc(int nbucket ///< The number of buckets to allocate.48 psHash* psHashAlloc(int nbucket ///< The number of buckets to allocate. 49 49 ); 50 50 51 51 /// Insert entry into table. 52 bool psHashAdd(psHash * table, ///< table to insert in52 bool psHashAdd(psHash* table, ///< table to insert in 53 53 const char *key, ///< key to use 54 54 void *data ///< data to insert … … 56 56 57 57 /// Lookup key in table. 58 void *psHashLookup(psHash * table, ///< table to lookup key in58 void *psHashLookup(psHash* table, ///< table to lookup key in 59 59 const char *key ///< key to lookup 60 60 ); 61 61 62 62 /// Remove key from table. 63 bool psHashRemove(psHash * table, ///< table to lookup key in63 bool psHashRemove(psHash* table, ///< table to lookup key in 64 64 const char *key ///< key to lookup 65 65 ); 66 66 67 67 /// List all keys in table. 68 psList *psHashKeyList(psHash* table ///< table to list keys from.68 psList* psHashKeyList(psHash* table ///< table to list keys from. 69 69 ); 70 70 -
trunk/psLib/src/collections/psList.c
r1407 r1440 7 7 * @author Robert Daniel DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-08-0 7 00:06:06$9 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-08-09 23:34:57 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 30 30 // private functions. 31 static psListElem *listGetIterator(psList* list);32 static int listGetIteratorIndex(psList * list);33 static void listSetIterator(psList * list, int where, bool lockList);34 static void listFree(psList * list);35 36 psList *psListAlloc(void *data)37 { 38 psList *list = psAlloc(sizeof(psList));31 static psListElem* listGetIterator(psList* list); 32 static int listGetIteratorIndex(psList* list); 33 static void listSetIterator(psList* list, int where, bool lockList); 34 static void listFree(psList* list); 35 36 psList* psListAlloc(void *data) 37 { 38 psList* list = psAlloc(sizeof(psList)); 39 39 40 40 p_psMemSetDeallocator(list, (psFreeFcn) listFree); … … 55 55 } 56 56 57 static void listFree(psList * list)57 static void listFree(psList* list) 58 58 { 59 59 if (list == NULL) { … … 64 64 ; 65 65 66 for (psListElem * ptr = list->head; ptr != NULL;) {67 psListElem *next = ptr->next;66 for (psListElem* ptr = list->head; ptr != NULL;) { 67 psListElem* next = ptr->next; 68 68 69 69 psFree(ptr->data); … … 81 81 } 82 82 83 bool psListAdd(psList * list, void *data, int where)84 { 85 psListElem *position;86 psListElem *elem;83 bool psListAdd(psList* list, void *data, int where) 84 { 85 psListElem* position; 86 psListElem* elem; 87 87 int cursorIndex = 0; 88 88 … … 168 168 * Remove an element from a list 169 169 */ 170 bool psListRemove(psList * list, void *data, int which)171 { 172 psListElem *elem = NULL; // element to remove170 bool psListRemove(psList* list, void *data, int which) 171 { 172 psListElem* elem = NULL; // element to remove 173 173 int cursorIndex = 0; 174 174 … … 186 186 int i = 0; // index 187 187 188 for (psListElem * ptr = list->head; ptr != NULL; ptr = ptr->next) {188 for (psListElem* ptr = list->head; ptr != NULL; ptr = ptr->next) { 189 189 if (ptr->data == data) { 190 190 which = i; … … 243 243 } 244 244 245 void psListSetIterator(psList * list, int where)245 void psListSetIterator(psList* list, int where) 246 246 { 247 247 listSetIterator(list, where, true); 248 248 } 249 249 250 void listSetIterator(psList * list, int where, bool lockList)251 { 252 psListElem *cursor;250 void listSetIterator(psList* list, int where, bool lockList) 251 { 252 psListElem* cursor; 253 253 int position; 254 254 … … 340 340 } 341 341 342 psListElem *listGetIterator(psList* list)342 psListElem* listGetIterator(psList* list) 343 343 { 344 344 if (list == NULL) { … … 355 355 } 356 356 357 int listGetIteratorIndex(psList * list)357 int listGetIteratorIndex(psList* list) 358 358 { 359 359 if (list->iter == ITER_INIT_HEAD) { … … 366 366 } 367 367 368 void *psListGet(psList * list, int which)369 { 370 psListElem *element;368 void *psListGet(psList* list, int which) 369 { 370 psListElem* element; 371 371 372 372 psListSetIterator(list, which); … … 383 383 * and now return the previous/next element of the list 384 384 */ 385 void *psListGetNext(psList * list)385 void *psListGetNext(psList* list) 386 386 { 387 387 return psListGet(list, PS_LIST_NEXT); 388 388 } 389 389 390 void *psListGetPrevious(psList * list)390 void *psListGetPrevious(psList* list) 391 391 { 392 392 return psListGet(list, PS_LIST_PREVIOUS); 393 393 } 394 394 395 void *psListGetCurrent(psList * list)395 void *psListGetCurrent(psList* list) 396 396 { 397 397 return psListGet(list, PS_LIST_CURRENT); … … 401 401 * Convert a psList to/from a psVoidPtrArray 402 402 */ 403 psArray *psListToArray(psList* restrict list)404 { 405 psListElem *ptr;403 psArray* psListToArray(psList* restrict list) 404 { 405 psListElem* ptr; 406 406 unsigned int n; 407 psArray *restrict arr;407 psArray* restrict arr; 408 408 409 409 if (list == NULL) { … … 429 429 } 430 430 431 psList *psArrayToList(psArray* arr)431 psList* psArrayToList(psArray* arr) 432 432 { 433 433 unsigned int n; 434 psList *list; // list of elements434 psList* list; // list of elements 435 435 436 436 if (arr == NULL) { … … 447 447 } 448 448 449 psList *psListSort(psList* list, psComparePtrFcn compare)450 { 451 psArray *arr;449 psList* psListSort(psList* list, psComparePtrFcn compare) 450 { 451 psArray* arr; 452 452 453 453 if (list == NULL) { -
trunk/psLib/src/collections/psList.h
r1426 r1440 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:57 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 44 44 typedef struct psListElem 45 45 { 46 struct psListElem *prev; ///< previous link in list47 struct psListElem *next; ///< next link in list46 struct psListElem* prev; ///< previous link in list 47 struct psListElem* next; ///< next link in list 48 48 void *data; ///< real data item 49 49 } … … 58 58 { 59 59 unsigned int size; ///< number of elements on list 60 psListElem *head; ///< first element on list (may be NULL)61 psListElem *tail; ///< last element on list (may be NULL)62 psListElem *iter; ///< iteration cursor60 psListElem* head; ///< first element on list (may be NULL) 61 psListElem* tail; ///< last element on list (may be NULL) 62 psListElem* iter; ///< iteration cursor 63 63 unsigned int iterIndex; ///< the numeric position of the iteration cursor in the list 64 64 pthread_mutex_t lock; ///< mutex to lock a node during changes … … 68 68 /** Creates a psList linked list object. 69 69 * 70 * @return psList* A new psList object.70 * @return psList* A new psList object. 71 71 */ 72 psList *psListAlloc(void *data72 psList* psListAlloc(void *data 73 73 ///< initial data item; may be NULL if no an empty psList is desired 74 74 ) … … 77 77 /** Adds an element to a psList at position given. 78 78 * 79 * @return psList* The psList with added data item. If list parameter is79 * @return psList* The psList with added data item. If list parameter is 80 80 * NULL, the return value will also be NULL. 81 81 */ 82 bool psListAdd(psList * restrict list, ///< list to add to (if NULL, nothing is done)82 bool psListAdd(psList* restrict list, ///< list to add to (if NULL, nothing is done) 83 83 void *data, ///< data item to add. If NULL, list is not modified. 84 84 int where ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location. … … 89 89 * @return bool TRUE if element is successfully removed, otherwise FALSE. 90 90 */ 91 bool psListRemove(psList * restrict list,91 bool psListRemove(psList* restrict list, 92 92 ///< list to remove element from 93 93 void *data, … … 104 104 * NULL is returned. 105 105 */ 106 void *psListGet(psList * restrict list, ///< list to retrieve element from106 void *psListGet(psList* restrict list, ///< list to retrieve element from 107 107 int which ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN 108 108 ); … … 112 112 * 113 113 */ 114 void psListSetIterator(psList * restrict list, ///< list to retrieve element from114 void psListSetIterator(psList* restrict list, ///< list to retrieve element from 115 115 int where ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL 116 116 ); … … 123 123 * parameter was NULL. 124 124 */ 125 void *psListGetNext(psList * restrict list ///< list to retrieve element from125 void *psListGetNext(psList* restrict list ///< list to retrieve element from 126 126 ); 127 127 … … 133 133 * iterator is not valid or list parameter was NULL. 134 134 */ 135 void *psListGetCurrent(psList * restrict list ///< list to retrieve element from135 void *psListGetCurrent(psList* restrict list ///< list to retrieve element from 136 136 ); 137 137 … … 143 143 * parameter was NULL. 144 144 */ 145 void *psListGetPrevious(psList * restrict list ///< list to retrieve element from145 void *psListGetPrevious(psList* restrict list ///< list to retrieve element from 146 146 ); 147 147 148 148 /** Convert a linked list to an array 149 149 * 150 * @return psArray* A new psArray populated with elements from the list,150 * @return psArray* A new psArray populated with elements from the list, 151 151 * or NULL if the given dlist parameter is NULL. 152 152 */ 153 psArray *psListToArray(psList* dlist ///< List to convert153 psArray* psListToArray(psList* dlist ///< List to convert 154 154 ); 155 155 156 156 /** Convert array to a doubly-linked list 157 157 * 158 * @return psList* A new psList populated with elements formt the psArray,158 * @return psList* A new psList populated with elements formt the psArray, 159 159 * or NULL is the given arr parameter is NULL. 160 160 */ 161 psList *psArrayToList(psArray* arr ///< vector to convert161 psList* psArrayToList(psArray* arr ///< vector to convert 162 162 ); 163 163 164 psList *psListSort(psList* list, psComparePtrFcn compare);164 psList* psListSort(psList* list, psComparePtrFcn compare); 165 165 166 166 /// @} End of DataGroup Functions -
trunk/psLib/src/collections/psMetadata.c
r1432 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 23: 06:10$14 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:57 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 89 89 /*****************************************************************************/ 90 static void metadataItemFree(psMetadataItem * metadataItem)90 static void metadataItemFree(psMetadataItem* metadataItem) 91 91 { 92 92 psMetadataType type; … … 109 109 } 110 110 111 static void metadataFree(psMetadata * metadata)111 static void metadataFree(psMetadata* metadata) 112 112 { 113 113 if (metadata == NULL) { … … 124 124 /*****************************************************************************/ 125 125 126 psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)126 psMetadataItem* psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...) 127 127 { 128 128 va_list argPtr; 129 psMetadataItem *metadataItem = NULL;129 psMetadataItem* metadataItem = NULL; 130 130 131 131 // Get the variable list parameters to pass to allocation function … … 141 141 } 142 142 143 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,143 psMetadataItem* psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment, 144 144 va_list argPtr) 145 145 { 146 psMetadataItem *metadataItem = NULL;146 psMetadataItem* metadataItem = NULL; 147 147 148 148 if (name == NULL) { … … 151 151 } 152 152 // Allocate metadata item 153 metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));153 metadataItem = (psMetadataItem* ) psAlloc(sizeof(psMetadataItem)); 154 154 if (metadataItem == NULL) { 155 155 psAbort(__func__, "Failed to allocate memory"); … … 211 211 } 212 212 213 psMetadata *psMetadataAlloc(void)214 { 215 psList *list = NULL;216 psHash *table = NULL;217 psMetadata *metadata = NULL;213 psMetadata* psMetadataAlloc(void) 214 { 215 psList* list = NULL; 216 psHash* table = NULL; 217 psMetadata* metadata = NULL; 218 218 219 219 // Allocate metadata 220 metadata = (psMetadata *) psAlloc(sizeof(psMetadata));220 metadata = (psMetadata* ) psAlloc(sizeof(psMetadata)); 221 221 if (metadata == NULL) { 222 222 psAbort(__func__, "Failed to allocate metadata"); … … 226 226 227 227 // Allocate metadata's internal containers 228 list = (psList *) psListAlloc(NULL);228 list = (psList* ) psListAlloc(NULL); 229 229 if (list == NULL) { 230 230 psAbort(__func__, "Failed to allocate list"); 231 231 } 232 232 233 table = (psHash *) psHashAlloc(10);233 table = (psHash* ) psHashAlloc(10); 234 234 if (table == NULL) { 235 235 psAbort(__func__, "Failed to allocate table"); … … 242 242 } 243 243 244 bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem* restrict metadataItem)244 bool psMetadataAddItem(psMetadata* restrict md, int where, psMetadataItem* restrict metadataItem) 245 245 { 246 246 char *key = NULL; 247 psHash *mdTable = NULL;248 psList *mdList = NULL;249 psMetadataItem *value = NULL;247 psHash* mdTable = NULL; 248 psList* mdList = NULL; 249 psMetadataItem* value = NULL; 250 250 psMetadataType type = PS_META_ITEM_SET; 251 251 … … 280 280 } 281 281 // Check if key is already in table 282 value = (psMetadataItem *) psHashLookup(mdTable, key);282 value = (psMetadataItem* ) psHashLookup(mdTable, key); 283 283 if (value != NULL && type != PS_META_ITEM_SET) { 284 284 … … 316 316 } 317 317 318 bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,318 bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type, 319 319 const char *comment, ...) 320 320 { 321 321 va_list argPtr; 322 psMetadataItem *metadataItem = NULL;322 psMetadataItem* metadataItem = NULL; 323 323 324 324 va_start(argPtr, comment); … … 339 339 } 340 340 341 bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)341 bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key) 342 342 { 343 343 int numChildren = 0; 344 psList *mdList = NULL;345 psHash *mdTable = NULL;346 psMetadataItem *entry = NULL;347 psMetadataItem *entryChild = NULL;344 psList* mdList = NULL; 345 psHash* mdTable = NULL; 346 psMetadataItem* entry = NULL; 347 psMetadataItem* entryChild = NULL; 348 348 349 349 … … 368 368 369 369 // Remove by key name 370 entry = (psMetadataItem *) psHashLookup(mdTable, key);370 entry = (psMetadataItem* ) psHashLookup(mdTable, key); 371 371 if (entry == NULL) { 372 372 psError(__func__, "Couldn't find metadata item. Name: %s", key); … … 419 419 } 420 420 421 psMetadataItem *psMetadataLookup(psMetadata* restrict md, const char *restrict key)422 { 423 psHash *mdTable = NULL;424 psMetadataItem *entry = NULL;421 psMetadataItem* psMetadataLookup(psMetadata* restrict md, const char *restrict key) 422 { 423 psHash* mdTable = NULL; 424 psMetadataItem* entry = NULL; 425 425 426 426 … … 441 441 } 442 442 443 entry = (psMetadataItem *) psHashLookup(mdTable, key);443 entry = (psMetadataItem* ) psHashLookup(mdTable, key); 444 444 if (entry == NULL) { 445 445 psError(__func__, "Could not find metadata item. Key: %s", key); … … 450 450 } 451 451 452 psMetadataItem *psMetadataGet(psMetadata* restrict md, int where)453 { 454 psList *mdList = NULL;455 psMetadataItem *entry = NULL;452 psMetadataItem* psMetadataGet(psMetadata* restrict md, int where) 453 { 454 psList* mdList = NULL; 455 psMetadataItem* entry = NULL; 456 456 457 457 … … 467 467 } 468 468 469 entry = (psMetadataItem *) psListGet(mdList, where);469 entry = (psMetadataItem* ) psListGet(mdList, where); 470 470 if (entry == NULL) { 471 471 psError(__func__, "Couldn't find metadata item with given index. Index: %d", where); … … 476 476 } 477 477 478 bool psMetadataSetIterator(psMetadata * restrict md, int where)479 { 480 psList *mdList = NULL;478 bool psMetadataSetIterator(psMetadata* restrict md, int where) 479 { 480 psList* mdList = NULL; 481 481 482 482 if (md == NULL) { … … 496 496 } 497 497 498 psMetadataItem *psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)499 { 500 psList *mdList = NULL;501 psMetadataItem *entry = NULL;498 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which) 499 { 500 psList* mdList = NULL; 501 psMetadataItem* entry = NULL; 502 502 503 503 mdList = md->list; … … 532 532 } 533 533 534 psMetadataItem *psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)535 { 536 psList *mdList = NULL;537 psMetadataItem *entry = NULL;534 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which) 535 { 536 psList* mdList = NULL; 537 psMetadataItem* entry = NULL; 538 538 539 539 mdList = md->list; … … 568 568 } 569 569 570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem* restrict metadataItem) 571 571 { 572 572 psMetadataType type; … … 616 616 } 617 617 618 psMetadata *psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd)618 psMetadata* psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd) 619 619 { 620 620 bool tempBool; -
trunk/psLib/src/collections/psMetadata.h
r1426 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 66 66 } data; ///< Union for data types. 67 67 char *comment; ///< Optional comment ("", not NULL). 68 psList *restrict items; ///< List of psMetadataItems with same name.68 psList* restrict items; ///< List of psMetadataItems with same name. 69 69 } 70 70 psMetadataItem; … … 78 78 typedef struct psMetadata 79 79 { 80 psList *restrict list;81 psHash *restrict table;80 psList* restrict list; 81 psHash* restrict table; 82 82 } 83 83 psMetadata; … … 100 100 * specified size and type. 101 101 * 102 * @return psMetadataItem* : Pointer metadata item.103 */ 104 psMetadataItem *psMetadataItemAlloc(const char *name, ///< Name of metadata item.102 * @return psMetadataItem* : Pointer metadata item. 103 */ 104 psMetadataItem* psMetadataItemAlloc(const char *name, ///< Name of metadata item. 105 105 psMetadataType type, ///< Type of metadata item. 106 106 const char *comment, ///< Comment for metadata item. … … 119 119 * specified size and type. 120 120 * 121 * @return psMetadataItem* : Pointer metadata item.122 */ 123 psMetadataItem *psMetadataItemAllocV(const char *name, ///< Name of metadata item.121 * @return psMetadataItem* : Pointer metadata item. 122 */ 123 psMetadataItem* psMetadataItemAllocV(const char *name, ///< Name of metadata item. 124 124 psMetadataType type, ///< Type of metadata item. 125 125 const char *comment, ///< Comment for metadata item. … … 132 132 * Returns an empty metadata container with fully allocated internal metadata containers. 133 133 * 134 * @return psMetadata* : Pointer metadata.135 */ 136 psMetadata *psMetadataAlloc(void ///< Void.134 * @return psMetadata* : Pointer metadata. 135 */ 136 psMetadata* psMetadataAlloc(void ///< Void. 137 137 ); 138 138 … … 143 143 * @return bool: True for success, false for failure. 144 144 */ 145 bool psMetadataAddItem(psMetadata * restrict md, ///< Metadata collection to insert metadat item.145 bool psMetadataAddItem(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 146 146 int where, ///< Location to be added. 147 psMetadataItem * restrict item ///< Metadata item to be added.147 psMetadataItem* restrict item ///< Metadata item to be added. 148 148 ); 149 149 … … 154 154 * @return bool: True for success, false for failure. 155 155 */ 156 bool psMetadataAdd(psMetadata * restrict md, ///< Metadata collection to insert metadat item.156 bool psMetadataAdd(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 157 157 int where, ///< Location to be added. 158 158 const char *name, ///< Name of metadata item. … … 171 171 * @return bool: True for success, false for failure. 172 172 */ 173 bool psMetadataRemove(psMetadata * restrict md, ///< Metadata collection to insert metadat item.173 bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 174 174 int where, ///< Location to be removed. 175 175 const char *restrict key ///< Name of metadata key. … … 181 181 * returned. If the item is not found, null is returned. 182 182 * 183 * @return psMetadataItem* : Pointer metadata item.184 */ 185 psMetadataItem *psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat183 * @return psMetadataItem* : Pointer metadata item. 184 */ 185 psMetadataItem* psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat 186 186 // item. 187 187 const char *restrict key ///< Name of metadata key. … … 192 192 * Items may be found in the metadata by their entry position in the list container. 193 193 * 194 * @return psMetadataItem* : Pointer metadata item.195 */ 196 psMetadataItem *psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item.194 * @return psMetadataItem* : Pointer metadata item. 195 */ 196 psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 197 197 int where ///< Location to be retrieved. 198 198 ); … … 204 204 * @return void: void. 205 205 */ 206 bool psMetadataSetIterator(psMetadata * restrict md, ///< Metadata collection to iterate.206 bool psMetadataSetIterator(psMetadata* restrict md, ///< Metadata collection to iterate. 207 207 int where ///< Location of iterator. 208 208 ); … … 212 212 * Get next metadata item in iterator list. 213 213 * 214 * @return psMetadataItem* : Pointer metadata item.215 */ 216 psMetadataItem *psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate.214 * @return psMetadataItem* : Pointer metadata item. 215 */ 216 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate. 217 217 const char *restrict match, ///< Beginning of key name. 218 218 int which ///< Iterator to be used. … … 223 223 * Get previous metadata item in iterator list. 224 224 * 225 * @return psMetadataItem* : Pointer metadata item.226 */ 227 psMetadataItem *psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate.225 * @return psMetadataItem* : Pointer metadata item. 226 */ 227 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate. 228 228 const char *restrict match, ///< Beginning of key name. 229 229 int which ///< Iterator to be used. … … 238 238 * metadata type is any other data type, printing is not allowed. 239 239 * 240 * @return psMetadataItem* : Pointer metadata item.240 * @return psMetadataItem* : Pointer metadata item. 241 241 */ 242 242 void psMetadataItemPrint(FILE * fd, ///< Pointer to file to write metadata item. 243 243 const char *format, ///< Format to print metadata item. 244 const psMetadataItem * restrict metadataItem ///< Metadata item to print.244 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 245 245 ); 246 246 … … 250 250 * unimplemented. 251 251 * 252 * @return psMetadata* : Pointer metadata.253 */ 254 psMetadata *psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read.252 * @return psMetadata* : Pointer metadata. 253 */ 254 psMetadata* psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read. 255 255 char *extname, ///< File name extension string. 256 256 int extnum, ///< File name extension number. Starts at 1. … … 262 262 * Read a metadata header from file. If the file is not found, an error is reported. 263 263 * 264 * @return psMetadata* : Pointer metadata.265 */ 266 psMetadata *psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read.264 * @return psMetadata* : Pointer metadata. 265 */ 266 psMetadata* psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read. 267 267 char *extName, ///< File name extension string. 268 268 int extNum, ///< File name extension number. -
trunk/psLib/src/collections/psScalar.c
r1407 r1440 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:57 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 71 71 72 72 /*****************************************************************************/ 73 psScalar *psScalarAlloc(psC64 value, psElemType dataType)73 psScalar* psScalarAlloc(psC64 value, psElemType dataType) 74 74 { 75 psScalar *scalar = NULL;75 psScalar* scalar = NULL; 76 76 77 77 // Create scalar 78 scalar = (psScalar *) psAlloc(sizeof(psScalar));78 scalar = (psScalar* ) psAlloc(sizeof(psScalar)); 79 79 if (scalar == NULL) { 80 80 psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__); … … 128 128 } 129 129 130 void psScalarFree(psScalar * restrict scalar)130 void psScalarFree(psScalar* restrict scalar) 131 131 { 132 132 if (scalar == NULL) { -
trunk/psLib/src/collections/psScalar.h
r1426 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 62 62 * Accepts a complex 64 bit float for input value, as max size, but resizes according to 63 63 * correct type. 64 * @return psScalar* : Pointer to psScalar.64 * @return psScalar* : Pointer to psScalar. 65 65 * 66 66 */ 67 psScalar *psScalarAlloc(psC64 value, ///< Data to be put into psScalar.67 psScalar* psScalarAlloc(psC64 value, ///< Data to be put into psScalar. 68 68 psElemType dataType ///< Type of data to be held by psScalar. 69 69 ); … … 76 76 * 77 77 */ 78 void psScalarFree(psScalar * restrict scalar ///< Scalar to free.78 void psScalarFree(psScalar* restrict scalar ///< Scalar to free. 79 79 ); 80 80 -
trunk/psLib/src/collections/psVector.c
r1407 r1440 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:57 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 68 68 /*****************************************************************************/ 69 static void vectorFree(psVector * restrict psVec);69 static void vectorFree(psVector* restrict psVec); 70 70 71 71 /*****************************************************************************/ … … 74 74 75 75 /*****************************************************************************/ 76 psVector *psVectorAlloc(unsigned int nalloc, psElemType elemType)77 { 78 psVector *psVec = NULL;76 psVector* psVectorAlloc(unsigned int nalloc, psElemType elemType) 77 { 78 psVector* psVec = NULL; 79 79 int elementSize = 0; 80 80 … … 88 88 89 89 // Create vector struct 90 psVec = (psVector *) psAlloc(sizeof(psVector));90 psVec = (psVector* ) psAlloc(sizeof(psVector)); 91 91 p_psMemSetDeallocator(psVec, (psFreeFcn) vectorFree); 92 92 … … 102 102 } 103 103 104 psVector *psVectorRealloc(unsigned int nalloc, psVector* restrict in)104 psVector* psVectorRealloc(unsigned int nalloc, psVector* restrict in) 105 105 { 106 106 int elementSize = 0; … … 130 130 } 131 131 132 psVector *psVectorRecycle(psVector* restrict in, unsigned int nalloc, psElemType type)132 psVector* psVectorRecycle(psVector* restrict in, unsigned int nalloc, psElemType type) 133 133 { 134 134 psElemType elemType; … … 160 160 } 161 161 162 psVector *psVectorSort(psVector * restrict outVector, const psVector* restrict inVector)162 psVector* psVectorSort(psVector* restrict outVector, const psVector* restrict inVector) 163 163 { 164 164 int inN = 0; … … 261 261 } 262 262 263 psVector *psVectorSortIndex(psVector * restrict outVector, const psVector* restrict inVector)263 psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector) 264 264 { 265 265 int inN = 0; … … 270 270 int *outVec = NULL; 271 271 double diff = 0.0f; 272 psVector *tmpVector = NULL;272 psVector* tmpVector = NULL; 273 273 psElemType inType = 0; 274 274 … … 348 348 } 349 349 350 static void vectorFree(psVector * restrict psVec)350 static void vectorFree(psVector* restrict psVec) 351 351 { 352 352 if (psVec == NULL) { -
trunk/psLib/src/collections/psVector.h
r1426 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 2 2:44:25$14 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:57 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 38 38 39 39 union { 40 psU8 *U8; ///< Unsigned 8-bit integer data.41 psU16 *U16; ///< Unsigned 16-bit integer data.42 psU32 *U32; ///< Unsigned 32-bit integer data.43 psU64 *U64; ///< Unsigned 64-bit integer data.44 psS8 *S8; ///< Signed 8-bit integer data.45 psS16 *S16; ///< Signed 16-bit integer data.46 psS32 *S32; ///< Signed 32-bit integer data.47 psS64 *S64; ///< Signed 64-bit integer data.48 psF32 *F32; ///< Single-precision float data.49 psF64 *F64; ///< Double-precision float data.50 psC32 *C32; ///< Single-precision complex data.51 psC64 *C64; ///< Double-precision complex data.40 psU8* U8; ///< Unsigned 8-bit integer data. 41 psU16* U16; ///< Unsigned 16-bit integer data. 42 psU32* U32; ///< Unsigned 32-bit integer data. 43 psU64* U64; ///< Unsigned 64-bit integer data. 44 psS8* S8; ///< Signed 8-bit integer data. 45 psS16* S16; ///< Signed 16-bit integer data. 46 psS32* S32; ///< Signed 32-bit integer data. 47 psS64* S64; ///< Signed 64-bit integer data. 48 psF32* F32; ///< Single-precision float data. 49 psF64* F64; ///< Double-precision float data. 50 psC32* C32; ///< Single-precision complex data. 51 psC64* C64; ///< Double-precision complex data. 52 52 psPTR V; ///< Pointer to data. 53 53 } data; ///< Union for data types. … … 65 65 * Uses psLib memory allocation functions to create a vector collection of data as defined by the psType type. 66 66 * 67 * @return psVector* : Pointer to psVector.67 * @return psVector* : Pointer to psVector. 68 68 * 69 69 */ 70 psVector *psVectorAlloc(unsigned int nalloc, ///< Total number of elements to make available.70 psVector* psVectorAlloc(unsigned int nalloc, ///< Total number of elements to make available. 71 71 psElemType dataType ///< Type of data to be held by vector. 72 72 ); … … 77 77 * according to the psType type member contained within the vector. 78 78 * 79 * @return psVector* : Pointer to psVector.79 * @return psVector* : Pointer to psVector. 80 80 * 81 81 */ 82 psVector *psVectorRealloc(unsigned int nalloc, ///< Total number of elements to make available.83 psVector * restrict psVec ///< Vector to reallocate.82 psVector* psVectorRealloc(unsigned int nalloc, ///< Total number of elements to make available. 83 psVector* restrict psVec ///< Vector to reallocate. 84 84 ); 85 85 … … 89 89 * according to the psElemType type parameter. 90 90 * 91 * @return psVector* : Pointer to psVector.91 * @return psVector* : Pointer to psVector. 92 92 * 93 93 */ 94 psVector *psVectorRecycle(psVector* restrict psVec,94 psVector* psVectorRecycle(psVector* restrict psVec, 95 95 ///< Vector to recycle. If NULL, a new vector is created. No effort taken to 96 96 // preserve the values. … … 104 104 * all non-complex data types. 105 105 * 106 * @return psFloatArray* : Pointer to sorted psFloatArray.106 * @return psFloatArray* : Pointer to sorted psFloatArray. 107 107 */ 108 108 109 psVector *psVectorSort(psVector* restrict outVector, ///< the output vector to recycle, or NULL if new109 psVector* psVectorSort(psVector* restrict outVector, ///< the output vector to recycle, or NULL if new 110 110 // vector desired. 111 const psVector * restrict inVector ///< the vector to sort.111 const psVector* restrict inVector ///< the vector to sort. 112 112 ); 113 113 … … 117 117 * sorted float values based on pre-sort index positions. 118 118 * 119 * @return psIntArray* : Pointer to psIntArray of sorted indices.119 * @return psIntArray* : Pointer to psIntArray of sorted indices. 120 120 */ 121 121 122 psVector *psVectorSortIndex(psVector * restrict outVector, const psVector* restrict inVector);122 psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector); 123 123 124 124 /// @} -
trunk/psLib/src/dataManip/psFFT.c
r1407 r1440 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-08-0 7 00:06:06$8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-08-09 23:34:57 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static bool p_fftwWisdomImported = false; 29 29 30 psImage *psImageFFT(psImage * out, const psImage* in, psFftDirection direction)30 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction) 31 31 { 32 32 unsigned int numCols; … … 93 93 } 94 94 95 psImage *psImageReal(psImage * out, const psImage* in)95 psImage* psImageReal(psImage* out, const psImage* in) 96 96 { 97 97 psElemType type; … … 117 117 118 118 if (type == PS_TYPE_C32) { 119 psF32 *outRow;120 psC32 *inRow;119 psF32* outRow; 120 psC32* inRow; 121 121 122 122 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); … … 130 130 } 131 131 } else if (type == PS_TYPE_C64) { 132 psF64 *outRow;133 psC64 *inRow;132 psF64* outRow; 133 psC64* inRow; 134 134 135 135 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); … … 151 151 } 152 152 153 psImage *psImageImaginary(psImage * out, const psImage* in)153 psImage* psImageImaginary(psImage* out, const psImage* in) 154 154 { 155 155 psElemType type; … … 177 177 178 178 if (type == PS_TYPE_C32) { 179 psF32 *outRow;180 psC32 *inRow;179 psF32* outRow; 180 psC32* inRow; 181 181 182 182 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); … … 190 190 } 191 191 } else if (type == PS_TYPE_C64) { 192 psF64 *outRow;193 psC64 *inRow;192 psF64* outRow; 193 psC64* inRow; 194 194 195 195 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); … … 211 211 } 212 212 213 psImage *psImageComplex(psImage * out, psImage * real, const psImage* imag)213 psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag) 214 214 { 215 215 psElemType type; … … 251 251 252 252 if (type == PS_TYPE_F32) { 253 psC32 *outRow;254 psF32 *realRow;255 psF32 *imagRow;253 psC32* outRow; 254 psF32* realRow; 255 psF32* imagRow; 256 256 257 257 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); … … 267 267 } 268 268 } else if (type == PS_TYPE_F64) { 269 psC64 *outRow;270 psF64 *realRow;271 psF64 *imagRow;269 psC64* outRow; 270 psF64* realRow; 271 psF64* imagRow; 272 272 273 273 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); … … 290 290 } 291 291 292 psImage *psImageConjugate(psImage * out, const psImage* in)292 psImage* psImageConjugate(psImage* out, const psImage* in) 293 293 { 294 294 psElemType type; … … 314 314 315 315 if (type == PS_TYPE_C32) { 316 psC32 *outRow;317 psC32 *inRow;316 psC32* outRow; 317 psC32* inRow; 318 318 319 319 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); … … 327 327 } 328 328 } else if (type == PS_TYPE_C64) { 329 psC64 *outRow;330 psC64 *inRow;329 psC64* outRow; 330 psC64* inRow; 331 331 332 332 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); … … 348 348 } 349 349 350 psImage *psImagePowerSpectrum(psImage * out, const psImage* in)350 psImage* psImagePowerSpectrum(psImage* out, const psImage* in) 351 351 { 352 352 psElemType type; … … 373 373 374 374 if (type == PS_TYPE_C32) { 375 psF32 *outRow;376 psC32 *inRow;375 psF32* outRow; 376 psC32* inRow; 377 377 psF32 real; 378 378 psF32 imag; … … 390 390 } 391 391 } else if (type == PS_TYPE_C64) { 392 psF64 *outRow;393 psC64 *inRow;392 psF64* outRow; 393 psC64* inRow; 394 394 psF64 real; 395 395 psF64 imag; … … 418 418 /************************************** Vector Functions ***************************************/ 419 419 420 psVector *psVectorFFT(psVector * out, const psVector* in, psFftDirection direction)420 psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction) 421 421 { 422 422 unsigned int numElements; … … 464 464 if (type == PS_TYPE_F32) { 465 465 // need to convert to complex 466 psC32 *outVec = out->data.C32;467 psF32 *inVec = in->data.F32;466 psC32* outVec = out->data.C32; 467 psF32* inVec = in->data.F32; 468 468 469 469 for (unsigned int i = 0; i < numElements; i++) { … … 471 471 } 472 472 } else { 473 psC32 *outVec = out->data.C32;474 psC32 *inVec = in->data.C32;473 psC32* outVec = out->data.C32; 474 psC32* inVec = in->data.C32; 475 475 476 476 for (unsigned int i = 0; i < numElements; i++) { … … 498 498 } 499 499 500 psVector *psVectorReal(psVector * out, const psVector* in)500 psVector* psVectorReal(psVector* out, const psVector* in) 501 501 { 502 502 psElemType type; … … 523 523 524 524 if (type == PS_TYPE_C32) { 525 psF32 *outVec;526 psC32 *inVec = in->data.C32;525 psF32* outVec; 526 psC32* inVec = in->data.C32; 527 527 528 528 out = psVectorRecycle(out, numElements, PS_TYPE_F32); … … 542 542 } 543 543 544 psVector *psVectorImaginary(psVector * out, const psVector* in)544 psVector* psVectorImaginary(psVector* out, const psVector* in) 545 545 { 546 546 psElemType type; … … 567 567 568 568 if (type == PS_TYPE_C32) { 569 psF32 *outVec;570 psC32 *inVec = in->data.C32;569 psF32* outVec; 570 psC32* inVec = in->data.C32; 571 571 572 572 out = psVectorRecycle(out, numElements, PS_TYPE_F32); … … 586 586 } 587 587 588 psVector *psVectorComplex(psVector * out, psVector * real, const psVector* imag)588 psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag) 589 589 { 590 590 psElemType type; … … 616 616 617 617 if (type == PS_TYPE_F32) { 618 psC32 *outVec;619 psF32 *realVec = real->data.F32;620 psF32 *imagVec = imag->data.F32;618 psC32* outVec; 619 psF32* realVec = real->data.F32; 620 psF32* imagVec = imag->data.F32; 621 621 622 622 out = psVectorRecycle(out, numElements, PS_TYPE_C32); … … 636 636 } 637 637 638 psVector *psVectorConjugate(psVector * out, const psVector* in)638 psVector* psVectorConjugate(psVector* out, const psVector* in) 639 639 { 640 640 psElemType type; … … 662 662 663 663 if (type == PS_TYPE_C32) { 664 psC32 *outVec;665 psC32 *inVec = in->data.C32;664 psC32* outVec; 665 psC32* inVec = in->data.C32; 666 666 667 667 out = psVectorRecycle(out, numElements, PS_TYPE_C32); … … 681 681 } 682 682 683 psVector *psVectorPowerSpectrum(psVector * out, const psVector* in)683 psVector* psVectorPowerSpectrum(psVector* out, const psVector* in) 684 684 { 685 685 psElemType type; … … 708 708 709 709 if (type == PS_TYPE_C32) { 710 psF32 *outVec;711 psC32 *inVec = in->data.C32;710 psF32* outVec; 711 psC32* inVec = in->data.C32; 712 712 psF32 inAbs1; 713 713 psF32 inAbs2; -
trunk/psLib/src/dataManip/psFFT.h
r1426 r1440 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-09 2 2:44:25$10 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-09 23:34:57 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 } psFftDirection; 34 34 35 psImage *psImageFFT(psImage * out, const psImage* in, psFftDirection direction);36 psImage *psImageReal(psImage * out, const psImage* in);37 psImage *psImageImaginary(psImage * out, const psImage* in);38 psImage *psImageComplex(psImage * out, psImage * real, const psImage* imag);39 psImage *psImageConjugate(psImage * out, const psImage* in);40 psImage *psImagePowerSpectrum(psImage * out, const psImage* in);35 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction); 36 psImage* psImageReal(psImage* out, const psImage* in); 37 psImage* psImageImaginary(psImage* out, const psImage* in); 38 psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag); 39 psImage* psImageConjugate(psImage* out, const psImage* in); 40 psImage* psImagePowerSpectrum(psImage* out, const psImage* in); 41 41 42 psVector *psVectorFFT(psVector * out, const psVector* in, psFftDirection direction);43 psVector *psVectorReal(psVector * out, const psVector* in);44 psVector *psVectorImaginary(psVector * out, const psVector* in);45 psVector *psVectorComplex(psVector * out, psVector * real, const psVector* imag);46 psVector *psVectorConjugate(psVector * out, const psVector* in);47 psVector *psVectorPowerSpectrum(psVector * out, const psVector* in);42 psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction); 43 psVector* psVectorReal(psVector* out, const psVector* in); 44 psVector* psVectorImaginary(psVector* out, const psVector* in); 45 psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag); 46 psVector* psVectorConjugate(psVector* out, const psVector* in); 47 psVector* psVectorPowerSpectrum(psVector* out, const psVector* in); 48 48 49 49 /// @} -
trunk/psLib/src/dataManip/psFunctions.c
r1407 r1440 8 8 * polynomials. It also contains a Gaussian functions. 9 9 * 10 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-0 7 00:06:06$10 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-09 23:34:57 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 49 49 50 50 /*****************************************************************************/ 51 static void polynomial1DFree(psPolynomial1D * myPoly);52 static void polynomial2DFree(psPolynomial2D * myPoly);53 static void polynomial3DFree(psPolynomial3D * myPoly);54 static void polynomial4DFree(psPolynomial4D * myPoly);55 static void dPolynomial1DFree(psDPolynomial1D * myPoly);56 static void dPolynomial2DFree(psDPolynomial2D * myPoly);57 static void dPolynomial3DFree(psDPolynomial3D * myPoly);58 static void dPolynomial4DFree(psDPolynomial4D * myPoly);51 static void polynomial1DFree(psPolynomial1D* myPoly); 52 static void polynomial2DFree(psPolynomial2D* myPoly); 53 static void polynomial3DFree(psPolynomial3D* myPoly); 54 static void polynomial4DFree(psPolynomial4D* myPoly); 55 static void dPolynomial1DFree(psDPolynomial1D* myPoly); 56 static void dPolynomial2DFree(psDPolynomial2D* myPoly); 57 static void dPolynomial3DFree(psDPolynomial3D* myPoly); 58 static void dPolynomial4DFree(psDPolynomial4D* myPoly); 59 59 60 60 /*****************************************************************************/ … … 120 120 NOTE: There is no way to seed the random generator. 121 121 *****************************************************************************/ 122 psVector *psGaussianDev(float mean, float sigma, int Npts)123 { 124 psVector *gauss = NULL;122 psVector* psGaussianDev(float mean, float sigma, int Npts) 123 { 124 psVector* gauss = NULL; 125 125 const gsl_rng_type *T = NULL; 126 126 gsl_rng *r = NULL; … … 144 144 This routine must allocate memory for the polynomial structures. 145 145 *****************************************************************************/ 146 psPolynomial1D *psPolynomial1DAlloc(int n)146 psPolynomial1D* psPolynomial1DAlloc(int n) 147 147 { 148 148 int i = 0; 149 psPolynomial1D *newPoly = NULL;150 151 newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));149 psPolynomial1D* newPoly = NULL; 150 151 newPoly = (psPolynomial1D* ) psAlloc(sizeof(psPolynomial1D)); 152 152 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree); 153 153 newPoly->n = n; … … 164 164 } 165 165 166 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY)167 { 168 int x = 0; 169 int y = 0; 170 psPolynomial2D *newPoly = NULL;171 172 newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));166 psPolynomial2D* psPolynomial2DAlloc(int nX, int nY) 167 { 168 int x = 0; 169 int y = 0; 170 psPolynomial2D* newPoly = NULL; 171 172 newPoly = (psPolynomial2D* ) psAlloc(sizeof(psPolynomial2D)); 173 173 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree); 174 174 newPoly->nX = nX; … … 194 194 } 195 195 196 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ)196 psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ) 197 197 { 198 198 int x = 0; 199 199 int y = 0; 200 200 int z = 0; 201 psPolynomial3D *newPoly = NULL;202 203 newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));201 psPolynomial3D* newPoly = NULL; 202 203 newPoly = (psPolynomial3D* ) psAlloc(sizeof(psPolynomial3D)); 204 204 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree); 205 205 newPoly->nX = nX; … … 233 233 } 234 234 235 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)235 psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ) 236 236 { 237 237 int w = 0; … … 239 239 int y = 0; 240 240 int z = 0; 241 psPolynomial4D *newPoly = NULL;242 243 newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));241 psPolynomial4D* newPoly = NULL; 242 243 newPoly = (psPolynomial4D* ) psAlloc(sizeof(psPolynomial4D)); 244 244 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree); 245 245 newPoly->nW = nW; … … 281 281 } 282 282 283 static void polynomial1DFree(psPolynomial1D * myPoly)283 static void polynomial1DFree(psPolynomial1D* myPoly) 284 284 { 285 285 psFree(myPoly->coeff); … … 288 288 } 289 289 290 static void polynomial2DFree(psPolynomial2D * myPoly)290 static void polynomial2DFree(psPolynomial2D* myPoly) 291 291 { 292 292 int x = 0; … … 302 302 } 303 303 304 static void polynomial3DFree(psPolynomial3D * myPoly)304 static void polynomial3DFree(psPolynomial3D* myPoly) 305 305 { 306 306 int x = 0; … … 323 323 } 324 324 325 static void polynomial4DFree(psPolynomial4D * myPoly)325 static void polynomial4DFree(psPolynomial4D* myPoly) 326 326 { 327 327 int w = 0; … … 353 353 Polynomial coefficients will be accessed in [w][x][y][z] fashion. 354 354 *****************************************************************************/ 355 float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)355 float psPolynomial1DEval(float x, const psPolynomial1D* myPoly) 356 356 { 357 357 int loop_x = 0; … … 380 380 } 381 381 382 float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)382 float psPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 383 383 { 384 384 int loop_x = 0; … … 400 400 } 401 401 402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 403 403 { 404 404 int loop_x = 0; … … 426 426 } 427 427 428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 429 429 { 430 430 int loop_w = 0; … … 458 458 } 459 459 460 psDPolynomial1D *psDPolynomial1DAlloc(int n)460 psDPolynomial1D* psDPolynomial1DAlloc(int n) 461 461 { 462 462 int i = 0; 463 psDPolynomial1D *newPoly = NULL;464 465 newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));463 psDPolynomial1D* newPoly = NULL; 464 465 newPoly = (psDPolynomial1D* ) psAlloc(sizeof(psDPolynomial1D)); 466 466 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree); 467 467 newPoly->n = n; … … 478 478 } 479 479 480 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY)481 { 482 int x = 0; 483 int y = 0; 484 psDPolynomial2D *newPoly = NULL;485 486 newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));480 psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY) 481 { 482 int x = 0; 483 int y = 0; 484 psDPolynomial2D* newPoly = NULL; 485 486 newPoly = (psDPolynomial2D* ) psAlloc(sizeof(psDPolynomial2D)); 487 487 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree); 488 488 newPoly->nX = nX; … … 508 508 } 509 509 510 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ)510 psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ) 511 511 { 512 512 int x = 0; 513 513 int y = 0; 514 514 int z = 0; 515 psDPolynomial3D *newPoly = NULL;516 517 newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));515 psDPolynomial3D* newPoly = NULL; 516 517 newPoly = (psDPolynomial3D* ) psAlloc(sizeof(psDPolynomial3D)); 518 518 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree); 519 519 newPoly->nX = nX; … … 547 547 } 548 548 549 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)549 psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ) 550 550 { 551 551 int w = 0; … … 553 553 int y = 0; 554 554 int z = 0; 555 psDPolynomial4D *newPoly = NULL;556 557 newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));555 psDPolynomial4D* newPoly = NULL; 556 557 newPoly = (psDPolynomial4D* ) psAlloc(sizeof(psDPolynomial4D)); 558 558 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree); 559 559 newPoly->nW = nW; … … 595 595 } 596 596 597 static void dPolynomial1DFree(psDPolynomial1D * myPoly)597 static void dPolynomial1DFree(psDPolynomial1D* myPoly) 598 598 { 599 599 psFree(myPoly->coeff); … … 602 602 } 603 603 604 static void dPolynomial2DFree(psDPolynomial2D * myPoly)604 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 605 605 { 606 606 int x = 0; … … 616 616 } 617 617 618 static void dPolynomial3DFree(psDPolynomial3D * myPoly)618 static void dPolynomial3DFree(psDPolynomial3D* myPoly) 619 619 { 620 620 int x = 0; … … 637 637 } 638 638 639 static void dPolynomial4DFree(psDPolynomial4D * myPoly)639 static void dPolynomial4DFree(psDPolynomial4D* myPoly) 640 640 { 641 641 int w = 0; … … 667 667 Polynomial coefficients will be accessed in [w][x][y][z] fashion. 668 668 *****************************************************************************/ 669 double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)669 double psDPolynomial1DEval(double x, const psDPolynomial1D* myPoly) 670 670 { 671 671 int loop_x = 0; … … 686 686 } 687 687 688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 689 689 { 690 690 int loop_x = 0; … … 706 706 } 707 707 708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 709 709 { 710 710 int loop_x = 0; … … 732 732 } 733 733 734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 735 735 { 736 736 int loop_w = 0; -
trunk/psLib/src/dataManip/psFunctions.h
r1426 r1440 13 13 * @author George Gusciora, MHPCC 14 14 * 15 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-08-09 2 2:44:25$15 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-09 23:34:57 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 /** Produce a vector of random numbers from a Gaussian distribution with 43 43 the specified mean and sigma */ 44 psVector *psGaussianDev(float mean, ///< The mean of the Gaussian44 psVector* psGaussianDev(float mean, ///< The mean of the Gaussian 45 45 float sigma, ///< The sigma of the Gaussian 46 46 int Npts); ///< The size of the vector … … 95 95 96 96 /** Constructor */ 97 psPolynomial1D *psPolynomial1DAlloc(int n ///< Number of terms98 ); 99 100 /** Constructor */ 101 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y102 ); 103 104 /** Constructor */ 105 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z106 ); 107 108 /** Constructor */ 109 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and97 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 110 // z 111 111 ); … … 113 113 /** Evaluate 1D polynomial */ 114 114 float psPolynomial1DEval(float x, ///< Value at which to evaluate 115 const psPolynomial1D * myPoly ///< Coefficients for the polynomial115 const psPolynomial1D* myPoly ///< Coefficients for the polynomial 116 116 ); 117 117 … … 119 119 float psPolynomial2DEval(float x, ///< Value x at which to evaluate 120 120 float y, ///< Value y at which to evaluate 121 const psPolynomial2D * myPoly ///< Coefficients for the polynomial121 const psPolynomial2D* myPoly ///< Coefficients for the polynomial 122 122 ); 123 123 … … 126 126 float y, ///< Value y at which to evaluate 127 127 float z, ///< Value z at which to evaluate 128 const psPolynomial3D * myPoly ///< Coefficients for the polynomial128 const psPolynomial3D* myPoly ///< Coefficients for the polynomial 129 129 ); 130 130 … … 134 134 float y, ///< Value y at which to evaluate 135 135 float z, ///< Value z at which to evaluate 136 const psPolynomial4D * myPoly ///< Coefficients for the polynomial136 const psPolynomial4D* myPoly ///< Coefficients for the polynomial 137 137 ); 138 138 … … 188 188 189 189 /** Constructor */ 190 psDPolynomial1D *psDPolynomial1DAlloc(int n ///< Number of terms191 ); 192 193 /** Constructor */ 194 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y195 ); 196 197 /** Constructor */ 198 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z199 ); 200 201 /** Constructor */ 202 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and190 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 203 // z 204 204 ); … … 206 206 /** Evaluate 1D polynomial (double precision) */ 207 207 double psDPolynomial1DEval(double x, ///< Value at which to evaluate 208 const psDPolynomial1D * myPoly ///< Coefficients for the polynomial208 const psDPolynomial1D* myPoly ///< Coefficients for the polynomial 209 209 ); 210 210 … … 212 212 double psDPolynomial2DEval(double x, ///< Value x at which to evaluate 213 213 double y, ///< Value y at which to evaluate 214 const psDPolynomial2D * myPoly ///< Coefficients for the polynomial214 const psDPolynomial2D* myPoly ///< Coefficients for the polynomial 215 215 ); 216 216 … … 219 219 double y, ///< Value y at which to evaluate 220 220 double z, ///< Value z at which to evaluate 221 const psDPolynomial3D * myPoly ///< Coefficients for the polynomial221 const psDPolynomial3D* myPoly ///< Coefficients for the polynomial 222 222 ); 223 223 … … 227 227 double y, ///< Value y at which to evaluate 228 228 double z, ///< Value z at which to evaluate 229 const psDPolynomial4D * myPoly ///< Coefficients for the polynomial229 const psDPolynomial4D* myPoly ///< Coefficients for the polynomial 230 230 ); 231 231 -
trunk/psLib/src/dataManip/psMatrix.c
r1407 r1440 21 21 * @author Ross Harman, MHPCC 22 22 * 23 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $24 * @date $Date: 2004-08-0 7 00:06:06$23 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 24 * @date $Date: 2004-08-09 23:34:57 $ 25 25 * 26 26 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 160 160 /*****************************************************************************/ 161 161 162 psImage *psMatrixLUD(psImage * outImage, psVector * outPerm, psImage* inImage)162 psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage) 163 163 { 164 164 int signum = 0; … … 205 205 } 206 206 207 psVector *psMatrixLUSolve(psVector * outVector, const psImage * inImage, const psVector* inVector, const208 psVector * inPerm)207 psVector* psMatrixLUSolve(psVector* outVector, const psImage* inImage, const psVector* inVector, const 208 psVector* inPerm) 209 209 { 210 210 int arraySize = 0; … … 258 258 } 259 259 260 psImage *psMatrixInvert(psImage * outImage, const psImage* inImage, float *restrict det)260 psImage* psMatrixInvert(psImage* outImage, const psImage* inImage, float *restrict det) 261 261 { 262 262 int signum = 0; … … 312 312 } 313 313 314 float *psMatrixDeterminant(const psImage * restrict inImage)314 float *psMatrixDeterminant(const psImage* restrict inImage) 315 315 { 316 316 int signum = 0; … … 354 354 } 355 355 356 psImage *psMatrixMultiply(psImage * outImage, psImage * inImage1, psImage* inImage2)356 psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2) 357 357 { 358 358 int arraySize = 0; … … 396 396 } 397 397 398 psImage *psMatrixTranspose(psImage * outImage, const psImage* inImage)398 psImage* psMatrixTranspose(psImage* outImage, const psImage* inImage) 399 399 { 400 400 int arraySize = 0; … … 433 433 } 434 434 435 psImage *psMatrixEigenvectors(psImage * outImage, psImage* inImage)435 psImage* psMatrixEigenvectors(psImage* outImage, psImage* inImage) 436 436 { 437 437 int numRows = 0; … … 477 477 } 478 478 479 psVector *psMatrixToVector(psVector * outVector, psImage* inImage)479 psVector* psMatrixToVector(psVector* outVector, psImage* inImage) 480 480 { 481 481 int size = 0; … … 536 536 } 537 537 538 psImage *psVectorToMatrix(psImage * outImage, psVector* inVector)538 psImage* psVectorToMatrix(psImage* outImage, psVector* inVector) 539 539 { 540 540 int size = 0; -
trunk/psLib/src/dataManip/psMatrix.h
r1426 r1440 22 22 * @author Ross Harman, MHPCC 23 23 * 24 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $25 * @date $Date: 2004-08-09 2 2:44:25$24 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 25 * @date $Date: 2004-08-09 23:34:57 $ 26 26 * 27 27 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 * the same. GSL indexes the top row as the zero row, not the bottom. 42 42 * 43 * @return psImage* : Pointer to LU decomposed psImage.43 * @return psImage* : Pointer to LU decomposed psImage. 44 44 */ 45 psImage *psMatrixLUD(psImage* outImage, ///< Image to return, or NULL.46 psVector * outPerm, ///< Output permutation vector used by psMatrixLUSolve.47 psImage * inImage ///< Image to decompose.45 psImage* psMatrixLUD(psImage* outImage, ///< Image to return, or NULL. 46 psVector* outPerm, ///< Output permutation vector used by psMatrixLUSolve. 47 psImage* inImage ///< Image to decompose. 48 48 ); 49 49 … … 55 55 * the top row as the zero row, not the bottom. 56 56 * 57 * @return psVector* : Pointer to psVector solution of matrix equation.57 * @return psVector* : Pointer to psVector solution of matrix equation. 58 58 */ 59 psVector *psMatrixLUSolve(psVector* outVector, ///< Vector to return, or NULL.60 const psImage * luImage, ///< LU-decomposed matrix.61 const psVector * inVector, ///< Vector right-hand-side of equation.62 const psVector * inPerm ///< Permutation vector resulting from psMatrixLUD59 psVector* psMatrixLUSolve(psVector* outVector, ///< Vector to return, or NULL. 60 const psImage* luImage, ///< LU-decomposed matrix. 61 const psVector* inVector, ///< Vector right-hand-side of equation. 62 const psVector* inPerm ///< Permutation vector resulting from psMatrixLUD 63 63 // function. 64 64 ); … … 71 71 * the same. GSL indexes the top row as the zero row, not the bottom. 72 72 * 73 * @return psImage* : Pointer to inverted psImage.73 * @return psImage* : Pointer to inverted psImage. 74 74 */ 75 psImage *psMatrixInvert(psImage* outImage, ///< Image to return, or NULL for in-place substitution.76 const psImage * inImage, ///< Image to be inverted75 psImage* psMatrixInvert(psImage* outImage, ///< Image to return, or NULL for in-place substitution. 76 const psImage* inImage, ///< Image to be inverted 77 77 float *restrict det ///< Determinant to return, or NULL 78 78 ); … … 86 86 * @return float: Determinant from psImage. 87 87 */ 88 float *psMatrixDeterminant(const psImage * restrict inMatrix ///< Image used to calculate determinant.88 float *psMatrixDeterminant(const psImage* restrict inMatrix ///< Image used to calculate determinant. 89 89 ); 90 90 … … 96 96 * zero row, not the bottom. 97 97 * 98 * @return psImage* : Pointer to resulting psImage.98 * @return psImage* : Pointer to resulting psImage. 99 99 */ 100 psImage *psMatrixMultiply(psImage* outImage, ///< Matrix to return, or NULL.101 psImage * inImage1, ///< First input image.102 psImage * inImage2 ///< Second input image.100 psImage* psMatrixMultiply(psImage* outImage, ///< Matrix to return, or NULL. 101 psImage* inImage1, ///< First input image. 102 psImage* inImage2 ///< Second input image. 103 103 ); 104 104 … … 110 110 * row, not the bottom. 111 111 * 112 * @return psImage* : Pointer to transposed psImage.112 * @return psImage* : Pointer to transposed psImage. 113 113 */ 114 psImage *psMatrixTranspose(psImage* outImage, ///< Image to return, or NULL115 const psImage * inImage ///< Image to transpose114 psImage* psMatrixTranspose(psImage* outImage, ///< Image to return, or NULL 115 const psImage* inImage ///< Image to transpose 116 116 ); 117 117 … … 122 122 * only with the psF64 data type. GSL indexes the top row as the zero row, not the bottom. 123 123 * 124 * @return psImage* : Pointer to matrix of Eigenvectors.124 * @return psImage* : Pointer to matrix of Eigenvectors. 125 125 */ 126 psImage *psMatrixEigenvectors(psImage* outImage, ///< Eigenvectors to return, or NULL.127 psImage * inImage ///< Input image.126 psImage* psMatrixEigenvectors(psImage* outImage, ///< Eigenvectors to return, or NULL. 127 psImage* inImage ///< Input image. 128 128 ); 129 129 … … 135 135 * input matrix must be 1. This function operates only with the psF64 data type. 136 136 * 137 * @return psVector* : Pointer to psVector.137 * @return psVector* : Pointer to psVector. 138 138 */ 139 psVector *psMatrixToVector(psVector* outVector, ///< Vector to return, or NULL.140 psImage * inImage ///< Image to convert.139 psVector* psMatrixToVector(psVector* outVector, ///< Vector to return, or NULL. 140 psImage* inImage ///< Image to convert. 141 141 ); 142 142 … … 148 148 * automatically be created. This function operates only with the psF64 data type. 149 149 * 150 * @return psVector* : Pointer to psIamge.150 * @return psVector* : Pointer to psIamge. 151 151 */ 152 psImage *psVectorToMatrix(psImage* outImage, ///< Matrix to return, or NULL.153 psVector * inVector ///< Vector to convert.152 psImage* psVectorToMatrix(psImage* outImage, ///< Matrix to return, or NULL. 153 psVector* inVector ///< Vector to convert. 154 154 ); 155 155 -
trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c
r1407 r1440 30 30 * @author Ross Harman, MHPCC 31 31 * 32 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $33 * @date $Date: 2004-08-0 7 00:06:06$32 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2004-08-09 23:34:57 $ 34 34 * 35 35 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 114 114 ps##TYPE *i1 = NULL; \ 115 115 ps##TYPE *i2 = NULL; \ 116 o = &((psScalar* )OUT)->data.TYPE; \117 i1 = &((psScalar* )IN1)->data.TYPE; \118 i2 = &((psScalar* )IN2)->data.TYPE; \116 o = &((psScalar* )OUT)->data.TYPE; \ 117 i1 = &((psScalar* )IN1)->data.TYPE; \ 118 i2 = &((psScalar* )IN2)->data.TYPE; \ 119 119 *o = OP; \ 120 120 } … … 127 127 ps##TYPE *i1 = NULL; \ 128 128 ps##TYPE *i2 = NULL; \ 129 npt = ((psVector* )IN1)->n; \130 o = ((psVector* )OUT)->data.TYPE; \131 i1 = &((psScalar* )IN1)->data.TYPE; \132 i2 = ((psVector* )IN2)->data.TYPE; \129 npt = ((psVector* )IN1)->n; \ 130 o = ((psVector* )OUT)->data.TYPE; \ 131 i1 = &((psScalar* )IN1)->data.TYPE; \ 132 i2 = ((psVector* )IN2)->data.TYPE; \ 133 133 for (i=0; i < npt; i++, o++, i2++) { \ 134 134 *o = OP; \ … … 145 145 ps##TYPE *i1 = NULL; \ 146 146 ps##TYPE *i2 = NULL; \ 147 numRows = ((psImage* )IN1)->numRows; \148 numCols = ((psImage* )IN1)->numCols; \147 numRows = ((psImage* )IN1)->numRows; \ 148 numCols = ((psImage* )IN1)->numCols; \ 149 149 for(j = 0; j < numCols; j++) { \ 150 o = ((psImage* )OUT)->data.TYPE[j]; \151 i1 = &((psScalar* )IN1)->data.TYPE; \152 i2 = ((psImage* )IN2)->data.TYPE[j]; \150 o = ((psImage* )OUT)->data.TYPE[j]; \ 151 i1 = &((psScalar* )IN1)->data.TYPE; \ 152 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 153 153 for(i = 0; i < numRows; i++, o++, i2++) { \ 154 154 *o = OP; \ … … 165 165 ps##TYPE *i1 = NULL; \ 166 166 ps##TYPE *i2 = NULL; \ 167 n1 = ((psVector* )IN1)->n; \168 o = ((psVector* )OUT)->data.TYPE; \169 i1 = ((psVector* )IN1)->data.TYPE; \170 i2 = &((psScalar* )IN2)->data.TYPE; \167 n1 = ((psVector* )IN1)->n; \ 168 o = ((psVector* )OUT)->data.TYPE; \ 169 i1 = ((psVector* )IN1)->data.TYPE; \ 170 i2 = &((psScalar* )IN2)->data.TYPE; \ 171 171 for (i=0; i < n1; i++, o++, i1++) { \ 172 172 *o = OP; \ … … 182 182 ps##TYPE *i1 = NULL; \ 183 183 ps##TYPE *i2 = NULL; \ 184 n1 = ((psVector* )IN1)->n; \185 n2 = ((psVector* )IN2)->n; \184 n1 = ((psVector* )IN1)->n; \ 185 n2 = ((psVector* )IN2)->n; \ 186 186 if(n1 != n2) { \ 187 187 psError(__func__, ": Inconsistent element count: %d vs %d", n1, n2); \ 188 188 return OUT; \ 189 189 } \ 190 o = ((psVector* )OUT)->data.TYPE; \191 i1 = ((psVector* )IN1)->data.TYPE; \192 i2 = ((psVector* )IN2)->data.TYPE; \190 o = ((psVector* )OUT)->data.TYPE; \ 191 i1 = ((psVector* )IN1)->data.TYPE; \ 192 i2 = ((psVector* )IN2)->data.TYPE; \ 193 193 for (i=0; i < n1; i++, o++, i1++, i2++) { \ 194 194 *o = OP; \ … … 207 207 ps##TYPE *i1 = NULL; \ 208 208 ps##TYPE *i2 = NULL; \ 209 n1 = ((psVector* )IN1)->n; \210 dim1 = ((psVector* )IN1)->type.dimen; \211 numRows2 = ((psImage* )IN2)->numRows; \212 numCols2 = ((psImage* )IN2)->numCols; \209 n1 = ((psVector* )IN1)->n; \ 210 dim1 = ((psVector* )IN1)->type.dimen; \ 211 numRows2 = ((psImage* )IN2)->numRows; \ 212 numCols2 = ((psImage* )IN2)->numCols; \ 213 213 \ 214 214 if(dim1 == PS_DIMEN_VECTOR) { /* Regular vectors */ \ … … 218 218 } \ 219 219 \ 220 i1 = ((psVector* )IN1)->data.TYPE; \220 i1 = ((psVector* )IN1)->data.TYPE; \ 221 221 for(j = 0; j < numRows2; j++, i1++) { \ 222 o = ((psImage* )OUT)->data.TYPE[j]; \223 i2 = ((psImage* )IN2)->data.TYPE[j]; \222 o = ((psImage* )OUT)->data.TYPE[j]; \ 223 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 224 224 for(i = 0; i < numCols2; i++, o++, i2++) { \ 225 225 *o = OP; \ … … 233 233 \ 234 234 for(j = 0; j < numRows2; j++) { \ 235 o = ((psImage* )OUT)->data.TYPE[j]; \236 i1 = ((psVector* )IN1)->data.TYPE; \237 i2 = ((psImage* )IN2)->data.TYPE[j]; \235 o = ((psImage* )OUT)->data.TYPE[j]; \ 236 i1 = ((psVector* )IN1)->data.TYPE; \ 237 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 238 238 for(i = 0; i < numCols2; i++, o++, i1++, i2++) { \ 239 239 *o = OP; \ … … 253 253 ps##TYPE *i1 = NULL; \ 254 254 ps##TYPE *i2 = NULL; \ 255 numRows = ((psImage* )IN1)->numRows; \256 numCols = ((psImage* )IN1)->numCols; \255 numRows = ((psImage* )IN1)->numRows; \ 256 numCols = ((psImage* )IN1)->numCols; \ 257 257 for(j = 0; j < numRows; j++) { \ 258 o = ((psImage* )OUT)->data.TYPE[j]; \259 i1 = ((psImage* )IN1)->data.TYPE[j]; \260 i2 = &((psScalar* )IN2)->data.TYPE; \258 o = ((psImage* )OUT)->data.TYPE[j]; \ 259 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 260 i2 = &((psScalar* )IN2)->data.TYPE; \ 261 261 for(i = 0; i < numCols; i++, o++, i1++) { \ 262 262 *o = OP; \ … … 276 276 ps##TYPE *i1 = NULL; \ 277 277 ps##TYPE *i2 = NULL; \ 278 n2 = ((psVector* )IN2)->n; \279 dim2 = ((psVector* )IN2)->type.dimen; \280 numRows1 = ((psImage* )IN1)->numRows; \281 numCols1 = ((psImage* )IN1)->numCols; \278 n2 = ((psVector* )IN2)->n; \ 279 dim2 = ((psVector* )IN2)->type.dimen; \ 280 numRows1 = ((psImage* )IN1)->numRows; \ 281 numCols1 = ((psImage* )IN1)->numCols; \ 282 282 \ 283 283 if(dim2 == PS_DIMEN_VECTOR) { /* Regular vectors */ \ … … 287 287 } \ 288 288 \ 289 i2 = ((psVector* )IN2)->data.TYPE; \289 i2 = ((psVector* )IN2)->data.TYPE; \ 290 290 for(j = 0; j < numRows1; j++, i1++) { \ 291 o = ((psImage* )OUT)->data.TYPE[j]; \292 i1 = ((psImage* )IN1)->data.TYPE[j]; \291 o = ((psImage* )OUT)->data.TYPE[j]; \ 292 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 293 293 for(i = 0; i < numCols1; i++, o++, i1++) { \ 294 294 *o = OP; \ … … 302 302 \ 303 303 for(j = 0; j < numRows1; j++) { \ 304 o = ((psImage* )OUT)->data.TYPE[j]; \305 i1 = ((psVector* )IN2)->data.TYPE; \306 i2 = ((psImage* )IN1)->data.TYPE[j]; \304 o = ((psImage* )OUT)->data.TYPE[j]; \ 305 i1 = ((psVector* )IN2)->data.TYPE; \ 306 i2 = ((psImage* )IN1)->data.TYPE[j]; \ 307 307 for(i = 0; i < numCols1; i++, o++, i2++, i1++) { \ 308 308 *o = OP; \ … … 323 323 ps##TYPE *i1 = NULL; \ 324 324 ps##TYPE *i2 = NULL; \ 325 numRows1 = ((psImage* )IN1)->numRows; \326 numCols1 = ((psImage* )IN1)->numCols; \327 numRows2 = ((psImage* )IN2)->numRows; \328 numCols2 = ((psImage* )IN2)->numCols; \325 numRows1 = ((psImage* )IN1)->numRows; \ 326 numCols1 = ((psImage* )IN1)->numCols; \ 327 numRows2 = ((psImage* )IN2)->numRows; \ 328 numCols2 = ((psImage* )IN2)->numCols; \ 329 329 if(numRows1!=numRows2 || numCols1!=numCols2) { \ 330 330 psError(__func__, ": Inconsistent element count: numRows: %d vs %d numCols: %d vs %d", numRows1, \ … … 333 333 } \ 334 334 for(j = 0; j < numRows1; j++) { \ 335 o = ((psImage* )OUT)->data.TYPE[j]; \336 i1 = ((psImage* )IN1)->data.TYPE[j]; \337 i2 = ((psImage* )IN2)->data.TYPE[j]; \335 o = ((psImage* )OUT)->data.TYPE[j]; \ 336 i1 = ((psImage* )IN1)->data.TYPE[j]; \ 337 i2 = ((psImage* )IN2)->data.TYPE[j]; \ 338 338 for(i = 0; i < numCols1; i++, o++, i1++, i2++) { \ 339 339 *o = OP; \ … … 409 409 psElemType elType2 = 0; 410 410 psElemType elTypeOut = 0; 411 psType *psType1 = NULL;412 psType *psType2 = NULL;413 psType *psTypeOut = NULL;414 415 psTypeOut = (psType *) out;411 psType* psType1 = NULL; 412 psType* psType2 = NULL; 413 psType* psTypeOut = NULL; 414 415 psTypeOut = (psType* ) out; 416 416 if (psTypeOut == NULL) { 417 417 psError(__func__, ": Line %d - Null out argument", __LINE__); … … 419 419 } 420 420 421 psType1 = (psType *) in1;421 psType1 = (psType* ) in1; 422 422 if (psType1 == NULL) { 423 423 psError(__func__, ": Line %d - Null in1 argument", __LINE__); … … 425 425 } 426 426 427 psType2 = (psType *) in2;427 psType2 = (psType* ) in2; 428 428 if (psType2 == NULL) { 429 429 psError(__func__, ": Line %d - Null in2 argument", __LINE__); … … 456 456 457 457 if (dim1 == PS_DIMEN_VECTOR) { 458 if (((psVector *) in1)->n == 0) {458 if (((psVector* ) in1)->n == 0) { 459 459 psError(__func__, ": Line %d - Vector contains zero elements"); 460 460 } 461 461 } else if (dim1 == PS_DIMEN_IMAGE) { 462 if (((psImage *) in1)->numCols == 0 || ((psImage *) in1)->numRows == 0) {462 if (((psImage* ) in1)->numCols == 0 || ((psImage* ) in1)->numRows == 0) { 463 463 psError(__func__, ": Line %d - Image contains zero length row or cols"); 464 464 } … … 466 466 467 467 if (dim2 == PS_DIMEN_VECTOR) { 468 if (((psVector *) in2)->n == 0) {468 if (((psVector* ) in2)->n == 0) { 469 469 psError(__func__, ": Line %d - Vector contains zero elements"); 470 470 } 471 471 } else if (dim2 == PS_DIMEN_IMAGE) { 472 if (((psImage *) in2)->numCols == 0 || ((psImage *) in2)->numRows == 0) {472 if (((psImage* ) in2)->numCols == 0 || ((psImage* ) in2)->numRows == 0) { 473 473 psError(__func__, ": Line %d - Image contains zero length row or cols"); 474 474 } … … 517 517 ps##TYPE *o = NULL; \ 518 518 ps##TYPE *i1 = NULL; \ 519 o = &((psScalar* )OUT)->data.TYPE; \520 i1 = &((psScalar* )IN)->data.TYPE; \519 o = &((psScalar* )OUT)->data.TYPE; \ 520 i1 = &((psScalar* )IN)->data.TYPE; \ 521 521 *o = OP; \ 522 522 } … … 530 530 ps##TYPE *o = NULL; \ 531 531 ps##TYPE *i1 = NULL; \ 532 nIn = ((psVector* )IN)->n; \533 nOut = ((psVector* )OUT)->n; \532 nIn = ((psVector* )IN)->n; \ 533 nOut = ((psVector* )OUT)->n; \ 534 534 if(nIn != nOut) { \ 535 535 psError(__func__, ": Inconsistent element count: %d vs %d", nIn, nOut); \ 536 536 return OUT; \ 537 537 } \ 538 o = ((psVector* )OUT)->data.TYPE; \539 i1 = ((psVector* )IN)->data.TYPE; \538 o = ((psVector* )OUT)->data.TYPE; \ 539 i1 = ((psVector* )IN)->data.TYPE; \ 540 540 for(i = 0; i < nIn; i++, o++, i1++) { \ 541 541 *o = OP; \ … … 554 554 ps##TYPE *o = NULL; \ 555 555 ps##TYPE *i1 = NULL; \ 556 numRowsIn = ((psImage* )IN)->numRows; \557 numColsIn = ((psImage* )IN)->numCols; \558 numRowsOut = ((psImage* )OUT)->numRows; \559 numColsOut = ((psImage* )OUT)->numCols; \556 numRowsIn = ((psImage* )IN)->numRows; \ 557 numColsIn = ((psImage* )IN)->numCols; \ 558 numRowsOut = ((psImage* )OUT)->numRows; \ 559 numColsOut = ((psImage* )OUT)->numCols; \ 560 560 if(numRowsIn!=numRowsOut || numColsIn!=numColsOut) { \ 561 561 psError(__func__, ": Inconsistent element count: numRows: %d vs %d numCols: %d vs %d", numRowsIn, \ … … 564 564 } \ 565 565 for(j = 0; j < numRowsIn; j++) { \ 566 o = ((psImage* )OUT)->data.TYPE[j]; \567 i1 = ((psImage* )IN)->data.TYPE[j]; \566 o = ((psImage* )OUT)->data.TYPE[j]; \ 567 i1 = ((psImage* )IN)->data.TYPE[j]; \ 568 568 for(i = 0; i < numColsIn; i++, o++, i1++) { \ 569 569 *o = OP; \ … … 713 713 psElemType elTypeIn = 0; 714 714 psElemType elTypeOut = 0; 715 psType *psTypeIn = NULL;716 psType *psTypeOut = NULL;717 718 psTypeOut = (psType *) out;715 psType* psTypeIn = NULL; 716 psType* psTypeOut = NULL; 717 718 psTypeOut = (psType* ) out; 719 719 if (psTypeOut == NULL) { 720 720 psError(__func__, ": Line %d - Null out argument", __LINE__); … … 722 722 } 723 723 724 psTypeIn = (psType *) in;724 psTypeIn = (psType* ) in; 725 725 if (psTypeIn == NULL) { 726 726 psError(__func__, ": Line %d - Null in argument", __LINE__); … … 757 757 758 758 if (dimIn == PS_DIMEN_VECTOR) { 759 if (((psVector *) in)->n == 0) {759 if (((psVector* ) in)->n == 0) { 760 760 psError(__func__, ": Line %d - Vector contains zero elements"); 761 761 } 762 762 } else if (dimIn == PS_DIMEN_IMAGE) { 763 if (((psImage *) in)->numCols == 0 || ((psImage *) in)->numRows == 0) {763 if (((psImage* ) in)->numCols == 0 || ((psImage* ) in)->numRows == 0) { 764 764 psError(__func__, ": Line %d - Image contains zero length row or cols"); 765 765 } … … 767 767 768 768 if (dimOut == PS_DIMEN_VECTOR) { 769 if (((psVector *) out)->n == 0) {769 if (((psVector* ) out)->n == 0) { 770 770 psError(__func__, ": Line %d - Vector contains zero elements"); 771 771 } 772 772 } else if (dimOut == PS_DIMEN_IMAGE) { 773 if (((psImage *) out)->numCols == 0 || ((psImage *) out)->numRows == 0) {773 if (((psImage* ) out)->numCols == 0 || ((psImage* ) out)->numRows == 0) { 774 774 psError(__func__, ": Line %d - Image contains zero length row or cols"); 775 775 } -
trunk/psLib/src/dataManip/psMatrixVectorArithmetic.h
r1407 r1440 30 30 * @author Ross Harman, MHPCC 31 31 * 32 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $33 * @date $Date: 2004-08-0 7 00:06:06$32 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2004-08-09 23:34:57 $ 34 34 * 35 35 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 53 53 * This function only supports vector-vector or image-image opertions. 54 54 * 55 * @return psType* : Pointer to either psImage or psVector.55 * @return psType* : Pointer to either psImage or psVector. 56 56 */ 57 psType *psBinaryOp(void *out, // / Output type, either psImage or psVector.57 psType* psBinaryOp(void *out, // / Output type, either psImage or psVector. 58 58 void *in1, // / First input, either psImage or psVector. 59 59 char *op, // / Operator. … … 75 75 * This function only supports vector-vector or image-image opertions. 76 76 * 77 * @return psType* : Pointer to either psImage or psVector.77 * @return psType* : Pointer to either psImage or psVector. 78 78 */ 79 psType *psUnaryOp(void *out, // / Output type, either psImage or psVector.79 psType* psUnaryOp(void *out, // / Output type, either psImage or psVector. 80 80 void *in, // / Input, either psImage or psVector. 81 81 char *op // / Operator. -
trunk/psLib/src/dataManip/psMinimize.c
r1407 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:57 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 99 99 size_t n; // Number of data points points in domain. 100 100 int paramCount; // Number of non-masked parameters. 101 psVector *restrict initialGuess;102 const psImage *restrict domain;103 const psVector *restrict data;104 const psVector *restrict errors;105 const psVector *restrict paramMask;106 float (*evalModel) (const psVector *, const psVector *);107 float (*d_evalModel) (const psVector *, const psVector *, int);101 psVector* restrict initialGuess; 102 const psImage* restrict domain; 103 const psVector* restrict data; 104 const psVector* restrict errors; 105 const psVector* restrict paramMask; 106 float (*evalModel) (const psVector* , const psVector* ); 107 float (*d_evalModel) (const psVector* , const psVector* , int); 108 108 } 109 109 psMinChi2Data; … … 112 112 { 113 113 int paramCount; // Number of non-masked parameters. 114 psVector *restrict initialGuess;115 const psVector *restrict coord;116 const psVector *restrict paramMask;117 float (*evalModel) (const psVector *, const psVector *);118 float (*d_evalModel) (const psVector *, const psVector *, int);114 psVector* restrict initialGuess; 115 const psVector* restrict coord; 116 const psVector* restrict paramMask; 117 float (*evalModel) (const psVector* , const psVector* ); 118 float (*d_evalModel) (const psVector* , const psVector* , int); 119 119 } 120 120 psMinimizeData; … … 162 162 int j; // Loop index variable. 163 163 float tmpf; // Temporary floating point variable. 164 const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;165 const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;166 psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;167 float (*evalModel) (const psVector *, const psVector *) = ((psMinimizeData *) funcData)->evalModel;168 psVector *inputParameterList = NULL;164 const psVector* restrict coord = ((psMinimizeData* ) funcData)->coord; 165 const psVector* restrict mask = ((psMinimizeData* ) funcData)->paramMask; 166 psVector* restrict initialGuess = ((psMinimizeData* ) funcData)->initialGuess; 167 float (*evalModel) (const psVector* , const psVector* ) = ((psMinimizeData* ) funcData)->evalModel; 168 psVector* inputParameterList = NULL; 169 169 170 170 // The GSL routines will call this function with the masked parameters … … 216 216 int j; // Loop index variable. 217 217 float tmpf; // Temporary floating point variable. 218 const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;219 const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;220 psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;221 float (*d_evalModel) (const psVector *, const psVector *, int) =222 ((psMinimizeData *) funcData)->d_evalModel;223 psVector *inputParameterList = NULL;218 const psVector* restrict coord = ((psMinimizeData* ) funcData)->coord; 219 const psVector* restrict mask = ((psMinimizeData* ) funcData)->paramMask; 220 psVector* restrict initialGuess = ((psMinimizeData* ) funcData)->initialGuess; 221 float (*d_evalModel) (const psVector* , const psVector* , int) = 222 ((psMinimizeData* ) funcData)->d_evalModel; 223 psVector* inputParameterList = NULL; 224 224 225 225 // The GSL routines will call this function with the masked parameters … … 293 293 int j; // Loop index variable. 294 294 float tmpf; // Temporary floating point variable. 295 const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;296 const psVector *restrict data = ((psMinChi2Data *) funcData)->data;297 const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;298 const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;299 psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;300 float (*evalModel) (const psVector *, const psVector *) = ((psMinChi2Data *) funcData)->evalModel;301 psVector *inputParameterList = NULL;302 psVector *tmpVecPtr = NULL;295 const psImage* restrict domain = ((psMinChi2Data* ) funcData)->domain; 296 const psVector* restrict data = ((psMinChi2Data* ) funcData)->data; 297 const psVector* restrict errors = ((psMinChi2Data* ) funcData)->errors; 298 const psVector* restrict mask = ((psMinChi2Data* ) funcData)->paramMask; 299 psVector* restrict initialGuess = ((psMinChi2Data* ) funcData)->initialGuess; 300 float (*evalModel) (const psVector* , const psVector* ) = ((psMinChi2Data* ) funcData)->evalModel; 301 psVector* inputParameterList = NULL; 302 psVector* tmpVecPtr = NULL; 303 303 304 304 tmpVecPtr = psVectorAlloc(domain->numCols, PS_TYPE_F32); … … 360 360 int p_psMinChi2FuncDeriv(const gsl_vector * params, void *funcData, gsl_matrix * J) 361 361 { 362 const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;363 const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;364 const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;365 psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;366 psVector *inputParameterList = NULL;367 psVector *tmpVecPtr = NULL;368 float (*d_evalModel) (const psVector *, const psVector *, int) =369 ((psMinChi2Data *) funcData)->d_evalModel;362 const psImage* restrict domain = ((psMinChi2Data* ) funcData)->domain; 363 const psVector* restrict errors = ((psMinChi2Data* ) funcData)->errors; 364 const psVector* restrict mask = ((psMinChi2Data* ) funcData)->paramMask; 365 psVector* restrict initialGuess = ((psMinChi2Data* ) funcData)->initialGuess; 366 psVector* inputParameterList = NULL; 367 psVector* tmpVecPtr = NULL; 368 float (*d_evalModel) (const psVector* , const psVector* , int) = 369 ((psMinChi2Data* ) funcData)->d_evalModel; 370 370 371 371 size_t i; … … 426 426 returned as a psVector sums. 427 427 *****************************************************************************/ 428 void p_psBuildSums1D(double x, int polyOrder, psVector * sums)428 void p_psBuildSums1D(double x, int polyOrder, psVector* sums) 429 429 { 430 430 int i = 0; … … 442 442 values of the vector will be scaled uniformly between -1.0 and 1.0. 443 443 *****************************************************************************/ 444 psVector *psBuildImageScalingFactors(int x)444 psVector* psBuildImageScalingFactors(int x) 445 445 { 446 446 int i = 0; // loop index variable. 447 psVector *imageScalingFactors = NULL;447 psVector* imageScalingFactors = NULL; 448 448 449 449 imageScalingFactors = psVectorAlloc(x, PS_TYPE_F32); … … 556 556 parameters of that function such that the ... 557 557 *****************************************************************************/ 558 psVector *psMinimize(psVector* restrict initialGuess,559 float (*myFunction) (const psVector * restrict, const psVector* restrict),560 float (*myFunctionDeriv) (const psVector * restrict, const psVector* restrict, int),561 const psVector * restrict coord, const psVector* restrict paramMask)558 psVector* psMinimize(psVector* restrict initialGuess, 559 float (*myFunction) (const psVector* restrict, const psVector* restrict), 560 float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int), 561 const psVector* restrict coord, const psVector* restrict paramMask) 562 562 { 563 563 int status; … … 664 664 such that they best fit the supplied data points. 665 665 *****************************************************************************/ 666 psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector* restrict),667 float (*DevalModel) (const psVector * restrict, const psVector* restrict, int),668 const psImage * restrict domain,669 const psVector * restrict data,670 const psVector * restrict errors,671 psVector * restrict initialGuess, const psVector* restrict paramMask, float *chiSq)666 psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict), 667 float (*DevalModel) (const psVector* restrict, const psVector* restrict, int), 668 const psImage* restrict domain, 669 const psVector* restrict data, 670 const psVector* restrict errors, 671 psVector* restrict initialGuess, const psVector* restrict paramMask, float *chiSq) 672 672 { 673 673 int numData = domain->numRows; // Number of data points … … 847 847 NOTE: yErr is currently ignored. 848 848 *****************************************************************************/ 849 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D* myPoly,850 const psVector * restrict x,851 const psVector * restrict y, const psVector* restrict yErr)849 psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly, 850 const psVector* restrict x, 851 const psVector* restrict y, const psVector* restrict yErr) 852 852 { 853 853 int polyOrder = myPoly->n; 854 psImage *A = NULL;855 psImage *ALUD = NULL;856 psVector *B = NULL;857 psVector *outPerm = NULL;858 psVector *X = NULL; // NOTE: do we need this?859 psVector *coeffs = NULL;854 psImage* A = NULL; 855 psImage* ALUD = NULL; 856 psVector* B = NULL; 857 psVector* outPerm = NULL; 858 psVector* X = NULL; // NOTE: do we need this? 859 psVector* coeffs = NULL; 860 860 int i = 0; 861 861 int j = 0; 862 862 int k = 0; 863 psVector *xSums = NULL;863 psVector* xSums = NULL; 864 864 865 865 // printf("psVectorFitPolynomial1D()\n"); -
trunk/psLib/src/dataManip/psMinimize.h
r1426 r1440 16 16 17 17 /** This routine must minimize a non-linear function */ 18 psVector *psMinimize(psVector* restrict initialGuess,19 float (*myFunction) (const psVector * restrict, const psVector* restrict),20 float (*myFunctionDeriv) (const psVector * restrict, const psVector* restrict, int),21 const psVector * restrict coord, const psVector* restrict paramMask);18 psVector* psMinimize(psVector* restrict initialGuess, 19 float (*myFunction) (const psVector* restrict, const psVector* restrict), 20 float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int), 21 const psVector* restrict coord, const psVector* restrict paramMask); 22 22 23 23 /** Minimize chi^2 for input data */ 24 psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector* restrict), ///<24 psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict), ///< 25 25 // Model 26 26 // to … … 29 29 // and 30 30 // params) 31 float (*DevalModel) (const psVector * restrict, const psVector* restrict, int), ///<31 float (*DevalModel) (const psVector* restrict, const psVector* restrict, int), ///< 32 32 // Derivative 33 33 // of … … 38 38 // and 39 39 // params) 40 const psImage * restrict domain, ///< The domain values for the corresponding40 const psImage* restrict domain, ///< The domain values for the corresponding 41 41 // measurements 42 const psVector * restrict data, ///< Data to fit43 const psVector * restrict errors, ///< Errors in the data44 psVector * restrict initialGuess, ///< Initial guess45 const psVector * restrict paramMask, ///< 1 = fit for parameter, 0 = hold42 const psVector* restrict data, ///< Data to fit 43 const psVector* restrict errors, ///< Errors in the data 44 psVector* restrict initialGuess, ///< Initial guess 45 const psVector* restrict paramMask, ///< 1 = fit for parameter, 0 = hold 46 46 // parameter constant 47 47 float *chiSq); 48 48 49 49 /** Derive a polynomial fit by chi^2 minimisation (analytically) */ 50 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D* myPoly, ///< Polynomial to fit51 const psVector * restrict x, ///< Ordinates (or NULL to just use50 psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly, ///< Polynomial to fit 51 const psVector* restrict x, ///< Ordinates (or NULL to just use 52 52 // the indices) 53 const psVector * restrict y, ///< Coordinates54 const psVector * restrict yErr ///< Errors in coordinates, or NULL53 const psVector* restrict y, ///< Coordinates 54 const psVector* restrict yErr ///< Errors in coordinates, or NULL 55 55 ); 56 56 -
trunk/psLib/src/dataManip/psStats.c
r1407 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:57 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 #define MAX_ITERATIONS 10 55 55 56 void p_psVectorRobustStats(const psVector * restrict myVector,57 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats);56 void p_psVectorRobustStats(const psVector* restrict myVector, 57 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats); 58 58 59 59 /** Preprocessor macro to generate error on an incorrect type */ … … 116 116 /*****************************************************************************/ 117 117 118 bool p_psGetStatValue(const psStats * stats, double *value)118 bool p_psGetStatValue(const psStats* stats, double *value) 119 119 { 120 120 … … 175 175 *****************************************************************************/ 176 176 177 void p_psVectorPrint(psVector * myVector, psVector * maskVector, unsigned int maskVal, psStats* stats)177 void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats) 178 178 { 179 179 int i = 0; // Loop index variable. … … 218 218 *****************************************************************************/ 219 219 220 void p_psVectorSampleMean(const psVector * restrict myVector,221 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)220 void p_psVectorSampleMean(const psVector* restrict myVector, 221 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 222 222 { 223 223 int i = 0; // Loop index variable … … 282 282 NULL 283 283 *****************************************************************************/ 284 void p_psVectorMax(const psVector * restrict myVector,285 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)284 void p_psVectorMax(const psVector* restrict myVector, 285 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 286 286 { 287 287 int i = 0; // Loop index variable … … 343 343 NULL 344 344 *****************************************************************************/ 345 void p_psVectorMin(const psVector * restrict myVector,346 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)345 void p_psVectorMin(const psVector* restrict myVector, 346 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 347 347 { 348 348 int i = 0; // Loop index variable … … 404 404 NULL 405 405 *****************************************************************************/ 406 int p_psVectorNValues(const psVector * restrict myVector,407 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)406 int p_psVectorNValues(const psVector* restrict myVector, 407 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 408 408 { 409 409 int i = 0; // Loop index variable … … 456 456 NULL 457 457 *****************************************************************************/ 458 void p_psVectorSampleMedian(const psVector * restrict myVector,459 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)460 { 461 psVector *unsortedVector = NULL; // Temporary vector462 psVector *sortedVector = NULL; // Temporary vector458 void p_psVectorSampleMedian(const psVector* restrict myVector, 459 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 460 { 461 psVector* unsortedVector = NULL; // Temporary vector 462 psVector* sortedVector = NULL; // Temporary vector 463 463 int i = 0; // Loop index variable 464 464 int count = 0; // # of points in this mean? … … 565 565 XXX: use a static variable for gaussianCoefs[] and compute them once. 566 566 *****************************************************************************/ 567 psVector *p_psVectorsmoothHistGaussian(psHistogram* robustHistogram, float sigma)567 psVector* p_psVectorsmoothHistGaussian(psHistogram* robustHistogram, float sigma) 568 568 { 569 569 int i = 0; // Loop index variable … … 572 572 float expo = 0.0; // Temporary variable 573 573 float gaussianCoefs[1 + (2 * GAUSS_WIDTH)]; // The Gaussian Coefficients 574 psVector *smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);574 psVector* smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32); 575 575 576 576 for (i = 0; i < (1 + (2 * GAUSS_WIDTH)); i++) { … … 628 628 NULL 629 629 *****************************************************************************/ 630 void p_psVectorSampleQuartiles(const psVector * restrict myVector,631 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)632 { 633 psVector *unsortedVector = NULL; // Temporary vector634 psVector *sortedVector = NULL; // Temporary vector630 void p_psVectorSampleQuartiles(const psVector* restrict myVector, 631 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 632 { 633 psVector* unsortedVector = NULL; // Temporary vector 634 psVector* sortedVector = NULL; // Temporary vector 635 635 int i = 0; // Loop index variable 636 636 int count = 0; // # of points in this mean? … … 710 710 711 711 *****************************************************************************/ 712 void p_psVectorSampleStdev(const psVector * restrict myVector,713 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)712 void p_psVectorSampleStdev(const psVector* restrict myVector, 713 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 714 714 { 715 715 int i = 0; // Loop index variable … … 795 795 NULL 796 796 *****************************************************************************/ 797 void p_psVectorClippedStats(const psVector * restrict myVector,798 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)797 void p_psVectorClippedStats(const psVector* restrict myVector, 798 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 799 799 { 800 800 int i = 0; // Loop index variable … … 804 804 float oldStanMean = 0.0; // Temporary variable 805 805 float oldStanStdev = 0.0; // Temporary variable 806 psVector *tmpMask = NULL; // Temporary vector806 psVector* tmpMask = NULL; // Temporary vector 807 807 808 808 // Endure that stats->clipIter is within the proper range. … … 884 884 elements of a vector to a range between 0.0 and 1.0. 885 885 *****************************************************************************/ 886 void p_psNormalizeVector(psVector * myData)886 void p_psNormalizeVector(psVector* myData) 887 887 { 888 888 float min = (float)HUGE; … … 911 911 specified data point. 912 912 *****************************************************************************/ 913 float p_psGaussian(const psVector * restrict myData, const psVector* restrict myParams)913 float p_psGaussian(const psVector* restrict myData, const psVector* restrict myParams) 914 914 { 915 915 float x = myData->data.F32[0]; … … 928 928 calculates the specified partial derivative of the above Gaussian function. 929 929 *****************************************************************************/ 930 float p_psGaussianDeriv(const psVector * restrict myData, const psVector* restrict myParams, int whichParam)930 float p_psGaussianDeriv(const psVector* restrict myData, const psVector* restrict myParams, int whichParam) 931 931 { 932 932 float x = myData->data.F32[0]; … … 954 954 specified data point. 955 955 *****************************************************************************/ 956 float p_psQuadratic(const psVector * restrict myParams, const psVector* restrict myCoords)956 float p_psQuadratic(const psVector* restrict myParams, const psVector* restrict myCoords) 957 957 { 958 958 float x = myCoords->data.F32[0]; … … 970 970 calculates the specified partial derivative of the above quadratic function. 971 971 *****************************************************************************/ 972 float p_psQuadraticDeriv(const psVector * restrict myParams,973 const psVector * restrict myCoords, int whichParamDeriv)972 float p_psQuadraticDeriv(const psVector* restrict myParams, 973 const psVector* restrict myCoords, int whichParamDeriv) 974 974 { 975 975 float x = myCoords->data.F32[0]; … … 996 996 decreasing within that range. 997 997 *****************************************************************************/ 998 float p_ps1DPolyMedian(psPolynomial1D * myPoly, float rangeLow, float rangeHigh, float getThisValue)998 float p_ps1DPolyMedian(psPolynomial1D* myPoly, float rangeLow, float rangeHigh, float getThisValue) 999 999 { 1000 1000 int numIterations = 0; … … 1036 1036 XXX: This function is currently not being used. 1037 1037 *****************************************************************************/ 1038 float p_psFitQuadratic(psHistogram * histogram, psVector* cumulativeSums, int binNum, float fitFloat)1039 { 1040 psVector *x = psVectorAlloc(3, PS_TYPE_F64);1041 psVector *y = psVectorAlloc(3, PS_TYPE_F64);1042 psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);1043 psPolynomial1D *myPoly = psPolynomial1DAlloc(2);1038 float p_psFitQuadratic(psHistogram* histogram, psVector* cumulativeSums, int binNum, float fitFloat) 1039 { 1040 psVector* x = psVectorAlloc(3, PS_TYPE_F64); 1041 psVector* y = psVectorAlloc(3, PS_TYPE_F64); 1042 psVector* yErr = psVectorAlloc(3, PS_TYPE_F64); 1043 psPolynomial1D* myPoly = psPolynomial1DAlloc(2); 1044 1044 1045 1045 if ((binNum > 0) && (binNum < (histogram->nums->n + 1))) { … … 1100 1100 NULL 1101 1101 *****************************************************************************/ 1102 void p_psVectorRobustStats(const psVector * restrict myVector,1103 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)1104 { 1105 psHistogram *robustHistogram = NULL;1106 psVector *robustHistogramVector = NULL;1102 void p_psVectorRobustStats(const psVector* restrict myVector, 1103 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 1104 { 1105 psHistogram* robustHistogram = NULL; 1106 psVector* robustHistogramVector = NULL; 1107 1107 float binSize = 0.0; // Size of the histogram bins 1108 1108 int LQBinNum = -1; // Bin num for lower quartile … … 1113 1113 float dL = 0.0; 1114 1114 int numBins = 0; 1115 psStats *tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);1116 1117 // psImage *domain;1118 // psVector *errors;1119 // psVector *data;1120 // psVector *initialGuess;1121 // psVector *theParams;1115 psStats* tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN); 1116 1117 // psImage* domain; 1118 // psVector* errors; 1119 // psVector* data; 1120 // psVector* initialGuess; 1121 // psVector* theParams; 1122 1122 // float chiSq=0.0; 1123 1123 // float max = -HUGE; … … 1129 1129 float sumSquares = 0.0; 1130 1130 float sumDiffs = 0.0; 1131 psVector *x = psVectorAlloc(3, PS_TYPE_F64);1132 psVector *y = psVectorAlloc(3, PS_TYPE_F64);1133 psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);1134 psPolynomial1D *myPoly = psPolynomial1DAlloc(2);1135 psVector *cumulativeRobustSumsFullRange = NULL;1136 psVector *cumulativeRobustSumsDlRange = NULL;1131 psVector* x = psVectorAlloc(3, PS_TYPE_F64); 1132 psVector* y = psVectorAlloc(3, PS_TYPE_F64); 1133 psVector* yErr = psVectorAlloc(3, PS_TYPE_F64); 1134 psPolynomial1D* myPoly = psPolynomial1DAlloc(2); 1135 psVector* cumulativeRobustSumsFullRange = NULL; 1136 psVector* cumulativeRobustSumsDlRange = NULL; 1137 1137 float sumRobust = 0.0; 1138 1138 float sumN50 = 0.0; … … 1500 1500 /*****************************************************************************/ 1501 1501 1502 static void histogramFree(psHistogram * myHist);1502 static void histogramFree(psHistogram* myHist); 1503 1503 1504 1504 /****************************************************************************** 1505 1505 psStatsAlloc(): This routine must create a new psStats data structure. 1506 1506 *****************************************************************************/ 1507 psStats *psStatsAlloc(psStatsOptions options)1508 { 1509 psStats *newStruct = NULL;1510 1511 newStruct = (psStats *) psAlloc(sizeof(psStats));1507 psStats* psStatsAlloc(psStatsOptions options) 1508 { 1509 psStats* newStruct = NULL; 1510 1511 newStruct = (psStats* ) psAlloc(sizeof(psStats)); 1512 1512 newStruct->sampleMean = NAN; 1513 1513 newStruct->sampleMedian = NAN; … … 1548 1548 The histogram structure 1549 1549 *****************************************************************************/ 1550 psHistogram *psHistogramAlloc(float lower, float upper, int n)1550 psHistogram* psHistogramAlloc(float lower, float upper, int n) 1551 1551 { 1552 1552 int i = 0; // Loop index variable 1553 psHistogram *newHist = NULL; // The new histogram structure1553 psHistogram* newHist = NULL; // The new histogram structure 1554 1554 float binSize = 0.0; // The histogram bin size 1555 1555 … … 1567 1567 // Allocate memory for the new histogram structure. If there are N 1568 1568 // bins, then there are N+1 bounds to those bins. 1569 newHist = (psHistogram *) psAlloc(sizeof(psHistogram));1569 newHist = (psHistogram* ) psAlloc(sizeof(psHistogram)); 1570 1570 p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree); 1571 1571 newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32); … … 1605 1605 The histogram structure 1606 1606 *****************************************************************************/ 1607 psHistogram *psHistogramAllocGeneric(const psVector* restrict bounds)1608 { 1609 psHistogram *newHist = NULL; // The new histogram structure1607 psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds) 1608 { 1609 psHistogram* newHist = NULL; // The new histogram structure 1610 1610 int i; // Loop index variable 1611 1611 … … 1626 1626 } 1627 1627 // Allocate memory for the new histogram structure. 1628 newHist = (psHistogram *) psAlloc(sizeof(psHistogram));1628 newHist = (psHistogram* ) psAlloc(sizeof(psHistogram)); 1629 1629 p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree); 1630 1630 newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32); … … 1650 1650 } 1651 1651 1652 static void histogramFree(psHistogram * myHist)1652 static void histogramFree(psHistogram* myHist) 1653 1653 { 1654 1654 psFree(myHist->bounds); … … 1670 1670 The histogram structure "out". 1671 1671 *****************************************************************************/ 1672 psHistogram *psVectorHistogram(psHistogram* out,1673 const psVector * restrict in,1674 const psVector * restrict mask, unsigned int maskVal)1672 psHistogram* psVectorHistogram(psHistogram* out, 1673 const psVector* restrict in, 1674 const psVector* restrict mask, unsigned int maskVal) 1675 1675 { 1676 1676 int i = 0; // Loop index variable … … 1767 1767 the various stat functions. 1768 1768 *****************************************************************************/ 1769 psVector *p_psConvertToF32(psStats * stats, psVector * in, psVector* mask, unsigned int maskVal)1769 psVector* p_psConvertToF32(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal) 1770 1770 { 1771 1771 int i = 0; 1772 psVector *tmp = NULL;1772 psVector* tmp = NULL; 1773 1773 1774 1774 if (in->type.type == PS_TYPE_S32) { … … 1812 1812 macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64. 1813 1813 *****************************************************************************/ 1814 psStats *psVectorStats(psStats * stats, psVector * in, psVector* mask, unsigned int maskVal)1815 { 1816 psVector *inF32;1814 psStats* psVectorStats(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal) 1815 { 1816 psVector* inF32; 1817 1817 int mustFreeTmp = 1; 1818 1818 -
trunk/psLib/src/dataManip/psStats.h
r1426 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:57 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 77 77 78 78 /** Do Statistics on an array. Returns a status value. \ingroup MathGroup */ 79 psStats *psVectorStats(psStats* stats, ///< stats structure defines stats to be calculated and how80 psVector * in, ///< Vector to be analysed: must be F3281 psVector * mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT79 psStats* psVectorStats(psStats* stats, ///< stats structure defines stats to be calculated and how 80 psVector* in, ///< Vector to be analysed: must be F32 81 psVector* mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT 82 82 // or NULL 83 83 unsigned int maskVal ///< Only mask elements with one of these bits set in … … 86 86 87 87 /** A constructor for the stats structure.*/ 88 psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure88 psStats* psStatsAlloc(psStatsOptions options); ///< Statistics to measure 89 89 90 90 /****************************************************************************** … … 95 95 typedef struct 96 96 { 97 psVector *bounds; ///< Bounds for the bins (type F32)98 psVector *nums; ///< Number in each of the bins (INT)97 psVector* bounds; ///< Bounds for the bins (type F32) 98 psVector* nums; ///< Number in each of the bins (INT) 99 99 int minNum; ///< Number below the minimum 100 100 int maxNum; ///< Number above the maximum … … 104 104 105 105 /** Constructor \ingroup MathGroup */ 106 psHistogram *psHistogramAlloc(float lower, ///< Lower limit for the bins106 psHistogram* psHistogramAlloc(float lower, ///< Lower limit for the bins 107 107 float upper, ///< Upper limit for the bins 108 108 int n); ///< Number of bins 109 109 110 110 /** Generic constructor \ingroup MathGroup */ 111 psHistogram *psHistogramAllocGeneric(const psVector* restrict bounds); ///< Bounds for the bins111 psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds); ///< Bounds for the bins 112 112 113 113 /** Calculate a histogram \ingroup MathGroup **/ 114 psHistogram *psVectorHistogram(psHistogram* out, ///< Histogram data115 const psVector * restrict in, ///< Vector to analyse116 const psVector * restrict mask, ///< Mask dat for input vector114 psHistogram* psVectorHistogram(psHistogram* out, ///< Histogram data 115 const psVector* restrict in, ///< Vector to analyse 116 const psVector* restrict mask, ///< Mask dat for input vector 117 117 unsigned int maskVal); ///< Mask value 118 118 119 bool p_psGetStatValue(const psStats * stats, double *value);119 bool p_psGetStatValue(const psStats* stats, double *value); 120 120 121 121 /// @} -
trunk/psLib/src/dataManip/psVectorFFT.c
r1407 r1440 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-08-0 7 00:06:06$8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-08-09 23:34:57 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static bool p_fftwWisdomImported = false; 29 29 30 psImage *psImageFFT(psImage * out, const psImage* in, psFftDirection direction)30 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction) 31 31 { 32 32 unsigned int numCols; … … 93 93 } 94 94 95 psImage *psImageReal(psImage * out, const psImage* in)95 psImage* psImageReal(psImage* out, const psImage* in) 96 96 { 97 97 psElemType type; … … 117 117 118 118 if (type == PS_TYPE_C32) { 119 psF32 *outRow;120 psC32 *inRow;119 psF32* outRow; 120 psC32* inRow; 121 121 122 122 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); … … 130 130 } 131 131 } else if (type == PS_TYPE_C64) { 132 psF64 *outRow;133 psC64 *inRow;132 psF64* outRow; 133 psC64* inRow; 134 134 135 135 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); … … 151 151 } 152 152 153 psImage *psImageImaginary(psImage * out, const psImage* in)153 psImage* psImageImaginary(psImage* out, const psImage* in) 154 154 { 155 155 psElemType type; … … 177 177 178 178 if (type == PS_TYPE_C32) { 179 psF32 *outRow;180 psC32 *inRow;179 psF32* outRow; 180 psC32* inRow; 181 181 182 182 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); … … 190 190 } 191 191 } else if (type == PS_TYPE_C64) { 192 psF64 *outRow;193 psC64 *inRow;192 psF64* outRow; 193 psC64* inRow; 194 194 195 195 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); … … 211 211 } 212 212 213 psImage *psImageComplex(psImage * out, psImage * real, const psImage* imag)213 psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag) 214 214 { 215 215 psElemType type; … … 251 251 252 252 if (type == PS_TYPE_F32) { 253 psC32 *outRow;254 psF32 *realRow;255 psF32 *imagRow;253 psC32* outRow; 254 psF32* realRow; 255 psF32* imagRow; 256 256 257 257 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); … … 267 267 } 268 268 } else if (type == PS_TYPE_F64) { 269 psC64 *outRow;270 psF64 *realRow;271 psF64 *imagRow;269 psC64* outRow; 270 psF64* realRow; 271 psF64* imagRow; 272 272 273 273 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); … … 290 290 } 291 291 292 psImage *psImageConjugate(psImage * out, const psImage* in)292 psImage* psImageConjugate(psImage* out, const psImage* in) 293 293 { 294 294 psElemType type; … … 314 314 315 315 if (type == PS_TYPE_C32) { 316 psC32 *outRow;317 psC32 *inRow;316 psC32* outRow; 317 psC32* inRow; 318 318 319 319 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); … … 327 327 } 328 328 } else if (type == PS_TYPE_C64) { 329 psC64 *outRow;330 psC64 *inRow;329 psC64* outRow; 330 psC64* inRow; 331 331 332 332 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); … … 348 348 } 349 349 350 psImage *psImagePowerSpectrum(psImage * out, const psImage* in)350 psImage* psImagePowerSpectrum(psImage* out, const psImage* in) 351 351 { 352 352 psElemType type; … … 373 373 374 374 if (type == PS_TYPE_C32) { 375 psF32 *outRow;376 psC32 *inRow;375 psF32* outRow; 376 psC32* inRow; 377 377 psF32 real; 378 378 psF32 imag; … … 390 390 } 391 391 } else if (type == PS_TYPE_C64) { 392 psF64 *outRow;393 psC64 *inRow;392 psF64* outRow; 393 psC64* inRow; 394 394 psF64 real; 395 395 psF64 imag; … … 418 418 /************************************** Vector Functions ***************************************/ 419 419 420 psVector *psVectorFFT(psVector * out, const psVector* in, psFftDirection direction)420 psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction) 421 421 { 422 422 unsigned int numElements; … … 464 464 if (type == PS_TYPE_F32) { 465 465 // need to convert to complex 466 psC32 *outVec = out->data.C32;467 psF32 *inVec = in->data.F32;466 psC32* outVec = out->data.C32; 467 psF32* inVec = in->data.F32; 468 468 469 469 for (unsigned int i = 0; i < numElements; i++) { … … 471 471 } 472 472 } else { 473 psC32 *outVec = out->data.C32;474 psC32 *inVec = in->data.C32;473 psC32* outVec = out->data.C32; 474 psC32* inVec = in->data.C32; 475 475 476 476 for (unsigned int i = 0; i < numElements; i++) { … … 498 498 } 499 499 500 psVector *psVectorReal(psVector * out, const psVector* in)500 psVector* psVectorReal(psVector* out, const psVector* in) 501 501 { 502 502 psElemType type; … … 523 523 524 524 if (type == PS_TYPE_C32) { 525 psF32 *outVec;526 psC32 *inVec = in->data.C32;525 psF32* outVec; 526 psC32* inVec = in->data.C32; 527 527 528 528 out = psVectorRecycle(out, numElements, PS_TYPE_F32); … … 542 542 } 543 543 544 psVector *psVectorImaginary(psVector * out, const psVector* in)544 psVector* psVectorImaginary(psVector* out, const psVector* in) 545 545 { 546 546 psElemType type; … … 567 567 568 568 if (type == PS_TYPE_C32) { 569 psF32 *outVec;570 psC32 *inVec = in->data.C32;569 psF32* outVec; 570 psC32* inVec = in->data.C32; 571 571 572 572 out = psVectorRecycle(out, numElements, PS_TYPE_F32); … … 586 586 } 587 587 588 psVector *psVectorComplex(psVector * out, psVector * real, const psVector* imag)588 psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag) 589 589 { 590 590 psElemType type; … … 616 616 617 617 if (type == PS_TYPE_F32) { 618 psC32 *outVec;619 psF32 *realVec = real->data.F32;620 psF32 *imagVec = imag->data.F32;618 psC32* outVec; 619 psF32* realVec = real->data.F32; 620 psF32* imagVec = imag->data.F32; 621 621 622 622 out = psVectorRecycle(out, numElements, PS_TYPE_C32); … … 636 636 } 637 637 638 psVector *psVectorConjugate(psVector * out, const psVector* in)638 psVector* psVectorConjugate(psVector* out, const psVector* in) 639 639 { 640 640 psElemType type; … … 662 662 663 663 if (type == PS_TYPE_C32) { 664 psC32 *outVec;665 psC32 *inVec = in->data.C32;664 psC32* outVec; 665 psC32* inVec = in->data.C32; 666 666 667 667 out = psVectorRecycle(out, numElements, PS_TYPE_C32); … … 681 681 } 682 682 683 psVector *psVectorPowerSpectrum(psVector * out, const psVector* in)683 psVector* psVectorPowerSpectrum(psVector* out, const psVector* in) 684 684 { 685 685 psElemType type; … … 708 708 709 709 if (type == PS_TYPE_C32) { 710 psF32 *outVec;711 psC32 *inVec = in->data.C32;710 psF32* outVec; 711 psC32* inVec = in->data.C32; 712 712 psF32 inAbs1; 713 713 psF32 inAbs2; -
trunk/psLib/src/dataManip/psVectorFFT.h
r1426 r1440 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-09 2 2:44:25$10 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-09 23:34:57 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 } psFftDirection; 34 34 35 psImage *psImageFFT(psImage * out, const psImage* in, psFftDirection direction);36 psImage *psImageReal(psImage * out, const psImage* in);37 psImage *psImageImaginary(psImage * out, const psImage* in);38 psImage *psImageComplex(psImage * out, psImage * real, const psImage* imag);39 psImage *psImageConjugate(psImage * out, const psImage* in);40 psImage *psImagePowerSpectrum(psImage * out, const psImage* in);35 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction); 36 psImage* psImageReal(psImage* out, const psImage* in); 37 psImage* psImageImaginary(psImage* out, const psImage* in); 38 psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag); 39 psImage* psImageConjugate(psImage* out, const psImage* in); 40 psImage* psImagePowerSpectrum(psImage* out, const psImage* in); 41 41 42 psVector *psVectorFFT(psVector * out, const psVector* in, psFftDirection direction);43 psVector *psVectorReal(psVector * out, const psVector* in);44 psVector *psVectorImaginary(psVector * out, const psVector* in);45 psVector *psVectorComplex(psVector * out, psVector * real, const psVector* imag);46 psVector *psVectorConjugate(psVector * out, const psVector* in);47 psVector *psVectorPowerSpectrum(psVector * out, const psVector* in);42 psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction); 43 psVector* psVectorReal(psVector* out, const psVector* in); 44 psVector* psVectorImaginary(psVector* out, const psVector* in); 45 psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag); 46 psVector* psVectorConjugate(psVector* out, const psVector* in); 47 psVector* psVectorPowerSpectrum(psVector* out, const psVector* in); 48 48 49 49 /// @} -
trunk/psLib/src/fft/psVectorFFT.c
r1407 r1440 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-08-0 7 00:06:06$8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-08-09 23:34:57 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static bool p_fftwWisdomImported = false; 29 29 30 psImage *psImageFFT(psImage * out, const psImage* in, psFftDirection direction)30 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction) 31 31 { 32 32 unsigned int numCols; … … 93 93 } 94 94 95 psImage *psImageReal(psImage * out, const psImage* in)95 psImage* psImageReal(psImage* out, const psImage* in) 96 96 { 97 97 psElemType type; … … 117 117 118 118 if (type == PS_TYPE_C32) { 119 psF32 *outRow;120 psC32 *inRow;119 psF32* outRow; 120 psC32* inRow; 121 121 122 122 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); … … 130 130 } 131 131 } else if (type == PS_TYPE_C64) { 132 psF64 *outRow;133 psC64 *inRow;132 psF64* outRow; 133 psC64* inRow; 134 134 135 135 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); … … 151 151 } 152 152 153 psImage *psImageImaginary(psImage * out, const psImage* in)153 psImage* psImageImaginary(psImage* out, const psImage* in) 154 154 { 155 155 psElemType type; … … 177 177 178 178 if (type == PS_TYPE_C32) { 179 psF32 *outRow;180 psC32 *inRow;179 psF32* outRow; 180 psC32* inRow; 181 181 182 182 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); … … 190 190 } 191 191 } else if (type == PS_TYPE_C64) { 192 psF64 *outRow;193 psC64 *inRow;192 psF64* outRow; 193 psC64* inRow; 194 194 195 195 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); … … 211 211 } 212 212 213 psImage *psImageComplex(psImage * out, psImage * real, const psImage* imag)213 psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag) 214 214 { 215 215 psElemType type; … … 251 251 252 252 if (type == PS_TYPE_F32) { 253 psC32 *outRow;254 psF32 *realRow;255 psF32 *imagRow;253 psC32* outRow; 254 psF32* realRow; 255 psF32* imagRow; 256 256 257 257 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); … … 267 267 } 268 268 } else if (type == PS_TYPE_F64) { 269 psC64 *outRow;270 psF64 *realRow;271 psF64 *imagRow;269 psC64* outRow; 270 psF64* realRow; 271 psF64* imagRow; 272 272 273 273 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); … … 290 290 } 291 291 292 psImage *psImageConjugate(psImage * out, const psImage* in)292 psImage* psImageConjugate(psImage* out, const psImage* in) 293 293 { 294 294 psElemType type; … … 314 314 315 315 if (type == PS_TYPE_C32) { 316 psC32 *outRow;317 psC32 *inRow;316 psC32* outRow; 317 psC32* inRow; 318 318 319 319 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); … … 327 327 } 328 328 } else if (type == PS_TYPE_C64) { 329 psC64 *outRow;330 psC64 *inRow;329 psC64* outRow; 330 psC64* inRow; 331 331 332 332 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); … … 348 348 } 349 349 350 psImage *psImagePowerSpectrum(psImage * out, const psImage* in)350 psImage* psImagePowerSpectrum(psImage* out, const psImage* in) 351 351 { 352 352 psElemType type; … … 373 373 374 374 if (type == PS_TYPE_C32) { 375 psF32 *outRow;376 psC32 *inRow;375 psF32* outRow; 376 psC32* inRow; 377 377 psF32 real; 378 378 psF32 imag; … … 390 390 } 391 391 } else if (type == PS_TYPE_C64) { 392 psF64 *outRow;393 psC64 *inRow;392 psF64* outRow; 393 psC64* inRow; 394 394 psF64 real; 395 395 psF64 imag; … … 418 418 /************************************** Vector Functions ***************************************/ 419 419 420 psVector *psVectorFFT(psVector * out, const psVector* in, psFftDirection direction)420 psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction) 421 421 { 422 422 unsigned int numElements; … … 464 464 if (type == PS_TYPE_F32) { 465 465 // need to convert to complex 466 psC32 *outVec = out->data.C32;467 psF32 *inVec = in->data.F32;466 psC32* outVec = out->data.C32; 467 psF32* inVec = in->data.F32; 468 468 469 469 for (unsigned int i = 0; i < numElements; i++) { … … 471 471 } 472 472 } else { 473 psC32 *outVec = out->data.C32;474 psC32 *inVec = in->data.C32;473 psC32* outVec = out->data.C32; 474 psC32* inVec = in->data.C32; 475 475 476 476 for (unsigned int i = 0; i < numElements; i++) { … … 498 498 } 499 499 500 psVector *psVectorReal(psVector * out, const psVector* in)500 psVector* psVectorReal(psVector* out, const psVector* in) 501 501 { 502 502 psElemType type; … … 523 523 524 524 if (type == PS_TYPE_C32) { 525 psF32 *outVec;526 psC32 *inVec = in->data.C32;525 psF32* outVec; 526 psC32* inVec = in->data.C32; 527 527 528 528 out = psVectorRecycle(out, numElements, PS_TYPE_F32); … … 542 542 } 543 543 544 psVector *psVectorImaginary(psVector * out, const psVector* in)544 psVector* psVectorImaginary(psVector* out, const psVector* in) 545 545 { 546 546 psElemType type; … … 567 567 568 568 if (type == PS_TYPE_C32) { 569 psF32 *outVec;570 psC32 *inVec = in->data.C32;569 psF32* outVec; 570 psC32* inVec = in->data.C32; 571 571 572 572 out = psVectorRecycle(out, numElements, PS_TYPE_F32); … … 586 586 } 587 587 588 psVector *psVectorComplex(psVector * out, psVector * real, const psVector* imag)588 psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag) 589 589 { 590 590 psElemType type; … … 616 616 617 617 if (type == PS_TYPE_F32) { 618 psC32 *outVec;619 psF32 *realVec = real->data.F32;620 psF32 *imagVec = imag->data.F32;618 psC32* outVec; 619 psF32* realVec = real->data.F32; 620 psF32* imagVec = imag->data.F32; 621 621 622 622 out = psVectorRecycle(out, numElements, PS_TYPE_C32); … … 636 636 } 637 637 638 psVector *psVectorConjugate(psVector * out, const psVector* in)638 psVector* psVectorConjugate(psVector* out, const psVector* in) 639 639 { 640 640 psElemType type; … … 662 662 663 663 if (type == PS_TYPE_C32) { 664 psC32 *outVec;665 psC32 *inVec = in->data.C32;664 psC32* outVec; 665 psC32* inVec = in->data.C32; 666 666 667 667 out = psVectorRecycle(out, numElements, PS_TYPE_C32); … … 681 681 } 682 682 683 psVector *psVectorPowerSpectrum(psVector * out, const psVector* in)683 psVector* psVectorPowerSpectrum(psVector* out, const psVector* in) 684 684 { 685 685 psElemType type; … … 708 708 709 709 if (type == PS_TYPE_C32) { 710 psF32 *outVec;711 psC32 *inVec = in->data.C32;710 psF32* outVec; 711 psC32* inVec = in->data.C32; 712 712 psF32 inAbs1; 713 713 psF32 inAbs2; -
trunk/psLib/src/fft/psVectorFFT.h
r1426 r1440 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-09 2 2:44:25$10 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-09 23:34:57 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 } psFftDirection; 34 34 35 psImage *psImageFFT(psImage * out, const psImage* in, psFftDirection direction);36 psImage *psImageReal(psImage * out, const psImage* in);37 psImage *psImageImaginary(psImage * out, const psImage* in);38 psImage *psImageComplex(psImage * out, psImage * real, const psImage* imag);39 psImage *psImageConjugate(psImage * out, const psImage* in);40 psImage *psImagePowerSpectrum(psImage * out, const psImage* in);35 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction); 36 psImage* psImageReal(psImage* out, const psImage* in); 37 psImage* psImageImaginary(psImage* out, const psImage* in); 38 psImage* psImageComplex(psImage* out, psImage* real, const psImage* imag); 39 psImage* psImageConjugate(psImage* out, const psImage* in); 40 psImage* psImagePowerSpectrum(psImage* out, const psImage* in); 41 41 42 psVector *psVectorFFT(psVector * out, const psVector* in, psFftDirection direction);43 psVector *psVectorReal(psVector * out, const psVector* in);44 psVector *psVectorImaginary(psVector * out, const psVector* in);45 psVector *psVectorComplex(psVector * out, psVector * real, const psVector* imag);46 psVector *psVectorConjugate(psVector * out, const psVector* in);47 psVector *psVectorPowerSpectrum(psVector * out, const psVector* in);42 psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction); 43 psVector* psVectorReal(psVector* out, const psVector* in); 44 psVector* psVectorImaginary(psVector* out, const psVector* in); 45 psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag); 46 psVector* psVectorConjugate(psVector* out, const psVector* in); 47 psVector* psVectorPowerSpectrum(psVector* out, const psVector* in); 48 48 49 49 /// @} -
trunk/psLib/src/image/psImage.c
r1407 r1440 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 #include "psImage.h" 33 33 34 static void imageFree(psImage * image);34 static void imageFree(psImage* image); 35 35 36 36 /*****************************************************************************/ … … 40 40 /*****************************************************************************/ 41 41 42 psImage *psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type)42 psImage* psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type) 43 43 { 44 44 int area = 0; … … 61 61 } 62 62 63 psImage *image = (psImage *) psAlloc(sizeof(psImage));63 psImage* image = (psImage* ) psAlloc(sizeof(psImage)); 64 64 65 65 if (image == NULL) { … … 87 87 *(unsigned int *)&image->numCols = numCols; 88 88 *(unsigned int *)&image->numRows = numRows; 89 *(psDimen *) & image->type.dimen = PS_DIMEN_IMAGE;90 *(psElemType *) & image->type.type = type;89 *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE; 90 *(psElemType* ) & image->type.type = type; 91 91 image->parent = NULL; 92 92 image->nChildren = 0; … … 96 96 } 97 97 98 static void imageFree(psImage * image)98 static void imageFree(psImage* image) 99 99 { 100 100 if (image == NULL) { … … 107 107 unsigned int oldNumRows = image->numRows; 108 108 unsigned int oldNumCols = image->numCols; 109 psPTR *rowPtr;109 psPTR* rowPtr; 110 110 111 111 for (unsigned int row = 0; row < oldNumRows; row++) { … … 124 124 } 125 125 126 psImage *psImageRecycle(psImage* old, unsigned int numCols, unsigned int numRows, const psElemType type)126 psImage* psImageRecycle(psImage* old, unsigned int numCols, unsigned int numRows, const psElemType type) 127 127 { 128 128 int elementSize = PSELEMTYPE_SIZEOF(type); // element … … 151 151 unsigned int oldNumRows = old->numRows; 152 152 unsigned int oldNumCols = old->numCols; 153 psPTR *rowPtr;153 psPTR* rowPtr; 154 154 155 155 for (unsigned int row = 0; row < oldNumRows; row++) { … … 177 177 *(unsigned int *)&old->numCols = numCols; 178 178 *(unsigned int *)&old->numRows = numRows; 179 *(psElemType *) & old->type.type = type;179 *(psElemType* ) & old->type.type = type; 180 180 181 181 return old; 182 182 } 183 183 184 int psImageFreeChildren(psImage * image)184 int psImageFreeChildren(psImage* image) 185 185 { 186 186 int i = 0; 187 187 int nChildren = 0; 188 psImage **children = NULL;188 psImage* *children = NULL; 189 189 int numFreed = 0; 190 190 … … 216 216 linear interpolation is performed on the image. 217 217 *****************************************************************************/ 218 psF32 psImagePixelInterpolate(const psImage * input,218 psF32 psImagePixelInterpolate(const psImage* input, 219 219 float x, float y, psF32 unexposedValue, psImageInterpolateMode mode) 220 220 { … … 259 259 260 260 #define PSIMAGE_PIXEL_INTERPOLATE_FLAT(TYPE) \ 261 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage *input, \261 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage* input, \ 262 262 float x, \ 263 263 float y, \ … … 280 280 281 281 #define PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(TYPE) \ 282 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage *input, \282 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage* input, \ 283 283 float x, \ 284 284 float y, \ … … 313 313 PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(C64) 314 314 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(TYPE) \ 315 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \315 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage* input, \ 316 316 float x, \ 317 317 float y, \ … … 368 368 } 369 369 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(TYPE) \ 370 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \370 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage* input, \ 371 371 float x, \ 372 372 float y, \ -
trunk/psLib/src/image/psImage.h
r1426 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 29$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 2 2:44:25$14 * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:58 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 51 51 union { 52 psU8 **U8; ///< Unsigned 8-bit integer data.53 psU16 **U16; ///< Unsigned 16-bit integer data.54 psU32 **U32; ///< Unsigned 32-bit integer data.55 psU64 **U64; ///< Unsigned 64-bit integer data.56 psS8 **S8; ///< Signed 8-bit integer data.57 psS16 **S16; ///< Signed 16-bit integer data.58 psS32 **S32; ///< Signed 32-bit integer data.59 psS64 **S64; ///< Signed 64-bit integer data.60 psF32 **F32; ///< Single-precision float data.61 psF64 **F64; ///< Double-precision float data.62 psC32 **C32; ///< Single-precision complex data.63 psC64 **C64; ///< Double-precision complex data.64 psPTR **PTR; ///< Void pointers.65 psPTR *V; ///< Pointer to data.52 psU8* *U8; ///< Unsigned 8-bit integer data. 53 psU16* *U16; ///< Unsigned 16-bit integer data. 54 psU32* *U32; ///< Unsigned 32-bit integer data. 55 psU64* *U64; ///< Unsigned 64-bit integer data. 56 psS8* *S8; ///< Signed 8-bit integer data. 57 psS16* *S16; ///< Signed 16-bit integer data. 58 psS32* *S32; ///< Signed 32-bit integer data. 59 psS64* *S64; ///< Signed 64-bit integer data. 60 psF32* *F32; ///< Single-precision float data. 61 psF64* *F64; ///< Double-precision float data. 62 psC32* *C32; ///< Single-precision complex data. 63 psC64* *C64; ///< Double-precision complex data. 64 psPTR* *PTR; ///< Void pointers. 65 psPTR* V; ///< Pointer to data. 66 66 } data; ///< Union for data types. 67 const struct psImage *parent; ///< Parent, if a subimage.67 const struct psImage* parent; ///< Parent, if a subimage. 68 68 int nChildren; ///< Number of subimages. 69 struct psImage **children; ///< Children of this region.69 struct psImage* *children; ///< Children of this region. 70 70 } 71 71 psImage; … … 82 82 * specified size and type. 83 83 * 84 * @return psImage* : Pointer to psImage.84 * @return psImage* : Pointer to psImage. 85 85 * 86 86 */ 87 psImage *psImageAlloc(unsigned int numCols, ///< Number of rows in image.87 psImage* psImageAlloc(unsigned int numCols, ///< Number of rows in image. 88 88 unsigned int numRows, ///< Number of columns in image. 89 89 const psElemType type ///< Type of data for image. … … 95 95 * 96 96 */ 97 psImage *psImageRecycle(psImage* old, ///< the psImage to recycle by resizing image buffer97 psImage* psImageRecycle(psImage* old, ///< the psImage to recycle by resizing image buffer 98 98 unsigned int numCols, ///< the desired number of columns in image 99 99 unsigned int numRows, ///< the desired number of rows in image … … 106 106 * 107 107 */ 108 int psImageFreeChildren(psImage * image108 int psImageFreeChildren(psImage* image 109 109 110 110 /**< psImage in which all children shall be deallocated */ 111 111 ); 112 112 113 psF32 psImagePixelInterpolate(const psImage * input,113 psF32 psImagePixelInterpolate(const psImage* input, 114 114 float x, float y, psF32 unexposedValue, psImageInterpolateMode mode); 115 115 116 116 # define p_psImagePixelInterpolateFcns(TYPE) \ 117 117 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE( \ 118 const psImage *input, \118 const psImage* input, \ 119 119 float x, \ 120 120 float y, \ … … 122 122 ); \ 123 123 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE( \ 124 const psImage *input, \124 const psImage* input, \ 125 125 float x, \ 126 126 float y, \ … … 130 130 # define p_psImagePixelInterpolateComplexFcns(TYPE) \ 131 131 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE( \ 132 const psImage *input, \132 const psImage* input, \ 133 133 float x, \ 134 134 float y, \ … … 136 136 ); \ 137 137 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE( \ 138 const psImage *input, \138 const psImage* input, \ 139 139 float x, \ 140 140 float y, \ -
trunk/psLib/src/image/psImageExtraction.c
r1407 r1440 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psError.h" 24 24 25 psImage *psImageSubset(psImage* out,26 psImage * image,25 psImage* psImageSubset(psImage* out, 26 psImage* image, 27 27 unsigned int numCols, unsigned int numRows, unsigned int col0, unsigned int row0) 28 28 { … … 83 83 *(int *)&out->row0 = row0; 84 84 *(int *)&out->col0 = col0; 85 *(psImage **) & out->parent = (psImage *) image;85 *(psImage* *) & out->parent = (psImage* ) image; 86 86 87 87 // add output image as a child of the input 88 88 // image. 89 89 image->nChildren++; 90 image->children = (psImage **) psRealloc(image->children, image->nChildren * sizeof(psImage *));90 image->children = (psImage* *) psRealloc(image->children, image->nChildren * sizeof(psImage* )); 91 91 image->children[image->nChildren - 1] = out; 92 92 … … 101 101 } 102 102 103 psImage *psImageCopy(psImage * restrict output, const psImage* input, psElemType type)103 psImage* psImageCopy(psImage* restrict output, const psImage* input, psElemType type) 104 104 { 105 105 psElemType inDatatype; … … 242 242 } 243 243 244 psVector *psImageSlice(psVector* out,245 psVector * slicePositions,246 const psImage * restrict in,247 const psImage * restrict mask,244 psVector* psImageSlice(psVector* out, 245 psVector* slicePositions, 246 const psImage* restrict in, 247 const psImage* restrict mask, 248 248 unsigned int maskVal, 249 249 unsigned int col, 250 250 unsigned int row, 251 251 unsigned int numCols, 252 unsigned int numRows, psImageCutDirection direction, const psStats * stats)252 unsigned int numRows, psImageCutDirection direction, const psStats* stats) 253 253 { 254 254 double statVal; 255 psStats *myStats;255 psStats* myStats; 256 256 psElemType type; 257 257 int inRows; 258 258 int inCols; 259 259 int delta = 1; 260 psF64 *outData;260 psF64* outData; 261 261 262 262 if (in == NULL || in->data.V == NULL) { … … 328 328 329 329 if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) { 330 psVector *imgVec = psVectorAlloc(numRows, type);331 psVector *maskVec = NULL;332 psMaskType *maskData = NULL;333 psU32 *outPosition = NULL;330 psVector* imgVec = psVectorAlloc(numRows, type); 331 psVector* maskVec = NULL; 332 psMaskType* maskData = NULL; 333 psU32* outPosition = NULL; 334 334 335 335 // recycle output to make a proper … … 362 362 if (maskVec != NULL) { \ 363 363 maskVecData = maskVec->data.V; \ 364 maskData = (psMaskType* )(mask->data.V[row]) + col + c; \364 maskData = (psMaskType* )(mask->data.V[row]) + col + c; \ 365 365 } \ 366 366 for (int r=0;r<numRows;r++) { \ … … 417 417 // Y 418 418 // direction 419 psVector *imgVec = NULL;420 psVector *maskVec = NULL;419 psVector* imgVec = NULL; 420 psVector* maskVec = NULL; 421 421 int elementSize = PSELEMTYPE_SIZEOF(type); 422 psU32 *outPosition = NULL;422 psU32* outPosition = NULL; 423 423 424 424 // fill in psVectors to fake out the -
trunk/psLib/src/image/psImageExtraction.h
r1426 r1440 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 * one. 41 41 * 42 * @return psImage* : Pointer to psImage.42 * @return psImage* : Pointer to psImage. 43 43 * 44 44 */ … … 54 54 /** Makes a copy of a psImage 55 55 * 56 * @return psImage* Copy of the input psImage. This may not be equal to the56 * @return psImage* Copy of the input psImage. This may not be equal to the 57 57 * output parameter 58 58 * … … 78 78 * @return psVector the resulting vector 79 79 */ 80 psVector *psImageSlice(80 psVector* psImageSlice( 81 81 psVector* out, ///< psVector to recycle, or NULL. 82 82 psVector* slicePositions, … … 111 111 * @return psVector resulting vector 112 112 */ 113 psVector *psImageCut(113 psVector* psImageCut( 114 114 psVector* out, ///< psVector to recycle, or NULL. 115 115 const psImage* input, ///< the input image in which to perform the cut -
trunk/psLib/src/image/psImageIO.c
r1407 r1440 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-0 7 00:06:06$10 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-09 23:34:58 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 #include "psMemory.h" 23 23 24 psImage *psImageReadSection(psImage* output,24 psImage* psImageReadSection(psImage* output, 25 25 int col, 26 26 int row, … … 199 199 } 200 200 201 bool psImageWriteSection(psImage * input, int col0, int row0, int z, char *extname, int extnum,201 bool psImageWriteSection(psImage* input, int col0, int row0, int z, char *extname, int extnum, 202 202 char *filename) 203 203 { -
trunk/psLib/src/image/psImageIO.h
r1407 r1440 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 /** Read an image or subimage from a FITS file specified by a filename. 28 28 * 29 * return psImage* The image read from the specified file. NULL29 * return psImage* The image read from the specified file. NULL 30 30 * signifies that a problem had occured. 31 31 */ 32 psImage *psImageReadSection(psImage* output,32 psImage* psImageReadSection(psImage* output, 33 33 34 34 /**< the output psImage to recycle, or NULL if new psImage desired */ … … 67 67 * return bool TRUE is successful, otherwise FALSE. 68 68 */ 69 bool psImageWriteSection(psImage * input,69 bool psImageWriteSection(psImage* input, 70 70 71 71 /**< the psImage to write */ -
trunk/psLib/src/image/psImageManip.c
r1407 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-0 7 00:06:06$13 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:58 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 #include "psImageExtraction.h" 32 32 33 int psImageClip(psImage * input, psF64 min, psF64 vmin, psF64 max, psF64 vmax)33 int psImageClip(psImage* input, psF64 min, psF64 vmin, psF64 max, psF64 vmax) 34 34 { 35 35 int numClipped = 0; … … 125 125 } 126 126 127 int psImageClipNaN(psImage * input, psF64 value)127 int psImageClipNaN(psImage* input, psF64 value) 128 128 { 129 129 int numClipped = 0; … … 164 164 } 165 165 166 int psImageOverlaySection(psImage * image, const psImage* overlay, int col0, int row0, const char *op)166 int psImageOverlaySection(psImage* image, const psImage* overlay, int col0, int row0, const char *op) 167 167 { 168 168 unsigned int imageNumRows; … … 267 267 } 268 268 269 int psImageClipComplexRegion(psImage * input, psC64 min, psC64 vmin, psC64 max, psC64 vmax)269 int psImageClipComplexRegion(psImage* input, psC64 min, psC64 vmin, psC64 max, psC64 vmax) 270 270 { 271 271 int numClipped = 0; … … 340 340 } 341 341 342 psImage *psImageRebin(psImage * out, const psImage * in, unsigned int scale, const psStats* stats)342 psImage* psImageRebin(psImage* out, const psImage* in, unsigned int scale, const psStats* stats) 343 343 { 344 344 int inRows; … … 346 346 int outRows; 347 347 int outCols; 348 psVector *vec; // vector to hold348 psVector* vec; // vector to hold 349 349 350 350 // the values of 351 351 // a single bin. 352 psStats *myStats;352 psStats* myStats; 353 353 double statVal; 354 354 … … 444 444 } 445 445 446 psImage *psImageResample(psImage * out, const psImage* in, int scale, psImageInterpolateMode mode)446 psImage* psImageResample(psImage* out, const psImage* in, int scale, psImageInterpolateMode mode) 447 447 { 448 448 int outRows; … … 496 496 } 497 497 498 psImage *psImageRoll(psImage * out, const psImage* in, int dx, int dy)498 psImage* psImageRoll(psImage* out, const psImage* in, int dx, int dy) 499 499 { 500 500 int outRows; … … 534 534 inRowNumber -= outRows; 535 535 } 536 psU8 *inRow = in->data.U8[inRowNumber]; // to536 psU8* inRow = in->data.U8[inRowNumber]; // to 537 537 538 538 // allow … … 542 542 543 543 // but for all types 544 psU8 *outRow = out->data.U8[row];544 psU8* outRow = out->data.U8[row]; 545 545 546 546 memcpy(outRow, inRow + segment2Size, segment1Size); … … 551 551 } 552 552 553 psImage *psImageRotate(psImage* out,554 const psImage * in, float angle, float unexposedValue, psImageInterpolateMode mode)553 psImage* psImageRotate(psImage* out, 554 const psImage* in, float angle, float unexposedValue, psImageInterpolateMode mode) 555 555 { 556 556 if (in == NULL) { … … 803 803 } 804 804 805 psImage *psImageShift(psImage* out,806 const psImage * in,805 psImage* psImageShift(psImage* out, 806 const psImage* in, 807 807 float dx, float dy, psF64 unexposedValue, psImageInterpolateMode mode) 808 808 { -
trunk/psLib/src/image/psImageManip.h
r1426 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:58 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 * @return int The number of clipped pixels 33 33 */ 34 int psImageClip(psImage * input, ///< the image to clip34 int psImageClip(psImage* input, ///< the image to clip 35 35 psF64 min, ///< the minimum image value allowed 36 36 psF64 vmin, ///< the value pixels < min are set to … … 48 48 * @return int The number of clipped pixels 49 49 */ 50 int psImageClipComplexRegion(psImage * input, ///< the image to clip50 int psImageClipComplexRegion(psImage* input, ///< the image to clip 51 51 psC64 min, ///< the minimum image value allowed 52 52 psC64 vmin, ///< the value pixels < min are set to … … 62 62 * @return int The number of clipped pixels 63 63 */ 64 int psImageClipNaN(psImage * input, ///< the image to clip64 int psImageClipNaN(psImage* input, ///< the image to clip 65 65 psF64 value ///< the value to set all NaN/Inf values to 66 66 ); … … 77 77 * @return int 0 if success, non-zero if failed. 78 78 */ 79 int psImageOverlaySection(psImage * image, ///< target image80 const psImage * overlay, ///< the overlay image79 int psImageOverlaySection(psImage* image, ///< target image 80 const psImage* overlay, ///< the overlay image 81 81 int col0, ///< the column to start overlay 82 82 int row0, ///< the row to start overlay … … 94 94 * @return psImage new image formed by rebinning input image. 95 95 */ 96 psImage *psImageRebin(psImage* out, ///< an psImage to recycle. If NULL, a new image is created97 const psImage * in, ///< input image96 psImage* psImageRebin(psImage* out, ///< an psImage to recycle. If NULL, a new image is created 97 const psImage* in, ///< input image 98 98 unsigned int scale, ///< the scale to rebin for each dimension 99 const psStats * stats ///< the statistic to perform when rebinning. Only one99 const psStats* stats ///< the statistic to perform when rebinning. Only one 100 100 // method should be set. 101 101 ); 102 102 103 psImage *psImageResample(psImage* out, ///< an psImage to recycle. If NULL, a new image is created104 const psImage * in, ///< input image103 psImage* psImageResample(psImage* out, ///< an psImage to recycle. If NULL, a new image is created 104 const psImage* in, ///< input image 105 105 int scale, psImageInterpolateMode mode); 106 106 107 psImage *psImageRotate(psImage* out, ///< an psImage to recycle. If NULL, a new image is created108 const psImage * in, ///< input image107 psImage* psImageRotate(psImage* out, ///< an psImage to recycle. If NULL, a new image is created 108 const psImage* in, ///< input image 109 109 float angle, float unexposedValue, psImageInterpolateMode mode); 110 110 111 psImage *psImageShift(psImage* out, ///< an psImage to recycle. If NULL, a new image is created112 const psImage * in, ///< input image111 psImage* psImageShift(psImage* out, ///< an psImage to recycle. If NULL, a new image is created 112 const psImage* in, ///< input image 113 113 float dx, float dy, float unexposedValue, psImageInterpolateMode mode); 114 114 … … 119 119 * defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 120 120 * 121 * @return psImage* the rolled version of the input image.121 * @return psImage* the rolled version of the input image. 122 122 */ 123 psImage *psImageRoll(psImage* out, ///< an psImage to recycle. If NULL, a new image is created124 const psImage * in, ///< input image123 psImage* psImageRoll(psImage* out, ///< an psImage to recycle. If NULL, a new image is created 124 const psImage* in, ///< input image 125 125 int dx, ///< number of pixels to roll in the x-dimension 126 126 int dy ///< number of pixels to roll in the y-dimension -
trunk/psLib/src/image/psImageStats.c
r1407 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 37 37 NOTE: verify that image/mask have the correct types, and sizes. 38 38 *****************************************************************************/ 39 psStats *psImageStats(psStats * stats, psImage * in, psImage* mask, int maskVal)40 { 41 psVector *junkData = NULL;42 psVector *junkMask = NULL;39 psStats* psImageStats(psStats* stats, psImage* in, psImage* mask, int maskVal) 40 { 41 psVector* junkData = NULL; 42 psVector* junkMask = NULL; 43 43 44 44 if (stats == NULL) { … … 95 95 NOTE: verify that image/mask have the, correct types and sizes. 96 96 *****************************************************************************/ 97 psHistogram *psImageHistogram(psHistogram * out, psImage * in, psImage* mask, unsigned int maskVal)98 { 99 psVector *junkData = NULL;100 psVector *junkMask = NULL;97 psHistogram* psImageHistogram(psHistogram* out, psImage* in, psImage* mask, unsigned int maskVal) 98 { 99 psVector* junkData = NULL; 100 psVector* junkMask = NULL; 101 101 102 102 // NOTE: Verify this action. … … 183 183 } 184 184 185 psPolynomial1D **p_psCreateChebyshevPolys(int maxChebyPoly)186 { 187 psPolynomial1D **chebPolys = NULL;185 psPolynomial1D* *p_psCreateChebyshevPolys(int maxChebyPoly) 186 { 187 psPolynomial1D* *chebPolys = NULL; 188 188 int i = 0; 189 189 int j = 0; 190 190 191 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));191 chebPolys = (psPolynomial1D* *) psAlloc(maxChebyPoly * sizeof(psPolynomial1D* )); 192 192 for (i = 0; i < maxChebyPoly; i++) { 193 193 chebPolys[i] = psPolynomial1DAlloc(i + 1); … … 224 224 over all pixels (x,y) in the image. 225 225 *****************************************************************************/ 226 psPolynomial2D *psImageFitPolynomial(const psImage * input, psPolynomial2D* coeffs)226 psPolynomial2D* psImageFitPolynomial(const psImage* input, psPolynomial2D* coeffs) 227 227 { 228 228 int x = 0; … … 231 231 int j = 0; 232 232 float **sums = NULL; 233 psPolynomial1D **chebPolys = NULL;233 psPolynomial1D* *chebPolys = NULL; 234 234 int maxChebyPoly = 0; 235 235 float *cScalingFactors = NULL; … … 327 327 328 328 *****************************************************************************/ 329 int psImageEvalPolynomial(const psImage * input, const psPolynomial2D* coeffs)329 int psImageEvalPolynomial(const psImage* input, const psPolynomial2D* coeffs) 330 330 { 331 331 int x = 0; … … 334 334 int j = 0; 335 335 float **sums = NULL; 336 psPolynomial1D **chebPolys = NULL;336 psPolynomial1D* *chebPolys = NULL; 337 337 int maxChebyPoly = 0; 338 338 float *cScalingFactors = NULL; -
trunk/psLib/src/image/psImageStats.h
r1426 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 29 29 /// This routine must determine the various statistics for the image. 30 psStats *psImageStats(psStats* stats, ///< defines statistics to be calculated31 psImage * in, ///< image (or subimage) to calculate stats32 psImage * mask, ///< mask data for image (NULL ok)30 psStats* psImageStats(psStats* stats, ///< defines statistics to be calculated 31 psImage* in, ///< image (or subimage) to calculate stats 32 psImage* mask, ///< mask data for image (NULL ok) 33 33 int maskVal); ///< mask Mask for mask 34 34 35 psHistogram *psImageHistogram(psHistogram* out, ///< input histogram description & target36 psImage * in, ///< Image data to be histogramed.37 psImage * mask, ///< mask data for image (NULL ok)35 psHistogram* psImageHistogram(psHistogram* out, ///< input histogram description & target 36 psImage* in, ///< Image data to be histogramed. 37 psImage* mask, ///< mask data for image (NULL ok) 38 38 unsigned int maskVal); ///< mask Mask for mask 39 39 40 40 /// Fit a 2-D polynomial surface to an image. 41 psPolynomial2D *psImageFitPolynomial(const psImage* input, ///< image to fit42 psPolynomial2D * coeffs ///< coefficient structure carries in41 psPolynomial2D* psImageFitPolynomial(const psImage* input, ///< image to fit 42 psPolynomial2D* coeffs ///< coefficient structure carries in 43 43 // desired terms & target 44 44 ); 45 45 46 46 /// Evaluate a 2-D polynomial surface to image pixels. 47 int psImageEvalPolynomial(const psImage * input, ///< image to fit48 const psPolynomial2D * coeffs ///< coefficient structure carries in desired terms47 int psImageEvalPolynomial(const psImage* input, ///< image to fit 48 const psPolynomial2D* coeffs ///< coefficient structure carries in desired terms 49 49 ); 50 50 -
trunk/psLib/src/imageops/psImageStats.c
r1407 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 37 37 NOTE: verify that image/mask have the correct types, and sizes. 38 38 *****************************************************************************/ 39 psStats *psImageStats(psStats * stats, psImage * in, psImage* mask, int maskVal)40 { 41 psVector *junkData = NULL;42 psVector *junkMask = NULL;39 psStats* psImageStats(psStats* stats, psImage* in, psImage* mask, int maskVal) 40 { 41 psVector* junkData = NULL; 42 psVector* junkMask = NULL; 43 43 44 44 if (stats == NULL) { … … 95 95 NOTE: verify that image/mask have the, correct types and sizes. 96 96 *****************************************************************************/ 97 psHistogram *psImageHistogram(psHistogram * out, psImage * in, psImage* mask, unsigned int maskVal)98 { 99 psVector *junkData = NULL;100 psVector *junkMask = NULL;97 psHistogram* psImageHistogram(psHistogram* out, psImage* in, psImage* mask, unsigned int maskVal) 98 { 99 psVector* junkData = NULL; 100 psVector* junkMask = NULL; 101 101 102 102 // NOTE: Verify this action. … … 183 183 } 184 184 185 psPolynomial1D **p_psCreateChebyshevPolys(int maxChebyPoly)186 { 187 psPolynomial1D **chebPolys = NULL;185 psPolynomial1D* *p_psCreateChebyshevPolys(int maxChebyPoly) 186 { 187 psPolynomial1D* *chebPolys = NULL; 188 188 int i = 0; 189 189 int j = 0; 190 190 191 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));191 chebPolys = (psPolynomial1D* *) psAlloc(maxChebyPoly * sizeof(psPolynomial1D* )); 192 192 for (i = 0; i < maxChebyPoly; i++) { 193 193 chebPolys[i] = psPolynomial1DAlloc(i + 1); … … 224 224 over all pixels (x,y) in the image. 225 225 *****************************************************************************/ 226 psPolynomial2D *psImageFitPolynomial(const psImage * input, psPolynomial2D* coeffs)226 psPolynomial2D* psImageFitPolynomial(const psImage* input, psPolynomial2D* coeffs) 227 227 { 228 228 int x = 0; … … 231 231 int j = 0; 232 232 float **sums = NULL; 233 psPolynomial1D **chebPolys = NULL;233 psPolynomial1D* *chebPolys = NULL; 234 234 int maxChebyPoly = 0; 235 235 float *cScalingFactors = NULL; … … 327 327 328 328 *****************************************************************************/ 329 int psImageEvalPolynomial(const psImage * input, const psPolynomial2D* coeffs)329 int psImageEvalPolynomial(const psImage* input, const psPolynomial2D* coeffs) 330 330 { 331 331 int x = 0; … … 334 334 int j = 0; 335 335 float **sums = NULL; 336 psPolynomial1D **chebPolys = NULL;336 psPolynomial1D* *chebPolys = NULL; 337 337 int maxChebyPoly = 0; 338 338 float *cScalingFactors = NULL; -
trunk/psLib/src/imageops/psImageStats.h
r1426 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 29 29 /// This routine must determine the various statistics for the image. 30 psStats *psImageStats(psStats* stats, ///< defines statistics to be calculated31 psImage * in, ///< image (or subimage) to calculate stats32 psImage * mask, ///< mask data for image (NULL ok)30 psStats* psImageStats(psStats* stats, ///< defines statistics to be calculated 31 psImage* in, ///< image (or subimage) to calculate stats 32 psImage* mask, ///< mask data for image (NULL ok) 33 33 int maskVal); ///< mask Mask for mask 34 34 35 psHistogram *psImageHistogram(psHistogram* out, ///< input histogram description & target36 psImage * in, ///< Image data to be histogramed.37 psImage * mask, ///< mask data for image (NULL ok)35 psHistogram* psImageHistogram(psHistogram* out, ///< input histogram description & target 36 psImage* in, ///< Image data to be histogramed. 37 psImage* mask, ///< mask data for image (NULL ok) 38 38 unsigned int maskVal); ///< mask Mask for mask 39 39 40 40 /// Fit a 2-D polynomial surface to an image. 41 psPolynomial2D *psImageFitPolynomial(const psImage* input, ///< image to fit42 psPolynomial2D * coeffs ///< coefficient structure carries in41 psPolynomial2D* psImageFitPolynomial(const psImage* input, ///< image to fit 42 psPolynomial2D* coeffs ///< coefficient structure carries in 43 43 // desired terms & target 44 44 ); 45 45 46 46 /// Evaluate a 2-D polynomial surface to image pixels. 47 int psImageEvalPolynomial(const psImage * input, ///< image to fit48 const psPolynomial2D * coeffs ///< coefficient structure carries in desired terms47 int psImageEvalPolynomial(const psImage* input, ///< image to fit 48 const psPolynomial2D* coeffs ///< coefficient structure carries in desired terms 49 49 ); 50 50 -
trunk/psLib/src/math/psMatrix.c
r1407 r1440 21 21 * @author Ross Harman, MHPCC 22 22 * 23 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $24 * @date $Date: 2004-08-0 7 00:06:06$23 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 24 * @date $Date: 2004-08-09 23:34:57 $ 25 25 * 26 26 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 160 160 /*****************************************************************************/ 161 161 162 psImage *psMatrixLUD(psImage * outImage, psVector * outPerm, psImage* inImage)162 psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage) 163 163 { 164 164 int signum = 0; … … 205 205 } 206 206 207 psVector *psMatrixLUSolve(psVector * outVector, const psImage * inImage, const psVector* inVector, const208 psVector * inPerm)207 psVector* psMatrixLUSolve(psVector* outVector, const psImage* inImage, const psVector* inVector, const 208 psVector* inPerm) 209 209 { 210 210 int arraySize = 0; … … 258 258 } 259 259 260 psImage *psMatrixInvert(psImage * outImage, const psImage* inImage, float *restrict det)260 psImage* psMatrixInvert(psImage* outImage, const psImage* inImage, float *restrict det) 261 261 { 262 262 int signum = 0; … … 312 312 } 313 313 314 float *psMatrixDeterminant(const psImage * restrict inImage)314 float *psMatrixDeterminant(const psImage* restrict inImage) 315 315 { 316 316 int signum = 0; … … 354 354 } 355 355 356 psImage *psMatrixMultiply(psImage * outImage, psImage * inImage1, psImage* inImage2)356 psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2) 357 357 { 358 358 int arraySize = 0; … … 396 396 } 397 397 398 psImage *psMatrixTranspose(psImage * outImage, const psImage* inImage)398 psImage* psMatrixTranspose(psImage* outImage, const psImage* inImage) 399 399 { 400 400 int arraySize = 0; … … 433 433 } 434 434 435 psImage *psMatrixEigenvectors(psImage * outImage, psImage* inImage)435 psImage* psMatrixEigenvectors(psImage* outImage, psImage* inImage) 436 436 { 437 437 int numRows = 0; … … 477 477 } 478 478 479 psVector *psMatrixToVector(psVector * outVector, psImage* inImage)479 psVector* psMatrixToVector(psVector* outVector, psImage* inImage) 480 480 { 481 481 int size = 0; … … 536 536 } 537 537 538 psImage *psVectorToMatrix(psImage * outImage, psVector* inVector)538 psImage* psVectorToMatrix(psImage* outImage, psVector* inVector) 539 539 { 540 540 int size = 0; -
trunk/psLib/src/math/psMatrix.h
r1426 r1440 22 22 * @author Ross Harman, MHPCC 23 23 * 24 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $25 * @date $Date: 2004-08-09 2 2:44:25$24 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 25 * @date $Date: 2004-08-09 23:34:57 $ 26 26 * 27 27 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 * the same. GSL indexes the top row as the zero row, not the bottom. 42 42 * 43 * @return psImage* : Pointer to LU decomposed psImage.43 * @return psImage* : Pointer to LU decomposed psImage. 44 44 */ 45 psImage *psMatrixLUD(psImage* outImage, ///< Image to return, or NULL.46 psVector * outPerm, ///< Output permutation vector used by psMatrixLUSolve.47 psImage * inImage ///< Image to decompose.45 psImage* psMatrixLUD(psImage* outImage, ///< Image to return, or NULL. 46 psVector* outPerm, ///< Output permutation vector used by psMatrixLUSolve. 47 psImage* inImage ///< Image to decompose. 48 48 ); 49 49 … … 55 55 * the top row as the zero row, not the bottom. 56 56 * 57 * @return psVector* : Pointer to psVector solution of matrix equation.57 * @return psVector* : Pointer to psVector solution of matrix equation. 58 58 */ 59 psVector *psMatrixLUSolve(psVector* outVector, ///< Vector to return, or NULL.60 const psImage * luImage, ///< LU-decomposed matrix.61 const psVector * inVector, ///< Vector right-hand-side of equation.62 const psVector * inPerm ///< Permutation vector resulting from psMatrixLUD59 psVector* psMatrixLUSolve(psVector* outVector, ///< Vector to return, or NULL. 60 const psImage* luImage, ///< LU-decomposed matrix. 61 const psVector* inVector, ///< Vector right-hand-side of equation. 62 const psVector* inPerm ///< Permutation vector resulting from psMatrixLUD 63 63 // function. 64 64 ); … … 71 71 * the same. GSL indexes the top row as the zero row, not the bottom. 72 72 * 73 * @return psImage* : Pointer to inverted psImage.73 * @return psImage* : Pointer to inverted psImage. 74 74 */ 75 psImage *psMatrixInvert(psImage* outImage, ///< Image to return, or NULL for in-place substitution.76 const psImage * inImage, ///< Image to be inverted75 psImage* psMatrixInvert(psImage* outImage, ///< Image to return, or NULL for in-place substitution. 76 const psImage* inImage, ///< Image to be inverted 77 77 float *restrict det ///< Determinant to return, or NULL 78 78 ); … … 86 86 * @return float: Determinant from psImage. 87 87 */ 88 float *psMatrixDeterminant(const psImage * restrict inMatrix ///< Image used to calculate determinant.88 float *psMatrixDeterminant(const psImage* restrict inMatrix ///< Image used to calculate determinant. 89 89 ); 90 90 … … 96 96 * zero row, not the bottom. 97 97 * 98 * @return psImage* : Pointer to resulting psImage.98 * @return psImage* : Pointer to resulting psImage. 99 99 */ 100 psImage *psMatrixMultiply(psImage* outImage, ///< Matrix to return, or NULL.101 psImage * inImage1, ///< First input image.102 psImage * inImage2 ///< Second input image.100 psImage* psMatrixMultiply(psImage* outImage, ///< Matrix to return, or NULL. 101 psImage* inImage1, ///< First input image. 102 psImage* inImage2 ///< Second input image. 103 103 ); 104 104 … … 110 110 * row, not the bottom. 111 111 * 112 * @return psImage* : Pointer to transposed psImage.112 * @return psImage* : Pointer to transposed psImage. 113 113 */ 114 psImage *psMatrixTranspose(psImage* outImage, ///< Image to return, or NULL115 const psImage * inImage ///< Image to transpose114 psImage* psMatrixTranspose(psImage* outImage, ///< Image to return, or NULL 115 const psImage* inImage ///< Image to transpose 116 116 ); 117 117 … … 122 122 * only with the psF64 data type. GSL indexes the top row as the zero row, not the bottom. 123 123 * 124 * @return psImage* : Pointer to matrix of Eigenvectors.124 * @return psImage* : Pointer to matrix of Eigenvectors. 125 125 */ 126 psImage *psMatrixEigenvectors(psImage* outImage, ///< Eigenvectors to return, or NULL.127 psImage * inImage ///< Input image.126 psImage* psMatrixEigenvectors(psImage* outImage, ///< Eigenvectors to return, or NULL. 127 psImage* inImage ///< Input image. 128 128 ); 129 129 … … 135 135 * input matrix must be 1. This function operates only with the psF64 data type. 136 136 * 137 * @return psVector* : Pointer to psVector.137 * @return psVector* : Pointer to psVector. 138 138 */ 139 psVector *psMatrixToVector(psVector* outVector, ///< Vector to return, or NULL.140 psImage * inImage ///< Image to convert.139 psVector* psMatrixToVector(psVector* outVector, ///< Vector to return, or NULL. 140 psImage* inImage ///< Image to convert. 141 141 ); 142 142 … … 148 148 * automatically be created. This function operates only with the psF64 data type. 149 149 * 150 * @return psVector* : Pointer to psIamge.150 * @return psVector* : Pointer to psIamge. 151 151 */ 152 psImage *psVectorToMatrix(psImage* outImage, ///< Matrix to return, or NULL.153 psVector * inVector ///< Vector to convert.152 psImage* psVectorToMatrix(psImage* outImage, ///< Matrix to return, or NULL. 153 psVector* inVector ///< Vector to convert. 154 154 ); 155 155 -
trunk/psLib/src/math/psMinimize.c
r1407 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:57 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 99 99 size_t n; // Number of data points points in domain. 100 100 int paramCount; // Number of non-masked parameters. 101 psVector *restrict initialGuess;102 const psImage *restrict domain;103 const psVector *restrict data;104 const psVector *restrict errors;105 const psVector *restrict paramMask;106 float (*evalModel) (const psVector *, const psVector *);107 float (*d_evalModel) (const psVector *, const psVector *, int);101 psVector* restrict initialGuess; 102 const psImage* restrict domain; 103 const psVector* restrict data; 104 const psVector* restrict errors; 105 const psVector* restrict paramMask; 106 float (*evalModel) (const psVector* , const psVector* ); 107 float (*d_evalModel) (const psVector* , const psVector* , int); 108 108 } 109 109 psMinChi2Data; … … 112 112 { 113 113 int paramCount; // Number of non-masked parameters. 114 psVector *restrict initialGuess;115 const psVector *restrict coord;116 const psVector *restrict paramMask;117 float (*evalModel) (const psVector *, const psVector *);118 float (*d_evalModel) (const psVector *, const psVector *, int);114 psVector* restrict initialGuess; 115 const psVector* restrict coord; 116 const psVector* restrict paramMask; 117 float (*evalModel) (const psVector* , const psVector* ); 118 float (*d_evalModel) (const psVector* , const psVector* , int); 119 119 } 120 120 psMinimizeData; … … 162 162 int j; // Loop index variable. 163 163 float tmpf; // Temporary floating point variable. 164 const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;165 const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;166 psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;167 float (*evalModel) (const psVector *, const psVector *) = ((psMinimizeData *) funcData)->evalModel;168 psVector *inputParameterList = NULL;164 const psVector* restrict coord = ((psMinimizeData* ) funcData)->coord; 165 const psVector* restrict mask = ((psMinimizeData* ) funcData)->paramMask; 166 psVector* restrict initialGuess = ((psMinimizeData* ) funcData)->initialGuess; 167 float (*evalModel) (const psVector* , const psVector* ) = ((psMinimizeData* ) funcData)->evalModel; 168 psVector* inputParameterList = NULL; 169 169 170 170 // The GSL routines will call this function with the masked parameters … … 216 216 int j; // Loop index variable. 217 217 float tmpf; // Temporary floating point variable. 218 const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;219 const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;220 psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;221 float (*d_evalModel) (const psVector *, const psVector *, int) =222 ((psMinimizeData *) funcData)->d_evalModel;223 psVector *inputParameterList = NULL;218 const psVector* restrict coord = ((psMinimizeData* ) funcData)->coord; 219 const psVector* restrict mask = ((psMinimizeData* ) funcData)->paramMask; 220 psVector* restrict initialGuess = ((psMinimizeData* ) funcData)->initialGuess; 221 float (*d_evalModel) (const psVector* , const psVector* , int) = 222 ((psMinimizeData* ) funcData)->d_evalModel; 223 psVector* inputParameterList = NULL; 224 224 225 225 // The GSL routines will call this function with the masked parameters … … 293 293 int j; // Loop index variable. 294 294 float tmpf; // Temporary floating point variable. 295 const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;296 const psVector *restrict data = ((psMinChi2Data *) funcData)->data;297 const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;298 const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;299 psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;300 float (*evalModel) (const psVector *, const psVector *) = ((psMinChi2Data *) funcData)->evalModel;301 psVector *inputParameterList = NULL;302 psVector *tmpVecPtr = NULL;295 const psImage* restrict domain = ((psMinChi2Data* ) funcData)->domain; 296 const psVector* restrict data = ((psMinChi2Data* ) funcData)->data; 297 const psVector* restrict errors = ((psMinChi2Data* ) funcData)->errors; 298 const psVector* restrict mask = ((psMinChi2Data* ) funcData)->paramMask; 299 psVector* restrict initialGuess = ((psMinChi2Data* ) funcData)->initialGuess; 300 float (*evalModel) (const psVector* , const psVector* ) = ((psMinChi2Data* ) funcData)->evalModel; 301 psVector* inputParameterList = NULL; 302 psVector* tmpVecPtr = NULL; 303 303 304 304 tmpVecPtr = psVectorAlloc(domain->numCols, PS_TYPE_F32); … … 360 360 int p_psMinChi2FuncDeriv(const gsl_vector * params, void *funcData, gsl_matrix * J) 361 361 { 362 const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;363 const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;364 const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;365 psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;366 psVector *inputParameterList = NULL;367 psVector *tmpVecPtr = NULL;368 float (*d_evalModel) (const psVector *, const psVector *, int) =369 ((psMinChi2Data *) funcData)->d_evalModel;362 const psImage* restrict domain = ((psMinChi2Data* ) funcData)->domain; 363 const psVector* restrict errors = ((psMinChi2Data* ) funcData)->errors; 364 const psVector* restrict mask = ((psMinChi2Data* ) funcData)->paramMask; 365 psVector* restrict initialGuess = ((psMinChi2Data* ) funcData)->initialGuess; 366 psVector* inputParameterList = NULL; 367 psVector* tmpVecPtr = NULL; 368 float (*d_evalModel) (const psVector* , const psVector* , int) = 369 ((psMinChi2Data* ) funcData)->d_evalModel; 370 370 371 371 size_t i; … … 426 426 returned as a psVector sums. 427 427 *****************************************************************************/ 428 void p_psBuildSums1D(double x, int polyOrder, psVector * sums)428 void p_psBuildSums1D(double x, int polyOrder, psVector* sums) 429 429 { 430 430 int i = 0; … … 442 442 values of the vector will be scaled uniformly between -1.0 and 1.0. 443 443 *****************************************************************************/ 444 psVector *psBuildImageScalingFactors(int x)444 psVector* psBuildImageScalingFactors(int x) 445 445 { 446 446 int i = 0; // loop index variable. 447 psVector *imageScalingFactors = NULL;447 psVector* imageScalingFactors = NULL; 448 448 449 449 imageScalingFactors = psVectorAlloc(x, PS_TYPE_F32); … … 556 556 parameters of that function such that the ... 557 557 *****************************************************************************/ 558 psVector *psMinimize(psVector* restrict initialGuess,559 float (*myFunction) (const psVector * restrict, const psVector* restrict),560 float (*myFunctionDeriv) (const psVector * restrict, const psVector* restrict, int),561 const psVector * restrict coord, const psVector* restrict paramMask)558 psVector* psMinimize(psVector* restrict initialGuess, 559 float (*myFunction) (const psVector* restrict, const psVector* restrict), 560 float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int), 561 const psVector* restrict coord, const psVector* restrict paramMask) 562 562 { 563 563 int status; … … 664 664 such that they best fit the supplied data points. 665 665 *****************************************************************************/ 666 psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector* restrict),667 float (*DevalModel) (const psVector * restrict, const psVector* restrict, int),668 const psImage * restrict domain,669 const psVector * restrict data,670 const psVector * restrict errors,671 psVector * restrict initialGuess, const psVector* restrict paramMask, float *chiSq)666 psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict), 667 float (*DevalModel) (const psVector* restrict, const psVector* restrict, int), 668 const psImage* restrict domain, 669 const psVector* restrict data, 670 const psVector* restrict errors, 671 psVector* restrict initialGuess, const psVector* restrict paramMask, float *chiSq) 672 672 { 673 673 int numData = domain->numRows; // Number of data points … … 847 847 NOTE: yErr is currently ignored. 848 848 *****************************************************************************/ 849 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D* myPoly,850 const psVector * restrict x,851 const psVector * restrict y, const psVector* restrict yErr)849 psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly, 850 const psVector* restrict x, 851 const psVector* restrict y, const psVector* restrict yErr) 852 852 { 853 853 int polyOrder = myPoly->n; 854 psImage *A = NULL;855 psImage *ALUD = NULL;856 psVector *B = NULL;857 psVector *outPerm = NULL;858 psVector *X = NULL; // NOTE: do we need this?859 psVector *coeffs = NULL;854 psImage* A = NULL; 855 psImage* ALUD = NULL; 856 psVector* B = NULL; 857 psVector* outPerm = NULL; 858 psVector* X = NULL; // NOTE: do we need this? 859 psVector* coeffs = NULL; 860 860 int i = 0; 861 861 int j = 0; 862 862 int k = 0; 863 psVector *xSums = NULL;863 psVector* xSums = NULL; 864 864 865 865 // printf("psVectorFitPolynomial1D()\n"); -
trunk/psLib/src/math/psMinimize.h
r1426 r1440 16 16 17 17 /** This routine must minimize a non-linear function */ 18 psVector *psMinimize(psVector* restrict initialGuess,19 float (*myFunction) (const psVector * restrict, const psVector* restrict),20 float (*myFunctionDeriv) (const psVector * restrict, const psVector* restrict, int),21 const psVector * restrict coord, const psVector* restrict paramMask);18 psVector* psMinimize(psVector* restrict initialGuess, 19 float (*myFunction) (const psVector* restrict, const psVector* restrict), 20 float (*myFunctionDeriv) (const psVector* restrict, const psVector* restrict, int), 21 const psVector* restrict coord, const psVector* restrict paramMask); 22 22 23 23 /** Minimize chi^2 for input data */ 24 psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector* restrict), ///<24 psVector* psMinimizeChi2(float (*evalModel) (const psVector* restrict, const psVector* restrict), ///< 25 25 // Model 26 26 // to … … 29 29 // and 30 30 // params) 31 float (*DevalModel) (const psVector * restrict, const psVector* restrict, int), ///<31 float (*DevalModel) (const psVector* restrict, const psVector* restrict, int), ///< 32 32 // Derivative 33 33 // of … … 38 38 // and 39 39 // params) 40 const psImage * restrict domain, ///< The domain values for the corresponding40 const psImage* restrict domain, ///< The domain values for the corresponding 41 41 // measurements 42 const psVector * restrict data, ///< Data to fit43 const psVector * restrict errors, ///< Errors in the data44 psVector * restrict initialGuess, ///< Initial guess45 const psVector * restrict paramMask, ///< 1 = fit for parameter, 0 = hold42 const psVector* restrict data, ///< Data to fit 43 const psVector* restrict errors, ///< Errors in the data 44 psVector* restrict initialGuess, ///< Initial guess 45 const psVector* restrict paramMask, ///< 1 = fit for parameter, 0 = hold 46 46 // parameter constant 47 47 float *chiSq); 48 48 49 49 /** Derive a polynomial fit by chi^2 minimisation (analytically) */ 50 psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D* myPoly, ///< Polynomial to fit51 const psVector * restrict x, ///< Ordinates (or NULL to just use50 psPolynomial1D* psVectorFitPolynomial1D(psPolynomial1D* myPoly, ///< Polynomial to fit 51 const psVector* restrict x, ///< Ordinates (or NULL to just use 52 52 // the indices) 53 const psVector * restrict y, ///< Coordinates54 const psVector * restrict yErr ///< Errors in coordinates, or NULL53 const psVector* restrict y, ///< Coordinates 54 const psVector* restrict yErr ///< Errors in coordinates, or NULL 55 55 ); 56 56 -
trunk/psLib/src/math/psPolynomial.c
r1407 r1440 8 8 * polynomials. It also contains a Gaussian functions. 9 9 * 10 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-0 7 00:06:06$10 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-09 23:34:57 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 49 49 50 50 /*****************************************************************************/ 51 static void polynomial1DFree(psPolynomial1D * myPoly);52 static void polynomial2DFree(psPolynomial2D * myPoly);53 static void polynomial3DFree(psPolynomial3D * myPoly);54 static void polynomial4DFree(psPolynomial4D * myPoly);55 static void dPolynomial1DFree(psDPolynomial1D * myPoly);56 static void dPolynomial2DFree(psDPolynomial2D * myPoly);57 static void dPolynomial3DFree(psDPolynomial3D * myPoly);58 static void dPolynomial4DFree(psDPolynomial4D * myPoly);51 static void polynomial1DFree(psPolynomial1D* myPoly); 52 static void polynomial2DFree(psPolynomial2D* myPoly); 53 static void polynomial3DFree(psPolynomial3D* myPoly); 54 static void polynomial4DFree(psPolynomial4D* myPoly); 55 static void dPolynomial1DFree(psDPolynomial1D* myPoly); 56 static void dPolynomial2DFree(psDPolynomial2D* myPoly); 57 static void dPolynomial3DFree(psDPolynomial3D* myPoly); 58 static void dPolynomial4DFree(psDPolynomial4D* myPoly); 59 59 60 60 /*****************************************************************************/ … … 120 120 NOTE: There is no way to seed the random generator. 121 121 *****************************************************************************/ 122 psVector *psGaussianDev(float mean, float sigma, int Npts)123 { 124 psVector *gauss = NULL;122 psVector* psGaussianDev(float mean, float sigma, int Npts) 123 { 124 psVector* gauss = NULL; 125 125 const gsl_rng_type *T = NULL; 126 126 gsl_rng *r = NULL; … … 144 144 This routine must allocate memory for the polynomial structures. 145 145 *****************************************************************************/ 146 psPolynomial1D *psPolynomial1DAlloc(int n)146 psPolynomial1D* psPolynomial1DAlloc(int n) 147 147 { 148 148 int i = 0; 149 psPolynomial1D *newPoly = NULL;150 151 newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));149 psPolynomial1D* newPoly = NULL; 150 151 newPoly = (psPolynomial1D* ) psAlloc(sizeof(psPolynomial1D)); 152 152 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree); 153 153 newPoly->n = n; … … 164 164 } 165 165 166 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY)167 { 168 int x = 0; 169 int y = 0; 170 psPolynomial2D *newPoly = NULL;171 172 newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));166 psPolynomial2D* psPolynomial2DAlloc(int nX, int nY) 167 { 168 int x = 0; 169 int y = 0; 170 psPolynomial2D* newPoly = NULL; 171 172 newPoly = (psPolynomial2D* ) psAlloc(sizeof(psPolynomial2D)); 173 173 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree); 174 174 newPoly->nX = nX; … … 194 194 } 195 195 196 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ)196 psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ) 197 197 { 198 198 int x = 0; 199 199 int y = 0; 200 200 int z = 0; 201 psPolynomial3D *newPoly = NULL;202 203 newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));201 psPolynomial3D* newPoly = NULL; 202 203 newPoly = (psPolynomial3D* ) psAlloc(sizeof(psPolynomial3D)); 204 204 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree); 205 205 newPoly->nX = nX; … … 233 233 } 234 234 235 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)235 psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ) 236 236 { 237 237 int w = 0; … … 239 239 int y = 0; 240 240 int z = 0; 241 psPolynomial4D *newPoly = NULL;242 243 newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));241 psPolynomial4D* newPoly = NULL; 242 243 newPoly = (psPolynomial4D* ) psAlloc(sizeof(psPolynomial4D)); 244 244 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree); 245 245 newPoly->nW = nW; … … 281 281 } 282 282 283 static void polynomial1DFree(psPolynomial1D * myPoly)283 static void polynomial1DFree(psPolynomial1D* myPoly) 284 284 { 285 285 psFree(myPoly->coeff); … … 288 288 } 289 289 290 static void polynomial2DFree(psPolynomial2D * myPoly)290 static void polynomial2DFree(psPolynomial2D* myPoly) 291 291 { 292 292 int x = 0; … … 302 302 } 303 303 304 static void polynomial3DFree(psPolynomial3D * myPoly)304 static void polynomial3DFree(psPolynomial3D* myPoly) 305 305 { 306 306 int x = 0; … … 323 323 } 324 324 325 static void polynomial4DFree(psPolynomial4D * myPoly)325 static void polynomial4DFree(psPolynomial4D* myPoly) 326 326 { 327 327 int w = 0; … … 353 353 Polynomial coefficients will be accessed in [w][x][y][z] fashion. 354 354 *****************************************************************************/ 355 float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)355 float psPolynomial1DEval(float x, const psPolynomial1D* myPoly) 356 356 { 357 357 int loop_x = 0; … … 380 380 } 381 381 382 float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)382 float psPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 383 383 { 384 384 int loop_x = 0; … … 400 400 } 401 401 402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 403 403 { 404 404 int loop_x = 0; … … 426 426 } 427 427 428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 429 429 { 430 430 int loop_w = 0; … … 458 458 } 459 459 460 psDPolynomial1D *psDPolynomial1DAlloc(int n)460 psDPolynomial1D* psDPolynomial1DAlloc(int n) 461 461 { 462 462 int i = 0; 463 psDPolynomial1D *newPoly = NULL;464 465 newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));463 psDPolynomial1D* newPoly = NULL; 464 465 newPoly = (psDPolynomial1D* ) psAlloc(sizeof(psDPolynomial1D)); 466 466 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree); 467 467 newPoly->n = n; … … 478 478 } 479 479 480 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY)481 { 482 int x = 0; 483 int y = 0; 484 psDPolynomial2D *newPoly = NULL;485 486 newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));480 psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY) 481 { 482 int x = 0; 483 int y = 0; 484 psDPolynomial2D* newPoly = NULL; 485 486 newPoly = (psDPolynomial2D* ) psAlloc(sizeof(psDPolynomial2D)); 487 487 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree); 488 488 newPoly->nX = nX; … … 508 508 } 509 509 510 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ)510 psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ) 511 511 { 512 512 int x = 0; 513 513 int y = 0; 514 514 int z = 0; 515 psDPolynomial3D *newPoly = NULL;516 517 newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));515 psDPolynomial3D* newPoly = NULL; 516 517 newPoly = (psDPolynomial3D* ) psAlloc(sizeof(psDPolynomial3D)); 518 518 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree); 519 519 newPoly->nX = nX; … … 547 547 } 548 548 549 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)549 psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ) 550 550 { 551 551 int w = 0; … … 553 553 int y = 0; 554 554 int z = 0; 555 psDPolynomial4D *newPoly = NULL;556 557 newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));555 psDPolynomial4D* newPoly = NULL; 556 557 newPoly = (psDPolynomial4D* ) psAlloc(sizeof(psDPolynomial4D)); 558 558 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree); 559 559 newPoly->nW = nW; … … 595 595 } 596 596 597 static void dPolynomial1DFree(psDPolynomial1D * myPoly)597 static void dPolynomial1DFree(psDPolynomial1D* myPoly) 598 598 { 599 599 psFree(myPoly->coeff); … … 602 602 } 603 603 604 static void dPolynomial2DFree(psDPolynomial2D * myPoly)604 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 605 605 { 606 606 int x = 0; … … 616 616 } 617 617 618 static void dPolynomial3DFree(psDPolynomial3D * myPoly)618 static void dPolynomial3DFree(psDPolynomial3D* myPoly) 619 619 { 620 620 int x = 0; … … 637 637 } 638 638 639 static void dPolynomial4DFree(psDPolynomial4D * myPoly)639 static void dPolynomial4DFree(psDPolynomial4D* myPoly) 640 640 { 641 641 int w = 0; … … 667 667 Polynomial coefficients will be accessed in [w][x][y][z] fashion. 668 668 *****************************************************************************/ 669 double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)669 double psDPolynomial1DEval(double x, const psDPolynomial1D* myPoly) 670 670 { 671 671 int loop_x = 0; … … 686 686 } 687 687 688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 689 689 { 690 690 int loop_x = 0; … … 706 706 } 707 707 708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 709 709 { 710 710 int loop_x = 0; … … 732 732 } 733 733 734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 735 735 { 736 736 int loop_w = 0; -
trunk/psLib/src/math/psPolynomial.h
r1426 r1440 13 13 * @author George Gusciora, MHPCC 14 14 * 15 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-08-09 2 2:44:25$15 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-09 23:34:57 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 /** Produce a vector of random numbers from a Gaussian distribution with 43 43 the specified mean and sigma */ 44 psVector *psGaussianDev(float mean, ///< The mean of the Gaussian44 psVector* psGaussianDev(float mean, ///< The mean of the Gaussian 45 45 float sigma, ///< The sigma of the Gaussian 46 46 int Npts); ///< The size of the vector … … 95 95 96 96 /** Constructor */ 97 psPolynomial1D *psPolynomial1DAlloc(int n ///< Number of terms98 ); 99 100 /** Constructor */ 101 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y102 ); 103 104 /** Constructor */ 105 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z106 ); 107 108 /** Constructor */ 109 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and97 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 110 // z 111 111 ); … … 113 113 /** Evaluate 1D polynomial */ 114 114 float psPolynomial1DEval(float x, ///< Value at which to evaluate 115 const psPolynomial1D * myPoly ///< Coefficients for the polynomial115 const psPolynomial1D* myPoly ///< Coefficients for the polynomial 116 116 ); 117 117 … … 119 119 float psPolynomial2DEval(float x, ///< Value x at which to evaluate 120 120 float y, ///< Value y at which to evaluate 121 const psPolynomial2D * myPoly ///< Coefficients for the polynomial121 const psPolynomial2D* myPoly ///< Coefficients for the polynomial 122 122 ); 123 123 … … 126 126 float y, ///< Value y at which to evaluate 127 127 float z, ///< Value z at which to evaluate 128 const psPolynomial3D * myPoly ///< Coefficients for the polynomial128 const psPolynomial3D* myPoly ///< Coefficients for the polynomial 129 129 ); 130 130 … … 134 134 float y, ///< Value y at which to evaluate 135 135 float z, ///< Value z at which to evaluate 136 const psPolynomial4D * myPoly ///< Coefficients for the polynomial136 const psPolynomial4D* myPoly ///< Coefficients for the polynomial 137 137 ); 138 138 … … 188 188 189 189 /** Constructor */ 190 psDPolynomial1D *psDPolynomial1DAlloc(int n ///< Number of terms191 ); 192 193 /** Constructor */ 194 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y195 ); 196 197 /** Constructor */ 198 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z199 ); 200 201 /** Constructor */ 202 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and190 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 203 // z 204 204 ); … … 206 206 /** Evaluate 1D polynomial (double precision) */ 207 207 double psDPolynomial1DEval(double x, ///< Value at which to evaluate 208 const psDPolynomial1D * myPoly ///< Coefficients for the polynomial208 const psDPolynomial1D* myPoly ///< Coefficients for the polynomial 209 209 ); 210 210 … … 212 212 double psDPolynomial2DEval(double x, ///< Value x at which to evaluate 213 213 double y, ///< Value y at which to evaluate 214 const psDPolynomial2D * myPoly ///< Coefficients for the polynomial214 const psDPolynomial2D* myPoly ///< Coefficients for the polynomial 215 215 ); 216 216 … … 219 219 double y, ///< Value y at which to evaluate 220 220 double z, ///< Value z at which to evaluate 221 const psDPolynomial3D * myPoly ///< Coefficients for the polynomial221 const psDPolynomial3D* myPoly ///< Coefficients for the polynomial 222 222 ); 223 223 … … 227 227 double y, ///< Value y at which to evaluate 228 228 double z, ///< Value z at which to evaluate 229 const psDPolynomial4D * myPoly ///< Coefficients for the polynomial229 const psDPolynomial4D* myPoly ///< Coefficients for the polynomial 230 230 ); 231 231 -
trunk/psLib/src/math/psSpline.c
r1407 r1440 8 8 * polynomials. It also contains a Gaussian functions. 9 9 * 10 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-0 7 00:06:06$10 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-09 23:34:57 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 49 49 50 50 /*****************************************************************************/ 51 static void polynomial1DFree(psPolynomial1D * myPoly);52 static void polynomial2DFree(psPolynomial2D * myPoly);53 static void polynomial3DFree(psPolynomial3D * myPoly);54 static void polynomial4DFree(psPolynomial4D * myPoly);55 static void dPolynomial1DFree(psDPolynomial1D * myPoly);56 static void dPolynomial2DFree(psDPolynomial2D * myPoly);57 static void dPolynomial3DFree(psDPolynomial3D * myPoly);58 static void dPolynomial4DFree(psDPolynomial4D * myPoly);51 static void polynomial1DFree(psPolynomial1D* myPoly); 52 static void polynomial2DFree(psPolynomial2D* myPoly); 53 static void polynomial3DFree(psPolynomial3D* myPoly); 54 static void polynomial4DFree(psPolynomial4D* myPoly); 55 static void dPolynomial1DFree(psDPolynomial1D* myPoly); 56 static void dPolynomial2DFree(psDPolynomial2D* myPoly); 57 static void dPolynomial3DFree(psDPolynomial3D* myPoly); 58 static void dPolynomial4DFree(psDPolynomial4D* myPoly); 59 59 60 60 /*****************************************************************************/ … … 120 120 NOTE: There is no way to seed the random generator. 121 121 *****************************************************************************/ 122 psVector *psGaussianDev(float mean, float sigma, int Npts)123 { 124 psVector *gauss = NULL;122 psVector* psGaussianDev(float mean, float sigma, int Npts) 123 { 124 psVector* gauss = NULL; 125 125 const gsl_rng_type *T = NULL; 126 126 gsl_rng *r = NULL; … … 144 144 This routine must allocate memory for the polynomial structures. 145 145 *****************************************************************************/ 146 psPolynomial1D *psPolynomial1DAlloc(int n)146 psPolynomial1D* psPolynomial1DAlloc(int n) 147 147 { 148 148 int i = 0; 149 psPolynomial1D *newPoly = NULL;150 151 newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));149 psPolynomial1D* newPoly = NULL; 150 151 newPoly = (psPolynomial1D* ) psAlloc(sizeof(psPolynomial1D)); 152 152 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree); 153 153 newPoly->n = n; … … 164 164 } 165 165 166 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY)167 { 168 int x = 0; 169 int y = 0; 170 psPolynomial2D *newPoly = NULL;171 172 newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));166 psPolynomial2D* psPolynomial2DAlloc(int nX, int nY) 167 { 168 int x = 0; 169 int y = 0; 170 psPolynomial2D* newPoly = NULL; 171 172 newPoly = (psPolynomial2D* ) psAlloc(sizeof(psPolynomial2D)); 173 173 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree); 174 174 newPoly->nX = nX; … … 194 194 } 195 195 196 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ)196 psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ) 197 197 { 198 198 int x = 0; 199 199 int y = 0; 200 200 int z = 0; 201 psPolynomial3D *newPoly = NULL;202 203 newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));201 psPolynomial3D* newPoly = NULL; 202 203 newPoly = (psPolynomial3D* ) psAlloc(sizeof(psPolynomial3D)); 204 204 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree); 205 205 newPoly->nX = nX; … … 233 233 } 234 234 235 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ)235 psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ) 236 236 { 237 237 int w = 0; … … 239 239 int y = 0; 240 240 int z = 0; 241 psPolynomial4D *newPoly = NULL;242 243 newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));241 psPolynomial4D* newPoly = NULL; 242 243 newPoly = (psPolynomial4D* ) psAlloc(sizeof(psPolynomial4D)); 244 244 p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree); 245 245 newPoly->nW = nW; … … 281 281 } 282 282 283 static void polynomial1DFree(psPolynomial1D * myPoly)283 static void polynomial1DFree(psPolynomial1D* myPoly) 284 284 { 285 285 psFree(myPoly->coeff); … … 288 288 } 289 289 290 static void polynomial2DFree(psPolynomial2D * myPoly)290 static void polynomial2DFree(psPolynomial2D* myPoly) 291 291 { 292 292 int x = 0; … … 302 302 } 303 303 304 static void polynomial3DFree(psPolynomial3D * myPoly)304 static void polynomial3DFree(psPolynomial3D* myPoly) 305 305 { 306 306 int x = 0; … … 323 323 } 324 324 325 static void polynomial4DFree(psPolynomial4D * myPoly)325 static void polynomial4DFree(psPolynomial4D* myPoly) 326 326 { 327 327 int w = 0; … … 353 353 Polynomial coefficients will be accessed in [w][x][y][z] fashion. 354 354 *****************************************************************************/ 355 float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)355 float psPolynomial1DEval(float x, const psPolynomial1D* myPoly) 356 356 { 357 357 int loop_x = 0; … … 380 380 } 381 381 382 float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)382 float psPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 383 383 { 384 384 int loop_x = 0; … … 400 400 } 401 401 402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)402 float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 403 403 { 404 404 int loop_x = 0; … … 426 426 } 427 427 428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)428 float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 429 429 { 430 430 int loop_w = 0; … … 458 458 } 459 459 460 psDPolynomial1D *psDPolynomial1DAlloc(int n)460 psDPolynomial1D* psDPolynomial1DAlloc(int n) 461 461 { 462 462 int i = 0; 463 psDPolynomial1D *newPoly = NULL;464 465 newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));463 psDPolynomial1D* newPoly = NULL; 464 465 newPoly = (psDPolynomial1D* ) psAlloc(sizeof(psDPolynomial1D)); 466 466 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree); 467 467 newPoly->n = n; … … 478 478 } 479 479 480 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY)481 { 482 int x = 0; 483 int y = 0; 484 psDPolynomial2D *newPoly = NULL;485 486 newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));480 psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY) 481 { 482 int x = 0; 483 int y = 0; 484 psDPolynomial2D* newPoly = NULL; 485 486 newPoly = (psDPolynomial2D* ) psAlloc(sizeof(psDPolynomial2D)); 487 487 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree); 488 488 newPoly->nX = nX; … … 508 508 } 509 509 510 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ)510 psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ) 511 511 { 512 512 int x = 0; 513 513 int y = 0; 514 514 int z = 0; 515 psDPolynomial3D *newPoly = NULL;516 517 newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));515 psDPolynomial3D* newPoly = NULL; 516 517 newPoly = (psDPolynomial3D* ) psAlloc(sizeof(psDPolynomial3D)); 518 518 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree); 519 519 newPoly->nX = nX; … … 547 547 } 548 548 549 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ)549 psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ) 550 550 { 551 551 int w = 0; … … 553 553 int y = 0; 554 554 int z = 0; 555 psDPolynomial4D *newPoly = NULL;556 557 newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));555 psDPolynomial4D* newPoly = NULL; 556 557 newPoly = (psDPolynomial4D* ) psAlloc(sizeof(psDPolynomial4D)); 558 558 p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree); 559 559 newPoly->nW = nW; … … 595 595 } 596 596 597 static void dPolynomial1DFree(psDPolynomial1D * myPoly)597 static void dPolynomial1DFree(psDPolynomial1D* myPoly) 598 598 { 599 599 psFree(myPoly->coeff); … … 602 602 } 603 603 604 static void dPolynomial2DFree(psDPolynomial2D * myPoly)604 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 605 605 { 606 606 int x = 0; … … 616 616 } 617 617 618 static void dPolynomial3DFree(psDPolynomial3D * myPoly)618 static void dPolynomial3DFree(psDPolynomial3D* myPoly) 619 619 { 620 620 int x = 0; … … 637 637 } 638 638 639 static void dPolynomial4DFree(psDPolynomial4D * myPoly)639 static void dPolynomial4DFree(psDPolynomial4D* myPoly) 640 640 { 641 641 int w = 0; … … 667 667 Polynomial coefficients will be accessed in [w][x][y][z] fashion. 668 668 *****************************************************************************/ 669 double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)669 double psDPolynomial1DEval(double x, const psDPolynomial1D* myPoly) 670 670 { 671 671 int loop_x = 0; … … 686 686 } 687 687 688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)688 double psDPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 689 689 { 690 690 int loop_x = 0; … … 706 706 } 707 707 708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)708 double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 709 709 { 710 710 int loop_x = 0; … … 732 732 } 733 733 734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)734 double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 735 735 { 736 736 int loop_w = 0; -
trunk/psLib/src/math/psSpline.h
r1426 r1440 13 13 * @author George Gusciora, MHPCC 14 14 * 15 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-08-09 2 2:44:25$15 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-09 23:34:57 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 /** Produce a vector of random numbers from a Gaussian distribution with 43 43 the specified mean and sigma */ 44 psVector *psGaussianDev(float mean, ///< The mean of the Gaussian44 psVector* psGaussianDev(float mean, ///< The mean of the Gaussian 45 45 float sigma, ///< The sigma of the Gaussian 46 46 int Npts); ///< The size of the vector … … 95 95 96 96 /** Constructor */ 97 psPolynomial1D *psPolynomial1DAlloc(int n ///< Number of terms98 ); 99 100 /** Constructor */ 101 psPolynomial2D *psPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y102 ); 103 104 /** Constructor */ 105 psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z106 ); 107 108 /** Constructor */ 109 psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and97 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 110 // z 111 111 ); … … 113 113 /** Evaluate 1D polynomial */ 114 114 float psPolynomial1DEval(float x, ///< Value at which to evaluate 115 const psPolynomial1D * myPoly ///< Coefficients for the polynomial115 const psPolynomial1D* myPoly ///< Coefficients for the polynomial 116 116 ); 117 117 … … 119 119 float psPolynomial2DEval(float x, ///< Value x at which to evaluate 120 120 float y, ///< Value y at which to evaluate 121 const psPolynomial2D * myPoly ///< Coefficients for the polynomial121 const psPolynomial2D* myPoly ///< Coefficients for the polynomial 122 122 ); 123 123 … … 126 126 float y, ///< Value y at which to evaluate 127 127 float z, ///< Value z at which to evaluate 128 const psPolynomial3D * myPoly ///< Coefficients for the polynomial128 const psPolynomial3D* myPoly ///< Coefficients for the polynomial 129 129 ); 130 130 … … 134 134 float y, ///< Value y at which to evaluate 135 135 float z, ///< Value z at which to evaluate 136 const psPolynomial4D * myPoly ///< Coefficients for the polynomial136 const psPolynomial4D* myPoly ///< Coefficients for the polynomial 137 137 ); 138 138 … … 188 188 189 189 /** Constructor */ 190 psDPolynomial1D *psDPolynomial1DAlloc(int n ///< Number of terms191 ); 192 193 /** Constructor */ 194 psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY ///< Number of terms in x and y195 ); 196 197 /** Constructor */ 198 psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ ///< Number of terms in x, y and z199 ); 200 201 /** Constructor */ 202 psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and190 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 203 // z 204 204 ); … … 206 206 /** Evaluate 1D polynomial (double precision) */ 207 207 double psDPolynomial1DEval(double x, ///< Value at which to evaluate 208 const psDPolynomial1D * myPoly ///< Coefficients for the polynomial208 const psDPolynomial1D* myPoly ///< Coefficients for the polynomial 209 209 ); 210 210 … … 212 212 double psDPolynomial2DEval(double x, ///< Value x at which to evaluate 213 213 double y, ///< Value y at which to evaluate 214 const psDPolynomial2D * myPoly ///< Coefficients for the polynomial214 const psDPolynomial2D* myPoly ///< Coefficients for the polynomial 215 215 ); 216 216 … … 219 219 double y, ///< Value y at which to evaluate 220 220 double z, ///< Value z at which to evaluate 221 const psDPolynomial3D * myPoly ///< Coefficients for the polynomial221 const psDPolynomial3D* myPoly ///< Coefficients for the polynomial 222 222 ); 223 223 … … 227 227 double y, ///< Value y at which to evaluate 228 228 double z, ///< Value z at which to evaluate 229 const psDPolynomial4D * myPoly ///< Coefficients for the polynomial229 const psDPolynomial4D* myPoly ///< Coefficients for the polynomial 230 230 ); 231 231 -
trunk/psLib/src/math/psStats.c
r1407 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:57 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 #define MAX_ITERATIONS 10 55 55 56 void p_psVectorRobustStats(const psVector * restrict myVector,57 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats);56 void p_psVectorRobustStats(const psVector* restrict myVector, 57 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats); 58 58 59 59 /** Preprocessor macro to generate error on an incorrect type */ … … 116 116 /*****************************************************************************/ 117 117 118 bool p_psGetStatValue(const psStats * stats, double *value)118 bool p_psGetStatValue(const psStats* stats, double *value) 119 119 { 120 120 … … 175 175 *****************************************************************************/ 176 176 177 void p_psVectorPrint(psVector * myVector, psVector * maskVector, unsigned int maskVal, psStats* stats)177 void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats) 178 178 { 179 179 int i = 0; // Loop index variable. … … 218 218 *****************************************************************************/ 219 219 220 void p_psVectorSampleMean(const psVector * restrict myVector,221 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)220 void p_psVectorSampleMean(const psVector* restrict myVector, 221 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 222 222 { 223 223 int i = 0; // Loop index variable … … 282 282 NULL 283 283 *****************************************************************************/ 284 void p_psVectorMax(const psVector * restrict myVector,285 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)284 void p_psVectorMax(const psVector* restrict myVector, 285 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 286 286 { 287 287 int i = 0; // Loop index variable … … 343 343 NULL 344 344 *****************************************************************************/ 345 void p_psVectorMin(const psVector * restrict myVector,346 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)345 void p_psVectorMin(const psVector* restrict myVector, 346 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 347 347 { 348 348 int i = 0; // Loop index variable … … 404 404 NULL 405 405 *****************************************************************************/ 406 int p_psVectorNValues(const psVector * restrict myVector,407 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)406 int p_psVectorNValues(const psVector* restrict myVector, 407 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 408 408 { 409 409 int i = 0; // Loop index variable … … 456 456 NULL 457 457 *****************************************************************************/ 458 void p_psVectorSampleMedian(const psVector * restrict myVector,459 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)460 { 461 psVector *unsortedVector = NULL; // Temporary vector462 psVector *sortedVector = NULL; // Temporary vector458 void p_psVectorSampleMedian(const psVector* restrict myVector, 459 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 460 { 461 psVector* unsortedVector = NULL; // Temporary vector 462 psVector* sortedVector = NULL; // Temporary vector 463 463 int i = 0; // Loop index variable 464 464 int count = 0; // # of points in this mean? … … 565 565 XXX: use a static variable for gaussianCoefs[] and compute them once. 566 566 *****************************************************************************/ 567 psVector *p_psVectorsmoothHistGaussian(psHistogram* robustHistogram, float sigma)567 psVector* p_psVectorsmoothHistGaussian(psHistogram* robustHistogram, float sigma) 568 568 { 569 569 int i = 0; // Loop index variable … … 572 572 float expo = 0.0; // Temporary variable 573 573 float gaussianCoefs[1 + (2 * GAUSS_WIDTH)]; // The Gaussian Coefficients 574 psVector *smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);574 psVector* smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32); 575 575 576 576 for (i = 0; i < (1 + (2 * GAUSS_WIDTH)); i++) { … … 628 628 NULL 629 629 *****************************************************************************/ 630 void p_psVectorSampleQuartiles(const psVector * restrict myVector,631 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)632 { 633 psVector *unsortedVector = NULL; // Temporary vector634 psVector *sortedVector = NULL; // Temporary vector630 void p_psVectorSampleQuartiles(const psVector* restrict myVector, 631 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 632 { 633 psVector* unsortedVector = NULL; // Temporary vector 634 psVector* sortedVector = NULL; // Temporary vector 635 635 int i = 0; // Loop index variable 636 636 int count = 0; // # of points in this mean? … … 710 710 711 711 *****************************************************************************/ 712 void p_psVectorSampleStdev(const psVector * restrict myVector,713 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)712 void p_psVectorSampleStdev(const psVector* restrict myVector, 713 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 714 714 { 715 715 int i = 0; // Loop index variable … … 795 795 NULL 796 796 *****************************************************************************/ 797 void p_psVectorClippedStats(const psVector * restrict myVector,798 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)797 void p_psVectorClippedStats(const psVector* restrict myVector, 798 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 799 799 { 800 800 int i = 0; // Loop index variable … … 804 804 float oldStanMean = 0.0; // Temporary variable 805 805 float oldStanStdev = 0.0; // Temporary variable 806 psVector *tmpMask = NULL; // Temporary vector806 psVector* tmpMask = NULL; // Temporary vector 807 807 808 808 // Endure that stats->clipIter is within the proper range. … … 884 884 elements of a vector to a range between 0.0 and 1.0. 885 885 *****************************************************************************/ 886 void p_psNormalizeVector(psVector * myData)886 void p_psNormalizeVector(psVector* myData) 887 887 { 888 888 float min = (float)HUGE; … … 911 911 specified data point. 912 912 *****************************************************************************/ 913 float p_psGaussian(const psVector * restrict myData, const psVector* restrict myParams)913 float p_psGaussian(const psVector* restrict myData, const psVector* restrict myParams) 914 914 { 915 915 float x = myData->data.F32[0]; … … 928 928 calculates the specified partial derivative of the above Gaussian function. 929 929 *****************************************************************************/ 930 float p_psGaussianDeriv(const psVector * restrict myData, const psVector* restrict myParams, int whichParam)930 float p_psGaussianDeriv(const psVector* restrict myData, const psVector* restrict myParams, int whichParam) 931 931 { 932 932 float x = myData->data.F32[0]; … … 954 954 specified data point. 955 955 *****************************************************************************/ 956 float p_psQuadratic(const psVector * restrict myParams, const psVector* restrict myCoords)956 float p_psQuadratic(const psVector* restrict myParams, const psVector* restrict myCoords) 957 957 { 958 958 float x = myCoords->data.F32[0]; … … 970 970 calculates the specified partial derivative of the above quadratic function. 971 971 *****************************************************************************/ 972 float p_psQuadraticDeriv(const psVector * restrict myParams,973 const psVector * restrict myCoords, int whichParamDeriv)972 float p_psQuadraticDeriv(const psVector* restrict myParams, 973 const psVector* restrict myCoords, int whichParamDeriv) 974 974 { 975 975 float x = myCoords->data.F32[0]; … … 996 996 decreasing within that range. 997 997 *****************************************************************************/ 998 float p_ps1DPolyMedian(psPolynomial1D * myPoly, float rangeLow, float rangeHigh, float getThisValue)998 float p_ps1DPolyMedian(psPolynomial1D* myPoly, float rangeLow, float rangeHigh, float getThisValue) 999 999 { 1000 1000 int numIterations = 0; … … 1036 1036 XXX: This function is currently not being used. 1037 1037 *****************************************************************************/ 1038 float p_psFitQuadratic(psHistogram * histogram, psVector* cumulativeSums, int binNum, float fitFloat)1039 { 1040 psVector *x = psVectorAlloc(3, PS_TYPE_F64);1041 psVector *y = psVectorAlloc(3, PS_TYPE_F64);1042 psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);1043 psPolynomial1D *myPoly = psPolynomial1DAlloc(2);1038 float p_psFitQuadratic(psHistogram* histogram, psVector* cumulativeSums, int binNum, float fitFloat) 1039 { 1040 psVector* x = psVectorAlloc(3, PS_TYPE_F64); 1041 psVector* y = psVectorAlloc(3, PS_TYPE_F64); 1042 psVector* yErr = psVectorAlloc(3, PS_TYPE_F64); 1043 psPolynomial1D* myPoly = psPolynomial1DAlloc(2); 1044 1044 1045 1045 if ((binNum > 0) && (binNum < (histogram->nums->n + 1))) { … … 1100 1100 NULL 1101 1101 *****************************************************************************/ 1102 void p_psVectorRobustStats(const psVector * restrict myVector,1103 const psVector * restrict maskVector, unsigned int maskVal, psStats* stats)1104 { 1105 psHistogram *robustHistogram = NULL;1106 psVector *robustHistogramVector = NULL;1102 void p_psVectorRobustStats(const psVector* restrict myVector, 1103 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats) 1104 { 1105 psHistogram* robustHistogram = NULL; 1106 psVector* robustHistogramVector = NULL; 1107 1107 float binSize = 0.0; // Size of the histogram bins 1108 1108 int LQBinNum = -1; // Bin num for lower quartile … … 1113 1113 float dL = 0.0; 1114 1114 int numBins = 0; 1115 psStats *tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);1116 1117 // psImage *domain;1118 // psVector *errors;1119 // psVector *data;1120 // psVector *initialGuess;1121 // psVector *theParams;1115 psStats* tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN); 1116 1117 // psImage* domain; 1118 // psVector* errors; 1119 // psVector* data; 1120 // psVector* initialGuess; 1121 // psVector* theParams; 1122 1122 // float chiSq=0.0; 1123 1123 // float max = -HUGE; … … 1129 1129 float sumSquares = 0.0; 1130 1130 float sumDiffs = 0.0; 1131 psVector *x = psVectorAlloc(3, PS_TYPE_F64);1132 psVector *y = psVectorAlloc(3, PS_TYPE_F64);1133 psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);1134 psPolynomial1D *myPoly = psPolynomial1DAlloc(2);1135 psVector *cumulativeRobustSumsFullRange = NULL;1136 psVector *cumulativeRobustSumsDlRange = NULL;1131 psVector* x = psVectorAlloc(3, PS_TYPE_F64); 1132 psVector* y = psVectorAlloc(3, PS_TYPE_F64); 1133 psVector* yErr = psVectorAlloc(3, PS_TYPE_F64); 1134 psPolynomial1D* myPoly = psPolynomial1DAlloc(2); 1135 psVector* cumulativeRobustSumsFullRange = NULL; 1136 psVector* cumulativeRobustSumsDlRange = NULL; 1137 1137 float sumRobust = 0.0; 1138 1138 float sumN50 = 0.0; … … 1500 1500 /*****************************************************************************/ 1501 1501 1502 static void histogramFree(psHistogram * myHist);1502 static void histogramFree(psHistogram* myHist); 1503 1503 1504 1504 /****************************************************************************** 1505 1505 psStatsAlloc(): This routine must create a new psStats data structure. 1506 1506 *****************************************************************************/ 1507 psStats *psStatsAlloc(psStatsOptions options)1508 { 1509 psStats *newStruct = NULL;1510 1511 newStruct = (psStats *) psAlloc(sizeof(psStats));1507 psStats* psStatsAlloc(psStatsOptions options) 1508 { 1509 psStats* newStruct = NULL; 1510 1511 newStruct = (psStats* ) psAlloc(sizeof(psStats)); 1512 1512 newStruct->sampleMean = NAN; 1513 1513 newStruct->sampleMedian = NAN; … … 1548 1548 The histogram structure 1549 1549 *****************************************************************************/ 1550 psHistogram *psHistogramAlloc(float lower, float upper, int n)1550 psHistogram* psHistogramAlloc(float lower, float upper, int n) 1551 1551 { 1552 1552 int i = 0; // Loop index variable 1553 psHistogram *newHist = NULL; // The new histogram structure1553 psHistogram* newHist = NULL; // The new histogram structure 1554 1554 float binSize = 0.0; // The histogram bin size 1555 1555 … … 1567 1567 // Allocate memory for the new histogram structure. If there are N 1568 1568 // bins, then there are N+1 bounds to those bins. 1569 newHist = (psHistogram *) psAlloc(sizeof(psHistogram));1569 newHist = (psHistogram* ) psAlloc(sizeof(psHistogram)); 1570 1570 p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree); 1571 1571 newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32); … … 1605 1605 The histogram structure 1606 1606 *****************************************************************************/ 1607 psHistogram *psHistogramAllocGeneric(const psVector* restrict bounds)1608 { 1609 psHistogram *newHist = NULL; // The new histogram structure1607 psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds) 1608 { 1609 psHistogram* newHist = NULL; // The new histogram structure 1610 1610 int i; // Loop index variable 1611 1611 … … 1626 1626 } 1627 1627 // Allocate memory for the new histogram structure. 1628 newHist = (psHistogram *) psAlloc(sizeof(psHistogram));1628 newHist = (psHistogram* ) psAlloc(sizeof(psHistogram)); 1629 1629 p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree); 1630 1630 newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32); … … 1650 1650 } 1651 1651 1652 static void histogramFree(psHistogram * myHist)1652 static void histogramFree(psHistogram* myHist) 1653 1653 { 1654 1654 psFree(myHist->bounds); … … 1670 1670 The histogram structure "out". 1671 1671 *****************************************************************************/ 1672 psHistogram *psVectorHistogram(psHistogram* out,1673 const psVector * restrict in,1674 const psVector * restrict mask, unsigned int maskVal)1672 psHistogram* psVectorHistogram(psHistogram* out, 1673 const psVector* restrict in, 1674 const psVector* restrict mask, unsigned int maskVal) 1675 1675 { 1676 1676 int i = 0; // Loop index variable … … 1767 1767 the various stat functions. 1768 1768 *****************************************************************************/ 1769 psVector *p_psConvertToF32(psStats * stats, psVector * in, psVector* mask, unsigned int maskVal)1769 psVector* p_psConvertToF32(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal) 1770 1770 { 1771 1771 int i = 0; 1772 psVector *tmp = NULL;1772 psVector* tmp = NULL; 1773 1773 1774 1774 if (in->type.type == PS_TYPE_S32) { … … 1812 1812 macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64. 1813 1813 *****************************************************************************/ 1814 psStats *psVectorStats(psStats * stats, psVector * in, psVector* mask, unsigned int maskVal)1815 { 1816 psVector *inF32;1814 psStats* psVectorStats(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal) 1815 { 1816 psVector* inF32; 1817 1817 int mustFreeTmp = 1; 1818 1818 -
trunk/psLib/src/math/psStats.h
r1426 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:57 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 77 77 78 78 /** Do Statistics on an array. Returns a status value. \ingroup MathGroup */ 79 psStats *psVectorStats(psStats* stats, ///< stats structure defines stats to be calculated and how80 psVector * in, ///< Vector to be analysed: must be F3281 psVector * mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT79 psStats* psVectorStats(psStats* stats, ///< stats structure defines stats to be calculated and how 80 psVector* in, ///< Vector to be analysed: must be F32 81 psVector* mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT 82 82 // or NULL 83 83 unsigned int maskVal ///< Only mask elements with one of these bits set in … … 86 86 87 87 /** A constructor for the stats structure.*/ 88 psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure88 psStats* psStatsAlloc(psStatsOptions options); ///< Statistics to measure 89 89 90 90 /****************************************************************************** … … 95 95 typedef struct 96 96 { 97 psVector *bounds; ///< Bounds for the bins (type F32)98 psVector *nums; ///< Number in each of the bins (INT)97 psVector* bounds; ///< Bounds for the bins (type F32) 98 psVector* nums; ///< Number in each of the bins (INT) 99 99 int minNum; ///< Number below the minimum 100 100 int maxNum; ///< Number above the maximum … … 104 104 105 105 /** Constructor \ingroup MathGroup */ 106 psHistogram *psHistogramAlloc(float lower, ///< Lower limit for the bins106 psHistogram* psHistogramAlloc(float lower, ///< Lower limit for the bins 107 107 float upper, ///< Upper limit for the bins 108 108 int n); ///< Number of bins 109 109 110 110 /** Generic constructor \ingroup MathGroup */ 111 psHistogram *psHistogramAllocGeneric(const psVector* restrict bounds); ///< Bounds for the bins111 psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds); ///< Bounds for the bins 112 112 113 113 /** Calculate a histogram \ingroup MathGroup **/ 114 psHistogram *psVectorHistogram(psHistogram* out, ///< Histogram data115 const psVector * restrict in, ///< Vector to analyse116 const psVector * restrict mask, ///< Mask dat for input vector114 psHistogram* psVectorHistogram(psHistogram* out, ///< Histogram data 115 const psVector* restrict in, ///< Vector to analyse 116 const psVector* restrict mask, ///< Mask dat for input vector 117 117 unsigned int maskVal); ///< Mask value 118 118 119 bool p_psGetStatValue(const psStats * stats, double *value);119 bool p_psGetStatValue(const psStats* stats, double *value); 120 120 121 121 /// @} -
trunk/psLib/src/mathtypes/psImage.c
r1407 r1440 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 #include "psImage.h" 33 33 34 static void imageFree(psImage * image);34 static void imageFree(psImage* image); 35 35 36 36 /*****************************************************************************/ … … 40 40 /*****************************************************************************/ 41 41 42 psImage *psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type)42 psImage* psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type) 43 43 { 44 44 int area = 0; … … 61 61 } 62 62 63 psImage *image = (psImage *) psAlloc(sizeof(psImage));63 psImage* image = (psImage* ) psAlloc(sizeof(psImage)); 64 64 65 65 if (image == NULL) { … … 87 87 *(unsigned int *)&image->numCols = numCols; 88 88 *(unsigned int *)&image->numRows = numRows; 89 *(psDimen *) & image->type.dimen = PS_DIMEN_IMAGE;90 *(psElemType *) & image->type.type = type;89 *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE; 90 *(psElemType* ) & image->type.type = type; 91 91 image->parent = NULL; 92 92 image->nChildren = 0; … … 96 96 } 97 97 98 static void imageFree(psImage * image)98 static void imageFree(psImage* image) 99 99 { 100 100 if (image == NULL) { … … 107 107 unsigned int oldNumRows = image->numRows; 108 108 unsigned int oldNumCols = image->numCols; 109 psPTR *rowPtr;109 psPTR* rowPtr; 110 110 111 111 for (unsigned int row = 0; row < oldNumRows; row++) { … … 124 124 } 125 125 126 psImage *psImageRecycle(psImage* old, unsigned int numCols, unsigned int numRows, const psElemType type)126 psImage* psImageRecycle(psImage* old, unsigned int numCols, unsigned int numRows, const psElemType type) 127 127 { 128 128 int elementSize = PSELEMTYPE_SIZEOF(type); // element … … 151 151 unsigned int oldNumRows = old->numRows; 152 152 unsigned int oldNumCols = old->numCols; 153 psPTR *rowPtr;153 psPTR* rowPtr; 154 154 155 155 for (unsigned int row = 0; row < oldNumRows; row++) { … … 177 177 *(unsigned int *)&old->numCols = numCols; 178 178 *(unsigned int *)&old->numRows = numRows; 179 *(psElemType *) & old->type.type = type;179 *(psElemType* ) & old->type.type = type; 180 180 181 181 return old; 182 182 } 183 183 184 int psImageFreeChildren(psImage * image)184 int psImageFreeChildren(psImage* image) 185 185 { 186 186 int i = 0; 187 187 int nChildren = 0; 188 psImage **children = NULL;188 psImage* *children = NULL; 189 189 int numFreed = 0; 190 190 … … 216 216 linear interpolation is performed on the image. 217 217 *****************************************************************************/ 218 psF32 psImagePixelInterpolate(const psImage * input,218 psF32 psImagePixelInterpolate(const psImage* input, 219 219 float x, float y, psF32 unexposedValue, psImageInterpolateMode mode) 220 220 { … … 259 259 260 260 #define PSIMAGE_PIXEL_INTERPOLATE_FLAT(TYPE) \ 261 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage *input, \261 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage* input, \ 262 262 float x, \ 263 263 float y, \ … … 280 280 281 281 #define PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(TYPE) \ 282 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage *input, \282 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE(const psImage* input, \ 283 283 float x, \ 284 284 float y, \ … … 313 313 PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(C64) 314 314 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(TYPE) \ 315 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \315 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage* input, \ 316 316 float x, \ 317 317 float y, \ … … 368 368 } 369 369 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(TYPE) \ 370 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \370 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage* input, \ 371 371 float x, \ 372 372 float y, \ -
trunk/psLib/src/mathtypes/psImage.h
r1426 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 29$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 2 2:44:25$14 * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:58 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 51 51 union { 52 psU8 **U8; ///< Unsigned 8-bit integer data.53 psU16 **U16; ///< Unsigned 16-bit integer data.54 psU32 **U32; ///< Unsigned 32-bit integer data.55 psU64 **U64; ///< Unsigned 64-bit integer data.56 psS8 **S8; ///< Signed 8-bit integer data.57 psS16 **S16; ///< Signed 16-bit integer data.58 psS32 **S32; ///< Signed 32-bit integer data.59 psS64 **S64; ///< Signed 64-bit integer data.60 psF32 **F32; ///< Single-precision float data.61 psF64 **F64; ///< Double-precision float data.62 psC32 **C32; ///< Single-precision complex data.63 psC64 **C64; ///< Double-precision complex data.64 psPTR **PTR; ///< Void pointers.65 psPTR *V; ///< Pointer to data.52 psU8* *U8; ///< Unsigned 8-bit integer data. 53 psU16* *U16; ///< Unsigned 16-bit integer data. 54 psU32* *U32; ///< Unsigned 32-bit integer data. 55 psU64* *U64; ///< Unsigned 64-bit integer data. 56 psS8* *S8; ///< Signed 8-bit integer data. 57 psS16* *S16; ///< Signed 16-bit integer data. 58 psS32* *S32; ///< Signed 32-bit integer data. 59 psS64* *S64; ///< Signed 64-bit integer data. 60 psF32* *F32; ///< Single-precision float data. 61 psF64* *F64; ///< Double-precision float data. 62 psC32* *C32; ///< Single-precision complex data. 63 psC64* *C64; ///< Double-precision complex data. 64 psPTR* *PTR; ///< Void pointers. 65 psPTR* V; ///< Pointer to data. 66 66 } data; ///< Union for data types. 67 const struct psImage *parent; ///< Parent, if a subimage.67 const struct psImage* parent; ///< Parent, if a subimage. 68 68 int nChildren; ///< Number of subimages. 69 struct psImage **children; ///< Children of this region.69 struct psImage* *children; ///< Children of this region. 70 70 } 71 71 psImage; … … 82 82 * specified size and type. 83 83 * 84 * @return psImage* : Pointer to psImage.84 * @return psImage* : Pointer to psImage. 85 85 * 86 86 */ 87 psImage *psImageAlloc(unsigned int numCols, ///< Number of rows in image.87 psImage* psImageAlloc(unsigned int numCols, ///< Number of rows in image. 88 88 unsigned int numRows, ///< Number of columns in image. 89 89 const psElemType type ///< Type of data for image. … … 95 95 * 96 96 */ 97 psImage *psImageRecycle(psImage* old, ///< the psImage to recycle by resizing image buffer97 psImage* psImageRecycle(psImage* old, ///< the psImage to recycle by resizing image buffer 98 98 unsigned int numCols, ///< the desired number of columns in image 99 99 unsigned int numRows, ///< the desired number of rows in image … … 106 106 * 107 107 */ 108 int psImageFreeChildren(psImage * image108 int psImageFreeChildren(psImage* image 109 109 110 110 /**< psImage in which all children shall be deallocated */ 111 111 ); 112 112 113 psF32 psImagePixelInterpolate(const psImage * input,113 psF32 psImagePixelInterpolate(const psImage* input, 114 114 float x, float y, psF32 unexposedValue, psImageInterpolateMode mode); 115 115 116 116 # define p_psImagePixelInterpolateFcns(TYPE) \ 117 117 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE( \ 118 const psImage *input, \118 const psImage* input, \ 119 119 float x, \ 120 120 float y, \ … … 122 122 ); \ 123 123 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE( \ 124 const psImage *input, \124 const psImage* input, \ 125 125 float x, \ 126 126 float y, \ … … 130 130 # define p_psImagePixelInterpolateComplexFcns(TYPE) \ 131 131 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE( \ 132 const psImage *input, \132 const psImage* input, \ 133 133 float x, \ 134 134 float y, \ … … 136 136 ); \ 137 137 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE( \ 138 const psImage *input, \138 const psImage* input, \ 139 139 float x, \ 140 140 float y, \ -
trunk/psLib/src/mathtypes/psScalar.c
r1407 r1440 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:57 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 71 71 72 72 /*****************************************************************************/ 73 psScalar *psScalarAlloc(psC64 value, psElemType dataType)73 psScalar* psScalarAlloc(psC64 value, psElemType dataType) 74 74 { 75 psScalar *scalar = NULL;75 psScalar* scalar = NULL; 76 76 77 77 // Create scalar 78 scalar = (psScalar *) psAlloc(sizeof(psScalar));78 scalar = (psScalar* ) psAlloc(sizeof(psScalar)); 79 79 if (scalar == NULL) { 80 80 psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__); … … 128 128 } 129 129 130 void psScalarFree(psScalar * restrict scalar)130 void psScalarFree(psScalar* restrict scalar) 131 131 { 132 132 if (scalar == NULL) { -
trunk/psLib/src/mathtypes/psScalar.h
r1426 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 62 62 * Accepts a complex 64 bit float for input value, as max size, but resizes according to 63 63 * correct type. 64 * @return psScalar* : Pointer to psScalar.64 * @return psScalar* : Pointer to psScalar. 65 65 * 66 66 */ 67 psScalar *psScalarAlloc(psC64 value, ///< Data to be put into psScalar.67 psScalar* psScalarAlloc(psC64 value, ///< Data to be put into psScalar. 68 68 psElemType dataType ///< Type of data to be held by psScalar. 69 69 ); … … 76 76 * 77 77 */ 78 void psScalarFree(psScalar * restrict scalar ///< Scalar to free.78 void psScalarFree(psScalar* restrict scalar ///< Scalar to free. 79 79 ); 80 80 -
trunk/psLib/src/mathtypes/psVector.c
r1407 r1440 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:57 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 68 68 /*****************************************************************************/ 69 static void vectorFree(psVector * restrict psVec);69 static void vectorFree(psVector* restrict psVec); 70 70 71 71 /*****************************************************************************/ … … 74 74 75 75 /*****************************************************************************/ 76 psVector *psVectorAlloc(unsigned int nalloc, psElemType elemType)77 { 78 psVector *psVec = NULL;76 psVector* psVectorAlloc(unsigned int nalloc, psElemType elemType) 77 { 78 psVector* psVec = NULL; 79 79 int elementSize = 0; 80 80 … … 88 88 89 89 // Create vector struct 90 psVec = (psVector *) psAlloc(sizeof(psVector));90 psVec = (psVector* ) psAlloc(sizeof(psVector)); 91 91 p_psMemSetDeallocator(psVec, (psFreeFcn) vectorFree); 92 92 … … 102 102 } 103 103 104 psVector *psVectorRealloc(unsigned int nalloc, psVector* restrict in)104 psVector* psVectorRealloc(unsigned int nalloc, psVector* restrict in) 105 105 { 106 106 int elementSize = 0; … … 130 130 } 131 131 132 psVector *psVectorRecycle(psVector* restrict in, unsigned int nalloc, psElemType type)132 psVector* psVectorRecycle(psVector* restrict in, unsigned int nalloc, psElemType type) 133 133 { 134 134 psElemType elemType; … … 160 160 } 161 161 162 psVector *psVectorSort(psVector * restrict outVector, const psVector* restrict inVector)162 psVector* psVectorSort(psVector* restrict outVector, const psVector* restrict inVector) 163 163 { 164 164 int inN = 0; … … 261 261 } 262 262 263 psVector *psVectorSortIndex(psVector * restrict outVector, const psVector* restrict inVector)263 psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector) 264 264 { 265 265 int inN = 0; … … 270 270 int *outVec = NULL; 271 271 double diff = 0.0f; 272 psVector *tmpVector = NULL;272 psVector* tmpVector = NULL; 273 273 psElemType inType = 0; 274 274 … … 348 348 } 349 349 350 static void vectorFree(psVector * restrict psVec)350 static void vectorFree(psVector* restrict psVec) 351 351 { 352 352 if (psVec == NULL) { -
trunk/psLib/src/mathtypes/psVector.h
r1426 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 2 2:44:25$14 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:57 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 38 38 39 39 union { 40 psU8 *U8; ///< Unsigned 8-bit integer data.41 psU16 *U16; ///< Unsigned 16-bit integer data.42 psU32 *U32; ///< Unsigned 32-bit integer data.43 psU64 *U64; ///< Unsigned 64-bit integer data.44 psS8 *S8; ///< Signed 8-bit integer data.45 psS16 *S16; ///< Signed 16-bit integer data.46 psS32 *S32; ///< Signed 32-bit integer data.47 psS64 *S64; ///< Signed 64-bit integer data.48 psF32 *F32; ///< Single-precision float data.49 psF64 *F64; ///< Double-precision float data.50 psC32 *C32; ///< Single-precision complex data.51 psC64 *C64; ///< Double-precision complex data.40 psU8* U8; ///< Unsigned 8-bit integer data. 41 psU16* U16; ///< Unsigned 16-bit integer data. 42 psU32* U32; ///< Unsigned 32-bit integer data. 43 psU64* U64; ///< Unsigned 64-bit integer data. 44 psS8* S8; ///< Signed 8-bit integer data. 45 psS16* S16; ///< Signed 16-bit integer data. 46 psS32* S32; ///< Signed 32-bit integer data. 47 psS64* S64; ///< Signed 64-bit integer data. 48 psF32* F32; ///< Single-precision float data. 49 psF64* F64; ///< Double-precision float data. 50 psC32* C32; ///< Single-precision complex data. 51 psC64* C64; ///< Double-precision complex data. 52 52 psPTR V; ///< Pointer to data. 53 53 } data; ///< Union for data types. … … 65 65 * Uses psLib memory allocation functions to create a vector collection of data as defined by the psType type. 66 66 * 67 * @return psVector* : Pointer to psVector.67 * @return psVector* : Pointer to psVector. 68 68 * 69 69 */ 70 psVector *psVectorAlloc(unsigned int nalloc, ///< Total number of elements to make available.70 psVector* psVectorAlloc(unsigned int nalloc, ///< Total number of elements to make available. 71 71 psElemType dataType ///< Type of data to be held by vector. 72 72 ); … … 77 77 * according to the psType type member contained within the vector. 78 78 * 79 * @return psVector* : Pointer to psVector.79 * @return psVector* : Pointer to psVector. 80 80 * 81 81 */ 82 psVector *psVectorRealloc(unsigned int nalloc, ///< Total number of elements to make available.83 psVector * restrict psVec ///< Vector to reallocate.82 psVector* psVectorRealloc(unsigned int nalloc, ///< Total number of elements to make available. 83 psVector* restrict psVec ///< Vector to reallocate. 84 84 ); 85 85 … … 89 89 * according to the psElemType type parameter. 90 90 * 91 * @return psVector* : Pointer to psVector.91 * @return psVector* : Pointer to psVector. 92 92 * 93 93 */ 94 psVector *psVectorRecycle(psVector* restrict psVec,94 psVector* psVectorRecycle(psVector* restrict psVec, 95 95 ///< Vector to recycle. If NULL, a new vector is created. No effort taken to 96 96 // preserve the values. … … 104 104 * all non-complex data types. 105 105 * 106 * @return psFloatArray* : Pointer to sorted psFloatArray.106 * @return psFloatArray* : Pointer to sorted psFloatArray. 107 107 */ 108 108 109 psVector *psVectorSort(psVector* restrict outVector, ///< the output vector to recycle, or NULL if new109 psVector* psVectorSort(psVector* restrict outVector, ///< the output vector to recycle, or NULL if new 110 110 // vector desired. 111 const psVector * restrict inVector ///< the vector to sort.111 const psVector* restrict inVector ///< the vector to sort. 112 112 ); 113 113 … … 117 117 * sorted float values based on pre-sort index positions. 118 118 * 119 * @return psIntArray* : Pointer to psIntArray of sorted indices.119 * @return psIntArray* : Pointer to psIntArray of sorted indices. 120 120 */ 121 121 122 psVector *psVectorSortIndex(psVector * restrict outVector, const psVector* restrict inVector);122 psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector); 123 123 124 124 /// @} -
trunk/psLib/src/sys/psMemory.c
r1407 r1440 9 9 * @author Robert Lupton, Princeton University 10 10 * 11 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:58 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 #define P_PS_LARGE_BLOCK_SIZE 65536 // size where under, we try to recycle 32 32 33 static int checkMemBlock(const psMemBlock * m, const char *funcName);34 static psMemBlock *lastMemBlockAllocated = NULL;33 static int checkMemBlock(const psMemBlock* m, const char *funcName); 34 static psMemBlock* lastMemBlockAllocated = NULL; 35 35 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER; 36 36 static pthread_mutex_t memIdMutex = PTHREAD_MUTEX_INITIALIZER; … … 44 44 45 45 // N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops) 46 static psMemBlock *recycleMemBlockList[13] = {46 static psMemBlock* recycleMemBlockList[13] = { 47 47 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL 48 48 }; 49 49 50 50 #ifdef PS_MEM_DEBUG 51 static psMemBlock *deadBlockList; // a place to put dead memBlocks in debug mode.51 static psMemBlock* deadBlockList; // a place to put dead memBlocks in debug mode. 52 52 #endif 53 53 … … 69 69 while (level >= 0 && ptr == NULL) { 70 70 while (recycleMemBlockList[level] != NULL && ptr == NULL) { 71 psMemBlock *old = recycleMemBlockList[level];71 psMemBlock* old = recycleMemBlockList[level]; 72 72 73 73 recycleMemBlockList[level] = recycleMemBlockList[level]->nextBlock; … … 97 97 } 98 98 99 static void memProblemCallbackDefault(const psMemBlock * ptr, const char *file, int lineno)99 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, int lineno) 100 100 { 101 101 if (ptr->refCounter < 1) { … … 156 156 * isn't resignalled) 157 157 */ 158 static psMemoryId memAllocateCallbackDefault(const psMemBlock * ptr)158 static psMemoryId memAllocateCallbackDefault(const psMemBlock* ptr) 159 159 { 160 160 static psMemoryId incr = 0; // "p_psMemAllocateID += incr" … … 163 163 } 164 164 165 static psMemoryId memFreeCallbackDefault(const psMemBlock * ptr)165 static psMemoryId memFreeCallbackDefault(const psMemBlock* ptr) 166 166 { 167 167 static psMemoryId incr = 0; // "p_psMemFreeID += incr" … … 222 222 */ 223 223 224 static int checkMemBlock(const psMemBlock * m, const char *funcName)224 static int checkMemBlock(const psMemBlock* m, const char *funcName) 225 225 { 226 226 // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked, … … 257 257 pthread_mutex_lock(&memBlockListMutex); 258 258 259 for (psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) {259 for (psMemBlock* iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) { 260 260 if (checkMemBlock(iter, __func__)) { 261 261 nbad++; … … 280 280 { 281 281 282 psMemBlock *ptr = NULL;282 psMemBlock* ptr = NULL; 283 283 284 284 // memory is of the size I want to bother recycling? … … 327 327 // increment the memory id safely. 328 328 pthread_mutex_lock(&memBlockListMutex); 329 *(psMemoryId *) & ptr->id = ++memid;329 *(psMemoryId* ) & ptr->id = ++memid; 330 330 pthread_mutex_unlock(&memBlockListMutex); 331 331 … … 363 363 return p_psAlloc(size, file, lineno); 364 364 } else { 365 psMemBlock *ptr = ((psMemBlock *) vptr) - 1;365 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 366 366 bool isBlockLast = false; 367 367 … … 376 376 isBlockLast = (ptr == lastMemBlockAllocated); 377 377 378 ptr = (psMemBlock *) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));378 ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *)); 379 379 380 380 if (ptr == NULL) { … … 415 415 * Check for memory leaks. 416 416 */ 417 int psMemCheckLeaks(psMemoryId id0, psMemBlock *** arr, FILE * fd)417 int psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd) 418 418 { 419 419 int nleak = 0; 420 420 int j = 0; 421 psMemBlock *topBlock = lastMemBlockAllocated;421 psMemBlock* topBlock = lastMemBlockAllocated; 422 422 423 423 pthread_mutex_lock(&memBlockListMutex); 424 424 425 for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {425 for (psMemBlock* iter = topBlock; iter != NULL; iter = iter->nextBlock) { 426 426 if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) { 427 427 nleak++; … … 446 446 pthread_mutex_lock(&memBlockListMutex); 447 447 448 for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {448 for (psMemBlock* iter = topBlock; iter != NULL; iter = iter->nextBlock) { 449 449 if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) { 450 450 (*arr)[j++] = iter; … … 466 466 psReferenceCount psMemGetRefCounter(void *vptr) 467 467 { 468 psMemBlock *ptr;468 psMemBlock* ptr; 469 469 unsigned int refCount; 470 470 … … 473 473 } 474 474 475 ptr = ((psMemBlock *) vptr) - 1;475 ptr = ((psMemBlock* ) vptr) - 1; 476 476 477 477 if (checkMemBlock(ptr, __func__) != 0) { … … 489 489 void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno) 490 490 { 491 psMemBlock *ptr;491 psMemBlock* ptr; 492 492 493 493 if (vptr == NULL) { … … 495 495 } 496 496 497 ptr = ((psMemBlock *) vptr) - 1;497 ptr = ((psMemBlock* ) vptr) - 1; 498 498 499 499 if (checkMemBlock(ptr, __func__)) { … … 515 515 } 516 516 517 psMemBlock *ptr = ((psMemBlock *) vptr) - 1;517 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 518 518 519 519 if (checkMemBlock(ptr, __func__) != 0) { … … 607 607 } 608 608 609 psMemBlock *ptr = ((psMemBlock *) vptr) - 1;609 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 610 610 611 611 if (checkMemBlock(ptr, __func__) != 0) { … … 622 622 } 623 623 624 psMemBlock *ptr = ((psMemBlock *) vptr) - 1;624 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 625 625 626 626 if (checkMemBlock(ptr, __func__) != 0) { -
trunk/psLib/src/sys/psMemory.h
r1426 r1440 15 15 * @ingroup MemoryManagement 16 16 * 17 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $18 * @date $Date: 2004-08-09 2 2:44:25$17 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 18 * @date $Date: 2004-08-09 23:34:58 $ 19 19 * 20 20 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 64 64 { 65 65 const void *startblock; ///< initialised to p_psMEMMAGIC 66 struct psMemBlock *previousBlock; ///< previous block in allocation list67 struct psMemBlock *nextBlock; ///< next block allocation list66 struct psMemBlock* previousBlock; ///< previous block in allocation list 67 struct psMemBlock* nextBlock; ///< next block allocation list 68 68 psFreeFcn freeFcn; ///< deallocator. If NULL, use generic deallocation. 69 69 size_t userMemorySize; ///< the size of the user-portion of the memory block … … 82 82 * @ingroup memCallback 83 83 */ 84 typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr ///< the psMemBlock just allocated84 typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock* ptr ///< the psMemBlock just allocated 85 85 ); 86 86 … … 90 90 * @ingroup memCallback 91 91 */ 92 typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr ///< the psMemBlock being freed92 typedef psMemoryId(*psMemFreeCallback) (const psMemBlock* ptr ///< the psMemBlock being freed 93 93 ); 94 94 … … 100 100 * @ingroup memCallback 101 101 */ 102 typedef void (*psMemProblemCallback) (const psMemBlock * ptr, ///< the pointer to the problematic memory102 typedef void (*psMemProblemCallback) (const psMemBlock* ptr, ///< the pointer to the problematic memory 103 103 // block. 104 104 const char *file, ///< the file in which the problem originated … … 195 195 */ 196 196 int psMemCheckLeaks(psMemoryId id0, ///< don't list blocks with id < id0 197 psMemBlock *** arr, ///< pointer to array of pointers to leaked blocks, or NULL197 psMemBlock* ** arr, ///< pointer to array of pointers to leaked blocks, or NULL 198 198 FILE * fd ///< print list of leaks to fd (or NULL) 199 199 ); -
trunk/psLib/src/sys/psTrace.c
r1407 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 45 45 # include "psError.h" 46 46 47 static p_psComponent *p_psCroot = NULL; // The root of the trace component47 static p_psComponent* p_psCroot = NULL; // The root of the trace component 48 48 static FILE *p_psTraceFP = NULL; // File destination for messages. 49 49 50 static void componentFree(p_psComponent * comp);51 static p_psComponent *componentAlloc(const char *name, int level);50 static void componentFree(p_psComponent* comp); 51 static p_psComponent* componentAlloc(const char *name, int level); 52 52 53 53 /***************************************************************************** 54 54 componentAlloc(): allocate memory for a new node, and initialize members. 55 55 *****************************************************************************/ 56 static p_psComponent *componentAlloc(const char *name, int level)57 { 58 p_psComponent *comp = psAlloc(sizeof(p_psComponent));56 static p_psComponent* componentAlloc(const char *name, int level) 57 { 58 p_psComponent* comp = psAlloc(sizeof(p_psComponent)); 59 59 60 60 p_psMemSetDeallocator(comp, (psFreeFcn) componentFree); … … 70 70 nodes as well. 71 71 *****************************************************************************/ 72 static void componentFree(p_psComponent * comp)72 static void componentFree(p_psComponent* comp) 73 73 { 74 74 if (comp == NULL) { … … 99 99 Set all trace levels to zero. 100 100 *****************************************************************************/ 101 void p_psTraceReset(p_psComponent * currentNode)101 void p_psTraceReset(p_psComponent* currentNode) 102 102 { 103 103 int i = 0; … … 147 147 char *pname = name; 148 148 char *firstComponent = NULL; // first component of name 149 p_psComponent *currentNode = p_psCroot;149 p_psComponent* currentNode = p_psCroot; 150 150 int nodeExists = 0; 151 151 … … 182 182 if (nodeExists == 0) { 183 183 currentNode->subcomp = psRealloc(currentNode->subcomp, 184 (currentNode->n + 1) * sizeof(p_psComponent *));184 (currentNode->n + 1) * sizeof(p_psComponent* )); 185 185 currentNode->n = (currentNode->n) + 1; 186 186 … … 234 234 char *pname = name; 235 235 char *firstComponent = NULL; // first component of name 236 p_psComponent *currentNode = p_psCroot;236 p_psComponent* currentNode = p_psCroot; 237 237 int i = 0; 238 238 … … 303 303 null 304 304 *****************************************************************************/ 305 static void doPrintTraceLevels(const p_psComponent * comp, int depth)305 static void doPrintTraceLevels(const p_psComponent* comp, int depth) 306 306 { 307 307 int i = 0; -
trunk/psLib/src/sys/psTrace.h
r1426 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 53 53 int level; // trace level for this component 54 54 int n; // number of subcomponents 55 struct p_psComponent **subcomp; // next level of subcomponents55 struct p_psComponent* *subcomp; // next level of subcomponents 56 56 } 57 57 p_psComponent; -
trunk/psLib/src/sysUtils/psMemory.c
r1407 r1440 9 9 * @author Robert Lupton, Princeton University 10 10 * 11 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:58 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 #define P_PS_LARGE_BLOCK_SIZE 65536 // size where under, we try to recycle 32 32 33 static int checkMemBlock(const psMemBlock * m, const char *funcName);34 static psMemBlock *lastMemBlockAllocated = NULL;33 static int checkMemBlock(const psMemBlock* m, const char *funcName); 34 static psMemBlock* lastMemBlockAllocated = NULL; 35 35 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER; 36 36 static pthread_mutex_t memIdMutex = PTHREAD_MUTEX_INITIALIZER; … … 44 44 45 45 // N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops) 46 static psMemBlock *recycleMemBlockList[13] = {46 static psMemBlock* recycleMemBlockList[13] = { 47 47 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL 48 48 }; 49 49 50 50 #ifdef PS_MEM_DEBUG 51 static psMemBlock *deadBlockList; // a place to put dead memBlocks in debug mode.51 static psMemBlock* deadBlockList; // a place to put dead memBlocks in debug mode. 52 52 #endif 53 53 … … 69 69 while (level >= 0 && ptr == NULL) { 70 70 while (recycleMemBlockList[level] != NULL && ptr == NULL) { 71 psMemBlock *old = recycleMemBlockList[level];71 psMemBlock* old = recycleMemBlockList[level]; 72 72 73 73 recycleMemBlockList[level] = recycleMemBlockList[level]->nextBlock; … … 97 97 } 98 98 99 static void memProblemCallbackDefault(const psMemBlock * ptr, const char *file, int lineno)99 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, int lineno) 100 100 { 101 101 if (ptr->refCounter < 1) { … … 156 156 * isn't resignalled) 157 157 */ 158 static psMemoryId memAllocateCallbackDefault(const psMemBlock * ptr)158 static psMemoryId memAllocateCallbackDefault(const psMemBlock* ptr) 159 159 { 160 160 static psMemoryId incr = 0; // "p_psMemAllocateID += incr" … … 163 163 } 164 164 165 static psMemoryId memFreeCallbackDefault(const psMemBlock * ptr)165 static psMemoryId memFreeCallbackDefault(const psMemBlock* ptr) 166 166 { 167 167 static psMemoryId incr = 0; // "p_psMemFreeID += incr" … … 222 222 */ 223 223 224 static int checkMemBlock(const psMemBlock * m, const char *funcName)224 static int checkMemBlock(const psMemBlock* m, const char *funcName) 225 225 { 226 226 // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked, … … 257 257 pthread_mutex_lock(&memBlockListMutex); 258 258 259 for (psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) {259 for (psMemBlock* iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) { 260 260 if (checkMemBlock(iter, __func__)) { 261 261 nbad++; … … 280 280 { 281 281 282 psMemBlock *ptr = NULL;282 psMemBlock* ptr = NULL; 283 283 284 284 // memory is of the size I want to bother recycling? … … 327 327 // increment the memory id safely. 328 328 pthread_mutex_lock(&memBlockListMutex); 329 *(psMemoryId *) & ptr->id = ++memid;329 *(psMemoryId* ) & ptr->id = ++memid; 330 330 pthread_mutex_unlock(&memBlockListMutex); 331 331 … … 363 363 return p_psAlloc(size, file, lineno); 364 364 } else { 365 psMemBlock *ptr = ((psMemBlock *) vptr) - 1;365 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 366 366 bool isBlockLast = false; 367 367 … … 376 376 isBlockLast = (ptr == lastMemBlockAllocated); 377 377 378 ptr = (psMemBlock *) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));378 ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *)); 379 379 380 380 if (ptr == NULL) { … … 415 415 * Check for memory leaks. 416 416 */ 417 int psMemCheckLeaks(psMemoryId id0, psMemBlock *** arr, FILE * fd)417 int psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd) 418 418 { 419 419 int nleak = 0; 420 420 int j = 0; 421 psMemBlock *topBlock = lastMemBlockAllocated;421 psMemBlock* topBlock = lastMemBlockAllocated; 422 422 423 423 pthread_mutex_lock(&memBlockListMutex); 424 424 425 for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {425 for (psMemBlock* iter = topBlock; iter != NULL; iter = iter->nextBlock) { 426 426 if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) { 427 427 nleak++; … … 446 446 pthread_mutex_lock(&memBlockListMutex); 447 447 448 for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {448 for (psMemBlock* iter = topBlock; iter != NULL; iter = iter->nextBlock) { 449 449 if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) { 450 450 (*arr)[j++] = iter; … … 466 466 psReferenceCount psMemGetRefCounter(void *vptr) 467 467 { 468 psMemBlock *ptr;468 psMemBlock* ptr; 469 469 unsigned int refCount; 470 470 … … 473 473 } 474 474 475 ptr = ((psMemBlock *) vptr) - 1;475 ptr = ((psMemBlock* ) vptr) - 1; 476 476 477 477 if (checkMemBlock(ptr, __func__) != 0) { … … 489 489 void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno) 490 490 { 491 psMemBlock *ptr;491 psMemBlock* ptr; 492 492 493 493 if (vptr == NULL) { … … 495 495 } 496 496 497 ptr = ((psMemBlock *) vptr) - 1;497 ptr = ((psMemBlock* ) vptr) - 1; 498 498 499 499 if (checkMemBlock(ptr, __func__)) { … … 515 515 } 516 516 517 psMemBlock *ptr = ((psMemBlock *) vptr) - 1;517 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 518 518 519 519 if (checkMemBlock(ptr, __func__) != 0) { … … 607 607 } 608 608 609 psMemBlock *ptr = ((psMemBlock *) vptr) - 1;609 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 610 610 611 611 if (checkMemBlock(ptr, __func__) != 0) { … … 622 622 } 623 623 624 psMemBlock *ptr = ((psMemBlock *) vptr) - 1;624 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 625 625 626 626 if (checkMemBlock(ptr, __func__) != 0) { -
trunk/psLib/src/sysUtils/psMemory.h
r1426 r1440 15 15 * @ingroup MemoryManagement 16 16 * 17 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $18 * @date $Date: 2004-08-09 2 2:44:25$17 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 18 * @date $Date: 2004-08-09 23:34:58 $ 19 19 * 20 20 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 64 64 { 65 65 const void *startblock; ///< initialised to p_psMEMMAGIC 66 struct psMemBlock *previousBlock; ///< previous block in allocation list67 struct psMemBlock *nextBlock; ///< next block allocation list66 struct psMemBlock* previousBlock; ///< previous block in allocation list 67 struct psMemBlock* nextBlock; ///< next block allocation list 68 68 psFreeFcn freeFcn; ///< deallocator. If NULL, use generic deallocation. 69 69 size_t userMemorySize; ///< the size of the user-portion of the memory block … … 82 82 * @ingroup memCallback 83 83 */ 84 typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr ///< the psMemBlock just allocated84 typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock* ptr ///< the psMemBlock just allocated 85 85 ); 86 86 … … 90 90 * @ingroup memCallback 91 91 */ 92 typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr ///< the psMemBlock being freed92 typedef psMemoryId(*psMemFreeCallback) (const psMemBlock* ptr ///< the psMemBlock being freed 93 93 ); 94 94 … … 100 100 * @ingroup memCallback 101 101 */ 102 typedef void (*psMemProblemCallback) (const psMemBlock * ptr, ///< the pointer to the problematic memory102 typedef void (*psMemProblemCallback) (const psMemBlock* ptr, ///< the pointer to the problematic memory 103 103 // block. 104 104 const char *file, ///< the file in which the problem originated … … 195 195 */ 196 196 int psMemCheckLeaks(psMemoryId id0, ///< don't list blocks with id < id0 197 psMemBlock *** arr, ///< pointer to array of pointers to leaked blocks, or NULL197 psMemBlock* ** arr, ///< pointer to array of pointers to leaked blocks, or NULL 198 198 FILE * fd ///< print list of leaks to fd (or NULL) 199 199 ); -
trunk/psLib/src/sysUtils/psTrace.c
r1407 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 45 45 # include "psError.h" 46 46 47 static p_psComponent *p_psCroot = NULL; // The root of the trace component47 static p_psComponent* p_psCroot = NULL; // The root of the trace component 48 48 static FILE *p_psTraceFP = NULL; // File destination for messages. 49 49 50 static void componentFree(p_psComponent * comp);51 static p_psComponent *componentAlloc(const char *name, int level);50 static void componentFree(p_psComponent* comp); 51 static p_psComponent* componentAlloc(const char *name, int level); 52 52 53 53 /***************************************************************************** 54 54 componentAlloc(): allocate memory for a new node, and initialize members. 55 55 *****************************************************************************/ 56 static p_psComponent *componentAlloc(const char *name, int level)57 { 58 p_psComponent *comp = psAlloc(sizeof(p_psComponent));56 static p_psComponent* componentAlloc(const char *name, int level) 57 { 58 p_psComponent* comp = psAlloc(sizeof(p_psComponent)); 59 59 60 60 p_psMemSetDeallocator(comp, (psFreeFcn) componentFree); … … 70 70 nodes as well. 71 71 *****************************************************************************/ 72 static void componentFree(p_psComponent * comp)72 static void componentFree(p_psComponent* comp) 73 73 { 74 74 if (comp == NULL) { … … 99 99 Set all trace levels to zero. 100 100 *****************************************************************************/ 101 void p_psTraceReset(p_psComponent * currentNode)101 void p_psTraceReset(p_psComponent* currentNode) 102 102 { 103 103 int i = 0; … … 147 147 char *pname = name; 148 148 char *firstComponent = NULL; // first component of name 149 p_psComponent *currentNode = p_psCroot;149 p_psComponent* currentNode = p_psCroot; 150 150 int nodeExists = 0; 151 151 … … 182 182 if (nodeExists == 0) { 183 183 currentNode->subcomp = psRealloc(currentNode->subcomp, 184 (currentNode->n + 1) * sizeof(p_psComponent *));184 (currentNode->n + 1) * sizeof(p_psComponent* )); 185 185 currentNode->n = (currentNode->n) + 1; 186 186 … … 234 234 char *pname = name; 235 235 char *firstComponent = NULL; // first component of name 236 p_psComponent *currentNode = p_psCroot;236 p_psComponent* currentNode = p_psCroot; 237 237 int i = 0; 238 238 … … 303 303 null 304 304 *****************************************************************************/ 305 static void doPrintTraceLevels(const p_psComponent * comp, int depth)305 static void doPrintTraceLevels(const p_psComponent* comp, int depth) 306 306 { 307 307 int i = 0; -
trunk/psLib/src/sysUtils/psTrace.h
r1426 r1440 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 53 53 int level; // trace level for this component 54 54 int n; // number of subcomponents 55 struct p_psComponent **subcomp; // next level of subcomponents55 struct p_psComponent* *subcomp; // next level of subcomponents 56 56 } 57 57 p_psComponent; -
trunk/psLib/src/types/psArray.c
r1407 r1440 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 7 00:06:06$11 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-09 23:34:57 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 33 33 /*****************************************************************************/ 34 static void arrayFree(psArray * restrict psArr);34 static void arrayFree(psArray* restrict psArr); 35 35 36 36 /*****************************************************************************/ … … 39 39 40 40 /*****************************************************************************/ 41 psArray *psArrayAlloc(unsigned int nalloc)41 psArray* psArrayAlloc(unsigned int nalloc) 42 42 { 43 psArray *psArr = NULL;43 psArray* psArr = NULL; 44 44 45 45 // Invalid nalloc … … 49 49 } 50 50 // Create vector struct 51 psArr = (psArray *) psAlloc(sizeof(psArray));51 psArr = (psArray* ) psAlloc(sizeof(psArray)); 52 52 p_psMemSetDeallocator(psArr, (psFreeFcn) arrayFree); 53 53 … … 61 61 } 62 62 63 psArray *psArrayRealloc(unsigned int nalloc, psArray* restrict in)63 psArray* psArrayRealloc(unsigned int nalloc, psArray* restrict in) 64 64 { 65 65 // Invalid nalloc … … 87 87 } 88 88 89 static void arrayFree(psArray * restrict psArr)89 static void arrayFree(psArray* restrict psArr) 90 90 { 91 91 if (psArr == NULL) { … … 98 98 } 99 99 100 void psArrayElementFree(psArray * restrict psArr)100 void psArrayElementFree(psArray* restrict psArr) 101 101 { 102 102 … … 111 111 } 112 112 113 psArray *psArraySort(psArray* in, psComparePtrFcn compare)113 psArray* psArraySort(psArray* in, psComparePtrFcn compare) 114 114 { 115 115 if (in == NULL) { -
trunk/psLib/src/types/psArray.h
r1426 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 2 2:44:25$14 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:57 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 36 36 unsigned int nalloc; ///< Total number of elements available. 37 37 unsigned int n; ///< Number of elements in use. 38 psPTR *data; ///< An Array of pointer elements38 psPTR* data; ///< An Array of pointer elements 39 39 } 40 40 psArray; … … 51 51 * data 52 52 * 53 * @return psArray* : Pointer to psArray.53 * @return psArray* : Pointer to psArray. 54 54 * 55 55 */ 56 psArray *psArrayAlloc(unsigned int nalloc ///< Total number of elements to make available.56 psArray* psArrayAlloc(unsigned int nalloc ///< Total number of elements to make available. 57 57 ); 58 58 … … 62 62 * of data. 63 63 * 64 * @return psArray* : Pointer to psArray.64 * @return psArray* : Pointer to psArray. 65 65 * 66 66 */ 67 psArray *psArrayRealloc(unsigned int nalloc, ///< Total number of elements to make available.68 psArray * restrict psArr ///< array to reallocate.67 psArray* psArrayRealloc(unsigned int nalloc, ///< Total number of elements to make available. 68 psArray* restrict psArr ///< array to reallocate. 69 69 ); 70 70 … … 76 76 * 77 77 */ 78 void psArrayElementFree(psArray * restrict psArr ///< Void pointer array to destroy.78 void psArrayElementFree(psArray* restrict psArr ///< Void pointer array to destroy. 79 79 ); 80 80 … … 84 84 * to specify how the objects on the array should be sorted. 85 85 * 86 * @return psArray* The sorted array.86 * @return psArray* The sorted array. 87 87 */ 88 psArray *psArraySort(psArray* in, psComparePtrFcn compare);88 psArray* psArraySort(psArray* in, psComparePtrFcn compare); 89 89 90 90 /// @} -
trunk/psLib/src/types/psBitSet.c
r1407 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-0 7 00:06:06$13 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 70 70 71 71 /*****************************************************************************/ 72 static void psBitSetFree(psBitSet * restrict inBitSet);72 static void psBitSetFree(psBitSet* restrict inBitSet); 73 73 74 74 /** Private function to create a mask. … … 95 95 96 96 /*****************************************************************************/ 97 psBitSet *psBitSetAlloc(int n)97 psBitSet* psBitSetAlloc(int n) 98 98 { 99 99 int numBytes = 0; 100 psBitSet *newObj = NULL;100 psBitSet* newObj = NULL; 101 101 102 102 if (n <= 0) { … … 125 125 } 126 126 127 static void psBitSetFree(psBitSet * restrict inBitSet)127 static void psBitSetFree(psBitSet* restrict inBitSet) 128 128 { 129 129 if (inBitSet == NULL) { … … 134 134 } 135 135 136 psBitSet *psBitSetSet(psBitSet* inBitSet, int bit)136 psBitSet* psBitSetSet(psBitSet* inBitSet, int bit) 137 137 { 138 138 char *byte = NULL; … … 155 155 } 156 156 157 bool psBitSetTest(const psBitSet * inBitSet, int bit)157 bool psBitSetTest(const psBitSet* inBitSet, int bit) 158 158 { 159 159 char *byte = NULL; … … 178 178 } 179 179 180 psBitSet *psBitSetOp(psBitSet * outBitSet, const psBitSet* restrict inBitSet1, char *operator,181 const psBitSet * restrict inBitSet2)180 psBitSet* psBitSetOp(psBitSet* outBitSet, const psBitSet* restrict inBitSet1, char *operator, 181 const psBitSet* restrict inBitSet2) 182 182 { 183 183 int i = 0; … … 241 241 } 242 242 243 psBitSet *psBitSetNot(psBitSet * outBitSet, const psBitSet* restrict inBitSet)243 psBitSet* psBitSetNot(psBitSet* outBitSet, const psBitSet* restrict inBitSet) 244 244 { 245 245 int i = 0; … … 278 278 } 279 279 280 char *psBitSetToString(const psBitSet * restrict inBitSet)280 char *psBitSetToString(const psBitSet* restrict inBitSet) 281 281 { 282 282 int i = 0; -
trunk/psLib/src/types/psBitSet.h
r1407 r1440 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-08-0 7 00:06:06$15 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-09 23:34:57 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 * allocation. 57 57 * 58 * @return psBitSet* : Pointer to struct containing array of bits and size of array.58 * @return psBitSet* : Pointer to struct containing array of bits and size of array. 59 59 */ 60 60 61 61 /*@null@*/ 62 62 63 psBitSet *psBitSetAlloc(int n63 psBitSet* psBitSetAlloc(int n 64 64 /**< Number of bits in psBitSet array */ 65 65 ); … … 71 71 * an array with two elements would result in an psBitSet that looks like 00000000 00001000. 72 72 * 73 * @return psBitSet* : Pointer to struct containing psBitSet.73 * @return psBitSet* : Pointer to struct containing psBitSet. 74 74 */ 75 psBitSet *psBitSetSet(75 psBitSet* psBitSetSet( 76 76 77 /* @returned@ */ psBitSet * restrict inMask,77 /* @returned@ */ psBitSet* restrict inMask, 78 78 /**< Pointer to psBitSet to be set. */ 79 79 … … 91 91 */ 92 92 93 bool psBitSetTest(const psBitSet * restrict inMask,93 bool psBitSetTest(const psBitSet* restrict inMask, 94 94 /**< Pointer psBitSet to be tested. */ 95 95 … … 102 102 * be performed and an error message will be logged. 103 103 * 104 * @return psBitSet* : Pointer to struct containing result of binary operation.104 * @return psBitSet* : Pointer to struct containing result of binary operation. 105 105 */ 106 psBitSet *psBitSetOp(106 psBitSet* psBitSetOp( 107 107 108 /* @returned@ */ psBitSet * restrict outMask,108 /* @returned@ */ psBitSet* restrict outMask, 109 109 /**< Resulting psBitSet from binary operation */ 110 110 111 const psBitSet * restrict inMask1,111 const psBitSet* restrict inMask1, 112 112 /**< First psBitSet on which to operate */ 113 113 114 114 char *operator, /**< Bit operation */ 115 115 116 const psBitSet * restrict inMask2116 const psBitSet* restrict inMask2 117 117 /**< First psBitSet on which to operate */ 118 118 ); … … 122 122 * Toggles bits in a psBitset. All zero bits are set to one and all one bits are set to zero. 123 123 * 124 * @return psBitSet* : Pointer to struct containing result of operation.124 * @return psBitSet* : Pointer to struct containing result of operation. 125 125 */ 126 126 127 psBitSet *psBitSetNot(psBitSet* outBitSet,127 psBitSet* psBitSetNot(psBitSet* outBitSet, 128 128 /**< Resulting psBitSet from operation */ 129 129 130 const psBitSet * restrict inBitSet130 const psBitSet* restrict inBitSet 131 131 /**< Input psBitSet */ 132 132 ); … … 140 140 */ 141 141 142 char *psBitSetToString(const psBitSet * restrict inMask142 char *psBitSetToString(const psBitSet* restrict inMask 143 143 /**< psBitSet to convert */ 144 144 ); -
trunk/psLib/src/types/psHash.c
r1420 r1440 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 0:29:43$13 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 #include "psAbort.h" 27 27 28 static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket* next);29 static void hashBucketFree(psHashBucket * bucket);30 static void *doHashWork(psHash * table, const char *key, void *data, bool remove28 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next); 29 static void hashBucketFree(psHashBucket* bucket); 30 static void *doHashWork(psHash* table, const char *key, void *data, bool remove 31 31 ); 32 static void hashFree(psHash * table);32 static void hashFree(psHash* table); 33 33 34 34 /****************************************************************************** … … 40 40 The linked list 41 41 *****************************************************************************/ 42 psList *psHashKeyList(psHash* table)42 psList* psHashKeyList(psHash* table) 43 43 { 44 44 int i = 0; // Loop index variable 45 psList *myLinkList = NULL; // The output data structure46 psHashBucket *ptr = NULL; // Used to step thru linked list.45 psList* myLinkList = NULL; // The output data structure 46 psHashBucket* ptr = NULL; // Used to step thru linked list. 47 47 48 48 if (table == NULL) { … … 81 81 the new hash bucket. 82 82 *****************************************************************************/ 83 static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket* next)83 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next) 84 84 { 85 85 if (key == NULL) { … … 87 87 } 88 88 // Allocate memory for the new hash bucket. 89 psHashBucket *bucket = psAlloc(sizeof(psHashBucket));89 psHashBucket* bucket = psAlloc(sizeof(psHashBucket)); 90 90 91 91 p_psMemSetDeallocator(bucket, (psFreeFcn) hashBucketFree); … … 114 114 NONE 115 115 *****************************************************************************/ 116 static void hashBucketFree(psHashBucket * bucket)116 static void hashBucketFree(psHashBucket* bucket) 117 117 { 118 118 if (bucket == NULL) { … … 133 133 The new hash table. 134 134 *****************************************************************************/ 135 psHash *psHashAlloc(int nbucket) // initial number of buckets135 psHash* psHashAlloc(int nbucket) // initial number of buckets 136 136 { 137 137 int i = 0; // loop index variable 138 138 139 139 // Create the new hash table. 140 psHash *table = psAlloc(sizeof(psHash));140 psHash* table = psAlloc(sizeof(psHash)); 141 141 142 142 p_psMemSetDeallocator(table, (psFreeFcn) hashFree); 143 143 144 144 // Allocate memory for the buckets. 145 table->buckets = psAlloc(nbucket * sizeof(psHashBucket *));145 table->buckets = psAlloc(nbucket * sizeof(psHashBucket* )); 146 146 table->nbucket = nbucket; 147 147 … … 168 168 NONE 169 169 *****************************************************************************/ 170 static void hashFree(psHash * table)170 static void hashFree(psHash* table) 171 171 { 172 172 int i = 0; // Loop index variable. … … 210 210 there is little common code between those functions. 211 211 *****************************************************************************/ 212 static void *doHashWork(psHash * table, const char *key, void *data, bool remove212 static void *doHashWork(psHash* table, const char *key, void *data, bool remove 213 213 ) 214 214 { … … 217 217 // "hashed" from the key. 218 218 char *tmpchar = NULL; // Used in computing the hash function. 219 psHashBucket *ptr = NULL; // Used to retrieve the hash bucket.220 psHashBucket *optr = NULL; // "original pointer": used to step219 psHashBucket* ptr = NULL; // Used to retrieve the hash bucket. 220 psHashBucket* optr = NULL; // "original pointer": used to step 221 221 222 222 // thru the linked list for a bucket. … … 338 338 boolean value defining success or failure 339 339 *****************************************************************************/ 340 bool psHashAdd(psHash * table, const char *key, void *data)340 bool psHashAdd(psHash* table, const char *key, void *data) 341 341 { 342 342 if (table == NULL) { … … 364 364 The data associated with that key. 365 365 *****************************************************************************/ 366 void *psHashLookup(psHash * table, // table to lookup key in366 void *psHashLookup(psHash* table, // table to lookup key in 367 367 const char *key) // key to lookup 368 368 { … … 387 387 boolean value defining success or failure 388 388 *****************************************************************************/ 389 bool psHashRemove(psHash * table, const char *key)389 bool psHashRemove(psHash* table, const char *key) 390 390 { 391 391 void *data = NULL; -
trunk/psLib/src/types/psHash.h
r1426 r1440 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 char *key; ///< key for this item of data 32 32 void *data; ///< the data itself 33 struct psHashBucket *next; ///< list of other possible keys33 struct psHashBucket* next; ///< list of other possible keys 34 34 } 35 35 psHashBucket; … … 41 41 { 42 42 int nbucket; ///< Number of buckets in hash table. 43 psHashBucket **buckets; ///< The bucket data.43 psHashBucket* *buckets; ///< The bucket data. 44 44 } 45 45 psHash; 46 46 47 47 /// Allocate hash buckets in table. 48 psHash *psHashAlloc(int nbucket ///< The number of buckets to allocate.48 psHash* psHashAlloc(int nbucket ///< The number of buckets to allocate. 49 49 ); 50 50 51 51 /// Insert entry into table. 52 bool psHashAdd(psHash * table, ///< table to insert in52 bool psHashAdd(psHash* table, ///< table to insert in 53 53 const char *key, ///< key to use 54 54 void *data ///< data to insert … … 56 56 57 57 /// Lookup key in table. 58 void *psHashLookup(psHash * table, ///< table to lookup key in58 void *psHashLookup(psHash* table, ///< table to lookup key in 59 59 const char *key ///< key to lookup 60 60 ); 61 61 62 62 /// Remove key from table. 63 bool psHashRemove(psHash * table, ///< table to lookup key in63 bool psHashRemove(psHash* table, ///< table to lookup key in 64 64 const char *key ///< key to lookup 65 65 ); 66 66 67 67 /// List all keys in table. 68 psList *psHashKeyList(psHash* table ///< table to list keys from.68 psList* psHashKeyList(psHash* table ///< table to list keys from. 69 69 ); 70 70 -
trunk/psLib/src/types/psList.c
r1407 r1440 7 7 * @author Robert Daniel DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-08-0 7 00:06:06$9 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-08-09 23:34:57 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 30 30 // private functions. 31 static psListElem *listGetIterator(psList* list);32 static int listGetIteratorIndex(psList * list);33 static void listSetIterator(psList * list, int where, bool lockList);34 static void listFree(psList * list);35 36 psList *psListAlloc(void *data)37 { 38 psList *list = psAlloc(sizeof(psList));31 static psListElem* listGetIterator(psList* list); 32 static int listGetIteratorIndex(psList* list); 33 static void listSetIterator(psList* list, int where, bool lockList); 34 static void listFree(psList* list); 35 36 psList* psListAlloc(void *data) 37 { 38 psList* list = psAlloc(sizeof(psList)); 39 39 40 40 p_psMemSetDeallocator(list, (psFreeFcn) listFree); … … 55 55 } 56 56 57 static void listFree(psList * list)57 static void listFree(psList* list) 58 58 { 59 59 if (list == NULL) { … … 64 64 ; 65 65 66 for (psListElem * ptr = list->head; ptr != NULL;) {67 psListElem *next = ptr->next;66 for (psListElem* ptr = list->head; ptr != NULL;) { 67 psListElem* next = ptr->next; 68 68 69 69 psFree(ptr->data); … … 81 81 } 82 82 83 bool psListAdd(psList * list, void *data, int where)84 { 85 psListElem *position;86 psListElem *elem;83 bool psListAdd(psList* list, void *data, int where) 84 { 85 psListElem* position; 86 psListElem* elem; 87 87 int cursorIndex = 0; 88 88 … … 168 168 * Remove an element from a list 169 169 */ 170 bool psListRemove(psList * list, void *data, int which)171 { 172 psListElem *elem = NULL; // element to remove170 bool psListRemove(psList* list, void *data, int which) 171 { 172 psListElem* elem = NULL; // element to remove 173 173 int cursorIndex = 0; 174 174 … … 186 186 int i = 0; // index 187 187 188 for (psListElem * ptr = list->head; ptr != NULL; ptr = ptr->next) {188 for (psListElem* ptr = list->head; ptr != NULL; ptr = ptr->next) { 189 189 if (ptr->data == data) { 190 190 which = i; … … 243 243 } 244 244 245 void psListSetIterator(psList * list, int where)245 void psListSetIterator(psList* list, int where) 246 246 { 247 247 listSetIterator(list, where, true); 248 248 } 249 249 250 void listSetIterator(psList * list, int where, bool lockList)251 { 252 psListElem *cursor;250 void listSetIterator(psList* list, int where, bool lockList) 251 { 252 psListElem* cursor; 253 253 int position; 254 254 … … 340 340 } 341 341 342 psListElem *listGetIterator(psList* list)342 psListElem* listGetIterator(psList* list) 343 343 { 344 344 if (list == NULL) { … … 355 355 } 356 356 357 int listGetIteratorIndex(psList * list)357 int listGetIteratorIndex(psList* list) 358 358 { 359 359 if (list->iter == ITER_INIT_HEAD) { … … 366 366 } 367 367 368 void *psListGet(psList * list, int which)369 { 370 psListElem *element;368 void *psListGet(psList* list, int which) 369 { 370 psListElem* element; 371 371 372 372 psListSetIterator(list, which); … … 383 383 * and now return the previous/next element of the list 384 384 */ 385 void *psListGetNext(psList * list)385 void *psListGetNext(psList* list) 386 386 { 387 387 return psListGet(list, PS_LIST_NEXT); 388 388 } 389 389 390 void *psListGetPrevious(psList * list)390 void *psListGetPrevious(psList* list) 391 391 { 392 392 return psListGet(list, PS_LIST_PREVIOUS); 393 393 } 394 394 395 void *psListGetCurrent(psList * list)395 void *psListGetCurrent(psList* list) 396 396 { 397 397 return psListGet(list, PS_LIST_CURRENT); … … 401 401 * Convert a psList to/from a psVoidPtrArray 402 402 */ 403 psArray *psListToArray(psList* restrict list)404 { 405 psListElem *ptr;403 psArray* psListToArray(psList* restrict list) 404 { 405 psListElem* ptr; 406 406 unsigned int n; 407 psArray *restrict arr;407 psArray* restrict arr; 408 408 409 409 if (list == NULL) { … … 429 429 } 430 430 431 psList *psArrayToList(psArray* arr)431 psList* psArrayToList(psArray* arr) 432 432 { 433 433 unsigned int n; 434 psList *list; // list of elements434 psList* list; // list of elements 435 435 436 436 if (arr == NULL) { … … 447 447 } 448 448 449 psList *psListSort(psList* list, psComparePtrFcn compare)450 { 451 psArray *arr;449 psList* psListSort(psList* list, psComparePtrFcn compare) 450 { 451 psArray* arr; 452 452 453 453 if (list == NULL) { -
trunk/psLib/src/types/psList.h
r1426 r1440 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 2 2:44:25$12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:34:57 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 44 44 typedef struct psListElem 45 45 { 46 struct psListElem *prev; ///< previous link in list47 struct psListElem *next; ///< next link in list46 struct psListElem* prev; ///< previous link in list 47 struct psListElem* next; ///< next link in list 48 48 void *data; ///< real data item 49 49 } … … 58 58 { 59 59 unsigned int size; ///< number of elements on list 60 psListElem *head; ///< first element on list (may be NULL)61 psListElem *tail; ///< last element on list (may be NULL)62 psListElem *iter; ///< iteration cursor60 psListElem* head; ///< first element on list (may be NULL) 61 psListElem* tail; ///< last element on list (may be NULL) 62 psListElem* iter; ///< iteration cursor 63 63 unsigned int iterIndex; ///< the numeric position of the iteration cursor in the list 64 64 pthread_mutex_t lock; ///< mutex to lock a node during changes … … 68 68 /** Creates a psList linked list object. 69 69 * 70 * @return psList* A new psList object.70 * @return psList* A new psList object. 71 71 */ 72 psList *psListAlloc(void *data72 psList* psListAlloc(void *data 73 73 ///< initial data item; may be NULL if no an empty psList is desired 74 74 ) … … 77 77 /** Adds an element to a psList at position given. 78 78 * 79 * @return psList* The psList with added data item. If list parameter is79 * @return psList* The psList with added data item. If list parameter is 80 80 * NULL, the return value will also be NULL. 81 81 */ 82 bool psListAdd(psList * restrict list, ///< list to add to (if NULL, nothing is done)82 bool psListAdd(psList* restrict list, ///< list to add to (if NULL, nothing is done) 83 83 void *data, ///< data item to add. If NULL, list is not modified. 84 84 int where ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location. … … 89 89 * @return bool TRUE if element is successfully removed, otherwise FALSE. 90 90 */ 91 bool psListRemove(psList * restrict list,91 bool psListRemove(psList* restrict list, 92 92 ///< list to remove element from 93 93 void *data, … … 104 104 * NULL is returned. 105 105 */ 106 void *psListGet(psList * restrict list, ///< list to retrieve element from106 void *psListGet(psList* restrict list, ///< list to retrieve element from 107 107 int which ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN 108 108 ); … … 112 112 * 113 113 */ 114 void psListSetIterator(psList * restrict list, ///< list to retrieve element from114 void psListSetIterator(psList* restrict list, ///< list to retrieve element from 115 115 int where ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL 116 116 ); … … 123 123 * parameter was NULL. 124 124 */ 125 void *psListGetNext(psList * restrict list ///< list to retrieve element from125 void *psListGetNext(psList* restrict list ///< list to retrieve element from 126 126 ); 127 127 … … 133 133 * iterator is not valid or list parameter was NULL. 134 134 */ 135 void *psListGetCurrent(psList * restrict list ///< list to retrieve element from135 void *psListGetCurrent(psList* restrict list ///< list to retrieve element from 136 136 ); 137 137 … … 143 143 * parameter was NULL. 144 144 */ 145 void *psListGetPrevious(psList * restrict list ///< list to retrieve element from145 void *psListGetPrevious(psList* restrict list ///< list to retrieve element from 146 146 ); 147 147 148 148 /** Convert a linked list to an array 149 149 * 150 * @return psArray* A new psArray populated with elements from the list,150 * @return psArray* A new psArray populated with elements from the list, 151 151 * or NULL if the given dlist parameter is NULL. 152 152 */ 153 psArray *psListToArray(psList* dlist ///< List to convert153 psArray* psListToArray(psList* dlist ///< List to convert 154 154 ); 155 155 156 156 /** Convert array to a doubly-linked list 157 157 * 158 * @return psList* A new psList populated with elements formt the psArray,158 * @return psList* A new psList populated with elements formt the psArray, 159 159 * or NULL is the given arr parameter is NULL. 160 160 */ 161 psList *psArrayToList(psArray* arr ///< vector to convert161 psList* psArrayToList(psArray* arr ///< vector to convert 162 162 ); 163 163 164 psList *psListSort(psList* list, psComparePtrFcn compare);164 psList* psListSort(psList* list, psComparePtrFcn compare); 165 165 166 166 /// @} End of DataGroup Functions -
trunk/psLib/src/types/psMetadata.c
r1432 r1440 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 23: 06:10$14 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:34:57 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 89 89 /*****************************************************************************/ 90 static void metadataItemFree(psMetadataItem * metadataItem)90 static void metadataItemFree(psMetadataItem* metadataItem) 91 91 { 92 92 psMetadataType type; … … 109 109 } 110 110 111 static void metadataFree(psMetadata * metadata)111 static void metadataFree(psMetadata* metadata) 112 112 { 113 113 if (metadata == NULL) { … … 124 124 /*****************************************************************************/ 125 125 126 psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)126 psMetadataItem* psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...) 127 127 { 128 128 va_list argPtr; 129 psMetadataItem *metadataItem = NULL;129 psMetadataItem* metadataItem = NULL; 130 130 131 131 // Get the variable list parameters to pass to allocation function … … 141 141 } 142 142 143 psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,143 psMetadataItem* psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment, 144 144 va_list argPtr) 145 145 { 146 psMetadataItem *metadataItem = NULL;146 psMetadataItem* metadataItem = NULL; 147 147 148 148 if (name == NULL) { … … 151 151 } 152 152 // Allocate metadata item 153 metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));153 metadataItem = (psMetadataItem* ) psAlloc(sizeof(psMetadataItem)); 154 154 if (metadataItem == NULL) { 155 155 psAbort(__func__, "Failed to allocate memory"); … … 211 211 } 212 212 213 psMetadata *psMetadataAlloc(void)214 { 215 psList *list = NULL;216 psHash *table = NULL;217 psMetadata *metadata = NULL;213 psMetadata* psMetadataAlloc(void) 214 { 215 psList* list = NULL; 216 psHash* table = NULL; 217 psMetadata* metadata = NULL; 218 218 219 219 // Allocate metadata 220 metadata = (psMetadata *) psAlloc(sizeof(psMetadata));220 metadata = (psMetadata* ) psAlloc(sizeof(psMetadata)); 221 221 if (metadata == NULL) { 222 222 psAbort(__func__, "Failed to allocate metadata"); … … 226 226 227 227 // Allocate metadata's internal containers 228 list = (psList *) psListAlloc(NULL);228 list = (psList* ) psListAlloc(NULL); 229 229 if (list == NULL) { 230 230 psAbort(__func__, "Failed to allocate list"); 231 231 } 232 232 233 table = (psHash *) psHashAlloc(10);233 table = (psHash* ) psHashAlloc(10); 234 234 if (table == NULL) { 235 235 psAbort(__func__, "Failed to allocate table"); … … 242 242 } 243 243 244 bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem* restrict metadataItem)244 bool psMetadataAddItem(psMetadata* restrict md, int where, psMetadataItem* restrict metadataItem) 245 245 { 246 246 char *key = NULL; 247 psHash *mdTable = NULL;248 psList *mdList = NULL;249 psMetadataItem *value = NULL;247 psHash* mdTable = NULL; 248 psList* mdList = NULL; 249 psMetadataItem* value = NULL; 250 250 psMetadataType type = PS_META_ITEM_SET; 251 251 … … 280 280 } 281 281 // Check if key is already in table 282 value = (psMetadataItem *) psHashLookup(mdTable, key);282 value = (psMetadataItem* ) psHashLookup(mdTable, key); 283 283 if (value != NULL && type != PS_META_ITEM_SET) { 284 284 … … 316 316 } 317 317 318 bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,318 bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type, 319 319 const char *comment, ...) 320 320 { 321 321 va_list argPtr; 322 psMetadataItem *metadataItem = NULL;322 psMetadataItem* metadataItem = NULL; 323 323 324 324 va_start(argPtr, comment); … … 339 339 } 340 340 341 bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)341 bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key) 342 342 { 343 343 int numChildren = 0; 344 psList *mdList = NULL;345 psHash *mdTable = NULL;346 psMetadataItem *entry = NULL;347 psMetadataItem *entryChild = NULL;344 psList* mdList = NULL; 345 psHash* mdTable = NULL; 346 psMetadataItem* entry = NULL; 347 psMetadataItem* entryChild = NULL; 348 348 349 349 … … 368 368 369 369 // Remove by key name 370 entry = (psMetadataItem *) psHashLookup(mdTable, key);370 entry = (psMetadataItem* ) psHashLookup(mdTable, key); 371 371 if (entry == NULL) { 372 372 psError(__func__, "Couldn't find metadata item. Name: %s", key); … … 419 419 } 420 420 421 psMetadataItem *psMetadataLookup(psMetadata* restrict md, const char *restrict key)422 { 423 psHash *mdTable = NULL;424 psMetadataItem *entry = NULL;421 psMetadataItem* psMetadataLookup(psMetadata* restrict md, const char *restrict key) 422 { 423 psHash* mdTable = NULL; 424 psMetadataItem* entry = NULL; 425 425 426 426 … … 441 441 } 442 442 443 entry = (psMetadataItem *) psHashLookup(mdTable, key);443 entry = (psMetadataItem* ) psHashLookup(mdTable, key); 444 444 if (entry == NULL) { 445 445 psError(__func__, "Could not find metadata item. Key: %s", key); … … 450 450 } 451 451 452 psMetadataItem *psMetadataGet(psMetadata* restrict md, int where)453 { 454 psList *mdList = NULL;455 psMetadataItem *entry = NULL;452 psMetadataItem* psMetadataGet(psMetadata* restrict md, int where) 453 { 454 psList* mdList = NULL; 455 psMetadataItem* entry = NULL; 456 456 457 457 … … 467 467 } 468 468 469 entry = (psMetadataItem *) psListGet(mdList, where);469 entry = (psMetadataItem* ) psListGet(mdList, where); 470 470 if (entry == NULL) { 471 471 psError(__func__, "Couldn't find metadata item with given index. Index: %d", where); … … 476 476 } 477 477 478 bool psMetadataSetIterator(psMetadata * restrict md, int where)479 { 480 psList *mdList = NULL;478 bool psMetadataSetIterator(psMetadata* restrict md, int where) 479 { 480 psList* mdList = NULL; 481 481 482 482 if (md == NULL) { … … 496 496 } 497 497 498 psMetadataItem *psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)499 { 500 psList *mdList = NULL;501 psMetadataItem *entry = NULL;498 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which) 499 { 500 psList* mdList = NULL; 501 psMetadataItem* entry = NULL; 502 502 503 503 mdList = md->list; … … 532 532 } 533 533 534 psMetadataItem *psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)535 { 536 psList *mdList = NULL;537 psMetadataItem *entry = NULL;534 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which) 535 { 536 psList* mdList = NULL; 537 psMetadataItem* entry = NULL; 538 538 539 539 mdList = md->list; … … 568 568 } 569 569 570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)570 void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem* restrict metadataItem) 571 571 { 572 572 psMetadataType type; … … 616 616 } 617 617 618 psMetadata *psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd)618 psMetadata* psMetadataFReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd) 619 619 { 620 620 bool tempBool; -
trunk/psLib/src/types/psMetadata.h
r1426 r1440 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25$13 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:34:57 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 66 66 } data; ///< Union for data types. 67 67 char *comment; ///< Optional comment ("", not NULL). 68 psList *restrict items; ///< List of psMetadataItems with same name.68 psList* restrict items; ///< List of psMetadataItems with same name. 69 69 } 70 70 psMetadataItem; … … 78 78 typedef struct psMetadata 79 79 { 80 psList *restrict list;81 psHash *restrict table;80 psList* restrict list; 81 psHash* restrict table; 82 82 } 83 83 psMetadata; … … 100 100 * specified size and type. 101 101 * 102 * @return psMetadataItem* : Pointer metadata item.103 */ 104 psMetadataItem *psMetadataItemAlloc(const char *name, ///< Name of metadata item.102 * @return psMetadataItem* : Pointer metadata item. 103 */ 104 psMetadataItem* psMetadataItemAlloc(const char *name, ///< Name of metadata item. 105 105 psMetadataType type, ///< Type of metadata item. 106 106 const char *comment, ///< Comment for metadata item. … … 119 119 * specified size and type. 120 120 * 121 * @return psMetadataItem* : Pointer metadata item.122 */ 123 psMetadataItem *psMetadataItemAllocV(const char *name, ///< Name of metadata item.121 * @return psMetadataItem* : Pointer metadata item. 122 */ 123 psMetadataItem* psMetadataItemAllocV(const char *name, ///< Name of metadata item. 124 124 psMetadataType type, ///< Type of metadata item. 125 125 const char *comment, ///< Comment for metadata item. … … 132 132 * Returns an empty metadata container with fully allocated internal metadata containers. 133 133 * 134 * @return psMetadata* : Pointer metadata.135 */ 136 psMetadata *psMetadataAlloc(void ///< Void.134 * @return psMetadata* : Pointer metadata. 135 */ 136 psMetadata* psMetadataAlloc(void ///< Void. 137 137 ); 138 138 … … 143 143 * @return bool: True for success, false for failure. 144 144 */ 145 bool psMetadataAddItem(psMetadata * restrict md, ///< Metadata collection to insert metadat item.145 bool psMetadataAddItem(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 146 146 int where, ///< Location to be added. 147 psMetadataItem * restrict item ///< Metadata item to be added.147 psMetadataItem* restrict item ///< Metadata item to be added. 148 148 ); 149 149 … … 154 154 * @return bool: True for success, false for failure. 155 155 */ 156 bool psMetadataAdd(psMetadata * restrict md, ///< Metadata collection to insert metadat item.156 bool psMetadataAdd(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 157 157 int where, ///< Location to be added. 158 158 const char *name, ///< Name of metadata item. … … 171 171 * @return bool: True for success, false for failure. 172 172 */ 173 bool psMetadataRemove(psMetadata * restrict md, ///< Metadata collection to insert metadat item.173 bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 174 174 int where, ///< Location to be removed. 175 175 const char *restrict key ///< Name of metadata key. … … 181 181 * returned. If the item is not found, null is returned. 182 182 * 183 * @return psMetadataItem* : Pointer metadata item.184 */ 185 psMetadataItem *psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat183 * @return psMetadataItem* : Pointer metadata item. 184 */ 185 psMetadataItem* psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat 186 186 // item. 187 187 const char *restrict key ///< Name of metadata key. … … 192 192 * Items may be found in the metadata by their entry position in the list container. 193 193 * 194 * @return psMetadataItem* : Pointer metadata item.195 */ 196 psMetadataItem *psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item.194 * @return psMetadataItem* : Pointer metadata item. 195 */ 196 psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 197 197 int where ///< Location to be retrieved. 198 198 ); … … 204 204 * @return void: void. 205 205 */ 206 bool psMetadataSetIterator(psMetadata * restrict md, ///< Metadata collection to iterate.206 bool psMetadataSetIterator(psMetadata* restrict md, ///< Metadata collection to iterate. 207 207 int where ///< Location of iterator. 208 208 ); … … 212 212 * Get next metadata item in iterator list. 213 213 * 214 * @return psMetadataItem* : Pointer metadata item.215 */ 216 psMetadataItem *psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate.214 * @return psMetadataItem* : Pointer metadata item. 215 */ 216 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate. 217 217 const char *restrict match, ///< Beginning of key name. 218 218 int which ///< Iterator to be used. … … 223 223 * Get previous metadata item in iterator list. 224 224 * 225 * @return psMetadataItem* : Pointer metadata item.226 */ 227 psMetadataItem *psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate.225 * @return psMetadataItem* : Pointer metadata item. 226 */ 227 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate. 228 228 const char *restrict match, ///< Beginning of key name. 229 229 int which ///< Iterator to be used. … … 238 238 * metadata type is any other data type, printing is not allowed. 239 239 * 240 * @return psMetadataItem* : Pointer metadata item.240 * @return psMetadataItem* : Pointer metadata item. 241 241 */ 242 242 void psMetadataItemPrint(FILE * fd, ///< Pointer to file to write metadata item. 243 243 const char *format, ///< Format to print metadata item. 244 const psMetadataItem * restrict metadataItem ///< Metadata item to print.244 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 245 245 ); 246 246 … … 250 250 * unimplemented. 251 251 * 252 * @return psMetadata* : Pointer metadata.253 */ 254 psMetadata *psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read.252 * @return psMetadata* : Pointer metadata. 253 */ 254 psMetadata* psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read. 255 255 char *extname, ///< File name extension string. 256 256 int extnum, ///< File name extension number. Starts at 1. … … 262 262 * Read a metadata header from file. If the file is not found, an error is reported. 263 263 * 264 * @return psMetadata* : Pointer metadata.265 */ 266 psMetadata *psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read.264 * @return psMetadata* : Pointer metadata. 265 */ 266 psMetadata* psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read. 267 267 char *extName, ///< File name extension string. 268 268 int extNum, ///< File name extension number.
Note:
See TracChangeset
for help on using the changeset viewer.
