IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 24, 2006, 1:43:16 PM (20 years ago)
Author:
drobbin
Message:

Changed psArray & psVector to zero 'n' upon allocation. Used to set vector->n = nalloc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psMinimizePolyFit.c

    r6305 r6484  
    1010 *  @author EAM, IfA
    1111 *
    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 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4444    for (psS32 i = 0 ; i < SIZE ; i++) { \
    4545        VEC->data.F64[i] = ((2.0 / ((psF64) (SIZE - 1))) * ((psF64) i)) - 1.0; \
     46        VEC->n++; \
    4647    }\
    4748} else if (TYPE == PS_TYPE_F32){ \
    4849    for (psS32 i = 0 ; i < SIZE ; i++) { \
    4950        VEC->data.F32[i] = ((2.0 / ((psF32) (SIZE - 1))) * ((psF32) i)) - 1.0; \
     51        VEC->n++; \
    5052    }\
    5153}\
     
    8789    if (sums == NULL) {
    8890        sums = psVectorAlloc(nSum, PS_TYPE_F64);
     91        sums->n = sums->nalloc;
    8992    } else if (nSum > sums->n) {
    9093        sums = psVectorRealloc(sums, nSum);
     94        sums->n = sums->nalloc;
    9195    }
    9296
     
    305309    linear equations which can be easily solved.  The resulting vector is the
    306310    coefficients of the Chebyshev polys.
    307     
     311 
    308312    This method is significantly slower than the standard NR algorithm.  It
    309313    was explicitly requested that we not use the NR algorithm.
     
    371375        }
    372376        B->data.F64[i] = ordPoly->coeff[i];
     377        B->n++;
    373378    }
    374379
     
    534539    // Compute the B vector
    535540    psVector *B = psVectorAlloc(NUM_POLY, PS_TYPE_F64);
     541    B->n = B->nalloc;
    536542    for (psS32 i = 0 ; i < NUM_POLY ; i++) {
    537543        B->data.F64[i] = 0.0;
     
    780786    A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64);
    781787    B = psVectorAlloc(nTerm, PS_TYPE_F64);
     788    B->n = B->nalloc;
    782789    // Initialize data structures.
    783790    if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) {
     
    10451052    psVector *fit   = NULL;
    10461053    psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64);
     1054    resid->n = resid->nalloc;
    10471055
    10481056    // eventual expansion: user supplies one of various stats option pairs,
     
    12051213    A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64);
    12061214    B = psVectorAlloc(nTerm, PS_TYPE_F64);
     1215    B->n = B->nalloc;
    12071216    // Initialize data structures.
    12081217    if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) {
     
    14621471    }
    14631472    psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64);
     1473    resid->n = resid->nalloc;
    14641474
    14651475    // eventual expansion: user supplies one of various stats option pairs,
     
    16301640    A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64);
    16311641    B = psVectorAlloc(nTerm, PS_TYPE_F64);
     1642    B->n = B->nalloc;
    16321643    // Initialize data structures.
    16331644    if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) {
     
    20022013    psVector *fit   = NULL;
    20032014    psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64);
     2015    resid->n = resid->nalloc;
    20042016
    20052017    // eventual expansion: user supplies one of various stats option pairs,
     
    21742186    A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64);
    21752187    B = psVectorAlloc(nTerm, PS_TYPE_F64);
     2188    B->n = B->nalloc;
    21762189    // Initialize data structures.
    21772190    if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) {
     
    25962609    psVector *fit   = NULL;
    25972610    psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64);
     2611    resid->n = resid->nalloc;
    25982612
    25992613    // eventual expansion: user supplies one of various stats option pairs,
Note: See TracChangeset for help on using the changeset viewer.