IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6943


Ignore:
Timestamp:
Apr 21, 2006, 11:28:31 AM (20 years ago)
Author:
magnier
Message:

vector length initialization

Location:
trunk/psModules/src
Files:
8 edited

Legend:

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

    r6872 r6943  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-04-17 18:01:05 $
     7 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-04-21 21:25:52 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535    growth->radius = psVectorCreate (NULL, minRadius, maxRadius, 1.0, PS_TYPE_F32);
    3636    growth->apMag  = psVectorAlloc (growth->radius->n, PS_TYPE_F32);
     37    growth->apMag->n = growth->radius->n;
    3738
    3839    // XXX may want to extend this to allow for a different refRadius;
  • trunk/psModules/src/objects/pmModel.c

    r6872 r6943  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-04-17 18:01:05 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-04-21 21:26:01 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6161    tmp->params  = psVectorAlloc(Nparams, PS_TYPE_F32);
    6262    tmp->dparams = psVectorAlloc(Nparams, PS_TYPE_F32);
     63    tmp->params->n = tmp->dparams->n = Nparams;
    6364
    6465    for (psS32 i = 0; i < tmp->params->n; i++) {
     
    111112    x->data.F32[0] = (psF32) (col + image->col0);
    112113    x->data.F32[1] = (psF32) (row + image->row0);
     114    x->n = 2;
    113115    psF32 tmpF;
    114116    pmModelFunc modelFunc;
     
    136138
    137139    psVector *x = psVectorAlloc(2, PS_TYPE_F32);
     140    x->n = 2;
    138141    psVector *params = model->params;
    139142    pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type);
  • trunk/psModules/src/objects/pmPSFtry.c

    r6910 r6943  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-04-19 20:37:35 $
     7 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-04-21 21:26:22 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767    test->fitMag   = psVectorAlloc (sources->n, PS_TYPE_F64);
    6868    test->mask     = psVectorAlloc (sources->n, PS_TYPE_U8);
     69    test->metric->n = test->fitMag->n = test->mask->n = sources->n;
     70    test->modelEXT->n = test->modelPSF->n = sources->n;
    6971
    7072    for (int i = 0; i < test->modelEXT->n; i++) {
     
    190192    psVector *chisq = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64);
    191193    psVector *mask  = psVectorAlloc (psfTry->sources->n, PS_TYPE_MASK);
     194    flux->n = mask->n = chisq->n = psfTry->sources->n;
    192195
    193196    // write sources with models first
     
    211214    psVectorClipFitPolynomial1D (psfTry->psf->ChiTrend, stats, mask, 1, chisq, NULL, flux);
    212215    for (int i = 0; i < psfTry->psf->ChiTrend->nX + 1; i++) {
    213         psLogMsg ("pmPSFtry", 4, "chisq vs flux fit term %d: %f +/- %f\n", i, psfTry->psf->ChiTrend->coeff[i]*pow(10000, i), psfTry->psf->ChiTrend->coeffErr[i]);
     216        psLogMsg ("pmPSFtry", 4, "chisq vs flux fit term %d: %f +/- %f\n", i, psfTry->psf->ChiTrend->coeff[i]*pow(10000, i), psfTry->psf->ChiTrend->coeffErr[i]*pow(10000,i));
    214217    }
    215218    psLogMsg ("pmPSFtry", 4, "chisq vs flux fit: %f +/- %f\n", stats->sampleMedian, stats->sampleStdev);
     
    239242    // r2rflux = radius^2 * ten(0.4*fitMag);
    240243    psVector *r2rflux = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64);
     244    r2rflux->n = psfTry->sources->n;
     245
    241246    for (int i = 0; i < psfTry->sources->n; i++) {
    242247        if (psfTry->mask->data.U8[i] & PSFTRY_MASK_ALL)
  • trunk/psModules/src/objects/pmPeaks.c

    r6872 r6943  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-04-17 18:01:05 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-04-21 21:26:44 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6565        tmpVector->data.F32[col] = image->data.F32[row][col];
    6666    }
     67    tmpVector->n = image->numCols;
    6768    psTrace(__func__, 4, "---- %s() end ----\n", __func__);
    6869    return(tmpVector);
     
    181182            tmpVector = psVectorAlloc(1, PS_TYPE_U32);
    182183            tmpVector->data.U32[0] = 0;
     184            tmpVector->n = 1;
    183185        } else {
    184186            tmpVector = psVectorAlloc(0, PS_TYPE_U32);
     
    220222    //
    221223    psVector *tmpVector = psVectorAlloc(count, PS_TYPE_U32);
     224    tmpVector->n = count;
    222225    count = 0;
    223226
  • trunk/psModules/src/objects/pmSourceContour.c

    r6872 r6943  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-04-17 18:01:05 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-04-21 21:27:04 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    323323    // fprintf (stderr, "done\n");
    324324    psArray *tmpArray = psArrayAlloc(2);
     325    tmpArray->n = 2;
     326
    325327    tmpArray->data[0] = (psPtr *) xVec;
    326328    tmpArray->data[1] = (psPtr *) yVec;
     
    360362    psVector *xVec = psVectorAlloc(2 * source->pixels->numRows, PS_TYPE_F32);
    361363    psVector *yVec = psVectorAlloc(2 * source->pixels->numRows, PS_TYPE_F32);
     364    xVec->n = yVec->n = 2 * source->pixels->numRows;
    362365
    363366    //
     
    440443    //
    441444    psArray *tmpArray = psArrayAlloc(2);
     445    tmpArray->n = 2;
     446
    442447    tmpArray->data[0] = (psPtr *) yVec;
    443448    tmpArray->data[1] = (psPtr *) xVec;
  • trunk/psModules/src/objects/pmSourceIO_CMF.c

    r6872 r6943  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-17 18:01:05 $
     5 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-21 21:27:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    124124
    125125    psArray *sources = psArrayAlloc (table->n);
     126    sources->n = table->n;
    126127
    127128    // convert the table to the pmSource entries
  • trunk/psModules/src/objects/pmSourcePhotometry.c

    r6910 r6943  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-19 20:37:35 $
     5 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-21 21:28:31 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    237237    pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type);
    238238    psVector *coord = psVectorAlloc(2, PS_TYPE_F32);
     239    coord->n = 2;
     240
    239241    psVector *params = model->params;
    240242
  • trunk/psModules/src/pslib/psSparse.c

    r6872 r6943  
    3030    sparse->Bfj = psVectorAlloc (Nrows, PS_DATA_F32);
    3131    sparse->Qii = psVectorAlloc (Nrows, PS_DATA_F32);
     32    sparse->Bfj->n = Nrows;
     33    sparse->Qii->n = Nrows;
    3234
    3335    sparse->Nrows = Nrows;
     
    109111    if (output == NULL) {
    110112        output = psVectorAlloc (vector->n, PS_DATA_F32);
     113        output->n = vector->n;
    111114    }
    112115
     
    136139    // temporary storage for intermediate results
    137140    psVector *dQ = psVectorAlloc (guess->n, PS_DATA_F32);
     141    dQ->n = guess->n;
    138142
    139143    for (int j = 0; j < Niter; j++) {
     
    171175    psVector *tSi  = psVectorAlloc (Nelem, PS_DATA_S32);
    172176    psVector *tSj  = psVectorAlloc (Nelem, PS_DATA_S32);
     177    tAij->n = tSi->n = tSj->n = Nelem;
     178
    173179    for (int i = 0; i < Nelem; i++) {
    174180        int j = index->data.U32[i];
     
    213219    x->data.F32[1] = 5;
    214220    x->data.F32[2] = 7;
    215     fprintf (stderr, "x: %f %f %f\n", x->data.F32[0], x->data.F32[1], x->data.F32[2]);
     221    x->n = 3;
     222    fprintf (stderr, "x: %f %f %f\n", x->data.F32[0], x->data.F32[1], x->data.F32[2]);
     223
    216224
    217225    psVector *B = psSparseMatrixTimesVector (NULL, sparse, x);
Note: See TracChangeset for help on using the changeset viewer.