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/psLib/src/math/psSparse.c

    r8627 r9730  
    3535    psMemSetDeallocator(sparse, (psFreeFunc)sparseFree);
    3636
    37     sparse->Aij = psVectorAlloc(Nelem, PS_DATA_F32);
    38     sparse->Si  = psVectorAlloc(Nelem, PS_DATA_S32);
    39     sparse->Sj  = psVectorAlloc(Nelem, PS_DATA_S32);
    40 
    41     sparse->Aij->n = 0;
    42     sparse->Si->n  = 0;
    43     sparse->Sj->n  = 0;
     37    sparse->Aij = psVectorAllocEmpty(Nelem, PS_DATA_F32);
     38    sparse->Si  = psVectorAllocEmpty(Nelem, PS_DATA_S32);
     39    sparse->Sj  = psVectorAllocEmpty(Nelem, PS_DATA_S32);
     40
    4441    sparse->Nelem = 0;
    4542
    4643    sparse->Bfj = psVectorAlloc(Nrows, PS_DATA_F32);
    4744    sparse->Qii = psVectorAlloc(Nrows, PS_DATA_F32);
    48     sparse->Bfj->n = Nrows;
    49     sparse->Qii->n = Nrows;
    5045
    5146    sparse->Nrows = Nrows;
     
    157152    // temporary storage for intermediate results
    158153    psVector *dQ = psVectorAlloc(output->n, PS_DATA_F32);
    159     dQ->n = output->n;
    160154
    161155    for (int j = 0; j < Niter; j++) {
     
    197191    psVector *tSi  = psVectorAlloc(Nelem, PS_DATA_S32);
    198192    psVector *tSj  = psVectorAlloc(Nelem, PS_DATA_S32);
    199     tAij->n = tSi->n = tSj->n = Nelem;
    200193
    201194    for (int i = 0; i < Nelem; i++) {
Note: See TracChangeset for help on using the changeset viewer.