IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 19, 2005, 12:50:05 PM (21 years ago)
Author:
gusciora
Message:

Added comment.

File:
1 edited

Legend:

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

    r3682 r3987  
    5151    return(sum);
    5252}
     53
     54/*****************************************************************************
     55myFuncEAM(): This routine subtracts the associate value in expectedParm[] from
     56each parameter and then squares it, then sums that for all parameters, then
     57adds MIN_VALUE to it.  The minimum for this function will be MIN_VALUE, and
     58will occur when each parameter equals the associated value in expectedParm[].
     59 
     60This procedure ignores the coordinates, other than to ensure that they were
     61passed correctly from psMinimizePowell().
     62 
     63 *****************************************************************************/
     64psVector *myFuncEAM(psImage *myDeriv,
     65                    psVector *myParams,
     66                    psArray *myCoords)
     67{
     68    psVector *sum = psVectorAlloc(myCoords->n, PS_TYPE_F32);
     69    psS32 i;
     70    psS32 j;
     71
     72
     73    if (myDeriv == NULL) {
     74        myDeriv = psImageAlloc(myParams->n, myCoords->n, PS_TYPE_F32);
     75        psError(PS_ERR_UNKNOWN, true, "myDeriv is NULL.\n");
     76    }
     77
     78    for (i=0;i<N;i++) {
     79        sum->data.F32[i] = MIN_VALUE;
     80        for (j=0;j<NUM_PARAMS;j++) {
     81            sum->data.F32[i]+= (myParams->data.F32[j] - expectedParm[j]) *
     82                               (myParams->data.F32[j] - expectedParm[j]);
     83
     84            myDeriv->data.F32[i][j] = (2.0 * myParams->data.F32[j]) -
     85                                      (2.0 * expectedParm[j]);
     86        }
     87    }
     88
     89    return(sum);
     90}
     91
    5392
    5493psS32 t01()
Note: See TracChangeset for help on using the changeset viewer.