IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 25, 2004, 2:24:30 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/dataManip/tst_psMinimize00.c

    r1095 r1103  
    1515#define NUM_PARAMS 4
    1616
    17 float *myFunc(psVector *myData,
    18               psVector *myParams)
     17float myFunc(const psVector *restrict myData,
     18             const psVector *restrict myParams)
    1919{
    2020    float x = myData->data.F32[0];
     
    2424    float C = myParams->data.F32[2];
    2525    float D = myParams->data.F32[3];
    26     float *tmp = (float *) psAlloc(sizeof(float));
    2726
    28     *tmp = A + (B*x) + (C*y) + (D*x*y);
    29     return(tmp);
     27    return(A + (B*x) + (C*y) + (D*x*y));
    3028}
    3129
    32 float *myFuncDeriv(psVector *myData,
    33                    psVector *myParams,
    34                    int whichParamDeriv)
     30float myFuncDeriv(const psVector *restrict myData,
     31                  const psVector *restrict myParams,
     32                  int whichParamDeriv)
    3533{
    3634    float x = myData->data.F32[0];
    3735    float y = myData->data.F32[1];
    38     float *tmp = (float *) psAlloc(sizeof(float));
     36    float tmp = 0.0;
    3937
    4038    if (whichParamDeriv == 0) {
    41         *tmp = 1.0;
     39        tmp = 1.0;
    4240    } else if (whichParamDeriv == 1) {
    43         *tmp = x;
     41        tmp = x;
    4442    } else if (whichParamDeriv == 2) {
    45         *tmp = y;
     43        tmp = y;
    4644    } else if (whichParamDeriv == 3) {
    47         *tmp = x * y;
     45        tmp = x * y;
    4846    }
    4947    return(tmp);
     
    6664    int memLeaks = 0;
    6765
    68     domain = psImageAlloc(NUM_DATA, DATA_WIDTH, PS_TYPE_F32);
     66    domain = psImageAlloc(DATA_WIDTH, NUM_DATA, PS_TYPE_F32);
    6967    data = psVectorAlloc(NUM_DATA, PS_TYPE_F32);
    7068    errors = psVectorAlloc(NUM_DATA, PS_TYPE_F32);
     
    7371    tmpVecPtr = psVectorAlloc(DATA_WIDTH, PS_TYPE_F32);
    7472
     73    printf("FUCK: initialGuess->n is %d\n", initialGuess->n);
    7574    // Build the data.
    7675    initialGuess->data.F32[0] = 2.0;
     
    9190            tmpVecPtr->data.F32[i] = domain->data.F32[i][j];
    9291        }
    93         data->data.F32[i] = *myFunc(tmpVecPtr, initialGuess);
     92        data->data.F32[i] = myFunc(tmpVecPtr, initialGuess);
    9493    }
    9594
     
    104103                   errors,
    105104                   initialGuess,
    106                    paramMask,
     105                   NULL,
    107106                   &chiSq);
    108107
Note: See TracChangeset for help on using the changeset viewer.