Changeset 5530 for trunk/psLib/src/math
- Timestamp:
- Nov 16, 2005, 1:07:10 PM (21 years ago)
- Location:
- trunk/psLib/src/math
- Files:
-
- 3 edited
-
psMinimize.c (modified) (4 diffs)
-
psMinimize.h (modified) (2 diffs)
-
psStats.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psMinimize.c
r5453 r5530 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1.14 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-1 0-28 19:15:04$12 * @version $Revision: 1.145 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-11-16 23:06:19 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 17 17 * XXX: must follow coding name standards on local functions. 18 18 * XXX: put local functions in front. 19 * 19 * 20 20 */ 21 21 /*****************************************************************************/ … … 596 596 psMinimization *min = psAlloc(sizeof(psMinimization)); 597 597 psMemSetDeallocator(min, (psFreeFunc)minimizationFree); 598 *(int*)&min->maxIter = maxIter;599 *(float*)&min->tol = tol;598 P_PSMINIMIZATION_SET_MAXITER(min,maxIter); 599 P_PSMINIMIZATION_SET_TOL(min,tol); 600 600 min->value = 0.0; 601 601 min->iter = 0; … … 1164 1164 for (i=0;i<numDims;i++) { 1165 1165 if (myParamMask->data.U8[i] == 0) { 1166 *(int*)&dummyMin.maxIter = PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS;1166 P_PSMINIMIZATION_SET_MAXITER((&dummyMin),PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS); 1167 1167 *(float*)&dummyMin.tol = PS_MINIMIZE_POWELL_LINEMIN_ERROR_TOLERANCE; 1168 1168 mul = p_psLineMin(&dummyMin, -
trunk/psLib/src/math/psMinimize.h
r5176 r5530 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $11 * @date $Date: 2005- 09-29 02:16:19 $10 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-11-16 23:06:19 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 psMinimization; 53 53 54 /** Allocates a psMinimization structure. 55 * 56 * @return psMinimization* : a new psMinimization struct 57 */ 58 psMinimization *psMinimizationAlloc( 59 int maxIter, ///< Number of minimization iterations to perform. 60 float tol ///< Requested error tolerance 61 ); 54 #define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val 55 #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val 56 57 58 /** Allocates a psMinimization structure. 59 * 60 * @return psMinimization* : a new psMinimization struct 61 */ 62 psMinimization *psMinimizationAlloc( 63 int maxIter, ///< Number of minimization iterations to perform. 64 float tol ///< Requested error tolerance 65 ); 62 66 63 67 /** Checks the type of a particular pointer. -
trunk/psLib/src/math/psStats.c
r5517 r5530 17 17 * 18 18 * 19 * @version $Revision: 1.15 0$ $Name: not supported by cvs2svn $20 * @date $Date: 2005-11-1 5 20:10:32$19 * @version $Revision: 1.151 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2005-11-16 23:06:19 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 2334 2334 newHist = (psHistogram* ) psAlloc(sizeof(psHistogram)); 2335 2335 psMemSetDeallocator(newHist, (psFreeFunc) histogramFree); 2336 newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32); 2337 *(int *)&newHist->bounds->n = newHist->bounds->nalloc; 2336 psVector* newBounds = psVectorAlloc(n + 1, PS_TYPE_F32); 2337 newHist->bounds = newBounds; 2338 newBounds->n = newHist->bounds->nalloc; 2338 2339 2339 2340 // Calculate the bounds for each bin. … … 2343 2344 binSize += FLT_EPSILON; 2344 2345 for (i = 0; i < n + 1; i++) { 2345 new Hist->bounds->data.F32[i] = lower + (binSize * (psF32)i);2346 newBounds->data.F32[i] = lower + (binSize * (psF32)i); 2346 2347 } 2347 2348 … … 2383 2384 newHist = (psHistogram* ) psAlloc(sizeof(psHistogram)); 2384 2385 psMemSetDeallocator(newHist, (psFreeFunc) histogramFree); 2385 newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32); 2386 *(int *)&newHist->bounds->n = newHist->bounds->nalloc; 2386 psVector* newBounds = psVectorAlloc(bounds->n, PS_TYPE_F32); 2387 newHist->bounds = newBounds; 2388 newBounds->n = newHist->bounds->nalloc; 2387 2389 for (i = 0; i < bounds->n; i++) { 2388 new Hist->bounds->data.F32[i] = bounds->data.F32[i];2390 newBounds->data.F32[i] = bounds->data.F32[i]; 2389 2391 } 2390 2392
Note:
See TracChangeset
for help on using the changeset viewer.
