IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 24, 2006, 12:55:05 PM (20 years ago)
Author:
Paul Price
Message:

Following today's meeting, we agreed that psVectorAlloc (and therefore
psArrayAlloc also) shall set the number of elements in use to equal the
number of elements allocated. We introduce new functions,
psVectorAllocEmpty and psArrayAllocEmpty, that allocate a vector and set
the length to zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceFitModel.c

    r9541 r9730  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-10-13 22:11:02 $
     8 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-10-24 22:55:05 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7878
    7979    // construct the coordinate and value entries
    80     psArray *x = psArrayAlloc(nPix);
    81     psVector *y = psVectorAlloc(nPix, PS_TYPE_F32);
    82     psVector *yErr = psVectorAlloc(nPix, PS_TYPE_F32);
     80    psArray *x = psArrayAllocEmpty(nPix);
     81    psVector *y = psVectorAllocEmpty(nPix, PS_TYPE_F32);
     82    psVector *yErr = psVectorAllocEmpty(nPix, PS_TYPE_F32);
    8383
    8484    nPix = 0;
     
    9595
    9696            psVector *coord = psVectorAlloc(2, PS_TYPE_F32);
    97             coord->n = 2;
    9897
    9998            // Convert i/j to image space:
     
    128127    // set parameter mask based on fitting mode
    129128    paramMask = psVectorAlloc (params->n, PS_TYPE_U8);
    130     paramMask->n = params->n;
    131129    psVectorInit (paramMask, 1);
    132130
     
    208206    if (paramMask != NULL) {
    209207        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64);
    210         delta->n = params->n;
    211208        psMinimizeGaussNewtonDelta(delta, params, NULL, x, y, yErr, modelFunc);
    212209        for (int i = 0; i < dparams->n; i++) {
     
    272269    onePar = psVectorAlloc (nPar, PS_DATA_F32);
    273270    oneDeriv = psVectorAlloc (nPar, PS_DATA_F32);
    274     onePar->n = oneDeriv->n = nPar;
    275271
    276272    return true;
     
    357353    psVector *params = psVectorAlloc (nSrc*nPar + 1, PS_TYPE_F32);
    358354    psVector *dparams = psVectorAlloc (nSrc*nPar + 1, PS_TYPE_F32);
    359     params->n = params->nalloc;
    360     dparams->n = dparams->nalloc;
    361355
    362356    pmModelLimits modelLimits = pmModelLimits_GetFunction (model->type);
     
    373367    constrain->paramMask = psVectorAlloc (nSrc*nPar + 1, PS_TYPE_U8);
    374368    constrain->paramDelta = psVectorAlloc (nSrc*nPar + 1, PS_TYPE_F32);
    375     constrain->paramMin->n = constrain->paramMin->nalloc;
    376     constrain->paramMax->n = constrain->paramMax->nalloc;
    377     constrain->paramMask->n = constrain->paramMask->nalloc;
    378     constrain->paramDelta->n = constrain->paramDelta->nalloc;
    379369
    380370    // set the parameter guesses and constraints for the multiple models
     
    459449
    460450    // construct the coordinate and value entries
    461     psArray *x = psArrayAlloc(nPix);
    462     psVector *y = psVectorAlloc(nPix, PS_TYPE_F32);
    463     psVector *yErr = psVectorAlloc(nPix, PS_TYPE_F32);
     451    psArray *x = psArrayAllocEmpty(nPix);
     452    psVector *y = psVectorAllocEmpty(nPix, PS_TYPE_F32);
     453    psVector *yErr = psVectorAllocEmpty(nPix, PS_TYPE_F32);
    464454
    465455    nPix = 0;
     
    475465            }
    476466            psVector *coord = psVectorAlloc(2, PS_TYPE_F32);
    477             coord->n = 2;
    478467
    479468            // Convert i/j to image space:
     
    534523    if (constrain->paramMask != NULL) {
    535524        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64);
    536         delta->n = params->n;
    537525        psMinimizeGaussNewtonDelta(delta, params, NULL, x, y, yErr, pmModelFitSet);
    538526        for (int i = 0; i < dparams->n; i++) {
Note: See TracChangeset for help on using the changeset viewer.