Changeset 6484 for trunk/psLib/src/math/psMinimizePolyFit.c
- Timestamp:
- Feb 24, 2006, 1:43:16 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psMinimizePolyFit.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psMinimizePolyFit.c
r6305 r6484 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-02- 02 21:09:07$12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-02-24 23:43:15 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 44 44 for (psS32 i = 0 ; i < SIZE ; i++) { \ 45 45 VEC->data.F64[i] = ((2.0 / ((psF64) (SIZE - 1))) * ((psF64) i)) - 1.0; \ 46 VEC->n++; \ 46 47 }\ 47 48 } else if (TYPE == PS_TYPE_F32){ \ 48 49 for (psS32 i = 0 ; i < SIZE ; i++) { \ 49 50 VEC->data.F32[i] = ((2.0 / ((psF32) (SIZE - 1))) * ((psF32) i)) - 1.0; \ 51 VEC->n++; \ 50 52 }\ 51 53 }\ … … 87 89 if (sums == NULL) { 88 90 sums = psVectorAlloc(nSum, PS_TYPE_F64); 91 sums->n = sums->nalloc; 89 92 } else if (nSum > sums->n) { 90 93 sums = psVectorRealloc(sums, nSum); 94 sums->n = sums->nalloc; 91 95 } 92 96 … … 305 309 linear equations which can be easily solved. The resulting vector is the 306 310 coefficients of the Chebyshev polys. 307 311 308 312 This method is significantly slower than the standard NR algorithm. It 309 313 was explicitly requested that we not use the NR algorithm. … … 371 375 } 372 376 B->data.F64[i] = ordPoly->coeff[i]; 377 B->n++; 373 378 } 374 379 … … 534 539 // Compute the B vector 535 540 psVector *B = psVectorAlloc(NUM_POLY, PS_TYPE_F64); 541 B->n = B->nalloc; 536 542 for (psS32 i = 0 ; i < NUM_POLY ; i++) { 537 543 B->data.F64[i] = 0.0; … … 780 786 A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64); 781 787 B = psVectorAlloc(nTerm, PS_TYPE_F64); 788 B->n = B->nalloc; 782 789 // Initialize data structures. 783 790 if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) { … … 1045 1052 psVector *fit = NULL; 1046 1053 psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64); 1054 resid->n = resid->nalloc; 1047 1055 1048 1056 // eventual expansion: user supplies one of various stats option pairs, … … 1205 1213 A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64); 1206 1214 B = psVectorAlloc(nTerm, PS_TYPE_F64); 1215 B->n = B->nalloc; 1207 1216 // Initialize data structures. 1208 1217 if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) { … … 1462 1471 } 1463 1472 psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64); 1473 resid->n = resid->nalloc; 1464 1474 1465 1475 // eventual expansion: user supplies one of various stats option pairs, … … 1630 1640 A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64); 1631 1641 B = psVectorAlloc(nTerm, PS_TYPE_F64); 1642 B->n = B->nalloc; 1632 1643 // Initialize data structures. 1633 1644 if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) { … … 2002 2013 psVector *fit = NULL; 2003 2014 psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64); 2015 resid->n = resid->nalloc; 2004 2016 2005 2017 // eventual expansion: user supplies one of various stats option pairs, … … 2174 2186 A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64); 2175 2187 B = psVectorAlloc(nTerm, PS_TYPE_F64); 2188 B->n = B->nalloc; 2176 2189 // Initialize data structures. 2177 2190 if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) { … … 2596 2609 psVector *fit = NULL; 2597 2610 psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64); 2611 resid->n = resid->nalloc; 2598 2612 2599 2613 // eventual expansion: user supplies one of various stats option pairs,
Note:
See TracChangeset
for help on using the changeset viewer.
