IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4141


Ignore:
Timestamp:
Jun 7, 2005, 1:31:32 PM (21 years ago)
Author:
gusciora
Message:

I basically added comments noting missed areas of test coverage.

Location:
trunk/psLib/test/dataManip
Files:
9 edited

Legend:

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

    r3987 r4141  
    1515
    1616/*****************************************************************************
    17 myFunc(): This routine subtracts the associate value in expectedParm[] from
    18 each parameter and then squares it, then sums that for all parameters, then
    19 adds MIN_VALUE to it.  The minimum for this function will be MIN_VALUE, and
    20 will occur when each parameter equals the associated value in expectedParm[].
    21  
    22 This procedure ignores the coordinates, other than to ensure that they were
    23 passed correctly from psMinimizePowell().
    24  
     17myFunc():
     18    sum = (param[0] * x[0]) +
     19          (param[1] * x[1]) +
     20          ...
    2521 *****************************************************************************/
    26 psVector *myFunc(psImage *myDeriv,
    27                  psVector *myParams,
    28                  psArray *myCoords)
     22psF64 myFunc(psVector *deriv,
     23             psVector *params,
     24             psVector *x)
    2925{
    30     psVector *sum = psVectorAlloc(myCoords->n, PS_TYPE_F32);
    31     psS32 i;
    32     psS32 j;
    33 
    34 
    35     if (myDeriv == NULL) {
    36         myDeriv = psImageAlloc(myParams->n, myCoords->n, PS_TYPE_F32);
    37         psError(PS_ERR_UNKNOWN, true, "myDeriv is NULL.\n");
     26    if ((deriv == NULL) ||
     27            (params == NULL)) {
     28        psError(PS_ERR_UNKNOWN, true, "deriv or params is NULL.\n");
    3829    }
    3930
    40     for (i=0;i<N;i++) {
    41         sum->data.F32[i] = MIN_VALUE;
    42         for (j=0;j<NUM_PARAMS;j++) {
    43             sum->data.F32[i]+= (myParams->data.F32[j] - expectedParm[j]) *
    44                                (myParams->data.F32[j] - expectedParm[j]);
    45 
    46             myDeriv->data.F32[i][j] = (2.0 * myParams->data.F32[j]) -
    47                                       (2.0 * expectedParm[j]);
    48         }
    49     }
    50 
    51     return(sum);
    52 }
    53 
    54 /*****************************************************************************
    55 myFuncEAM(): This routine subtracts the associate value in expectedParm[] from
    56 each parameter and then squares it, then sums that for all parameters, then
    57 adds MIN_VALUE to it.  The minimum for this function will be MIN_VALUE, and
    58 will occur when each parameter equals the associated value in expectedParm[].
    59  
    60 This procedure ignores the coordinates, other than to ensure that they were
    61 passed correctly from psMinimizePowell().
    62  
    63  *****************************************************************************/
    64 psVector *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         }
     31    psF64 sum = 0.0;
     32    for (psS32 i=0 ; i < params->n ; i++) {
     33        sum += (params->data.F32[i] * x->data.F32[i]);
     34        deriv->data.F32[i] = params->data.F32[i];
    8735    }
    8836
     
    12169        myParams->data.F32[i] = (float) i;
    12270        myParams->data.F32[i] = expectedParm[i] * 1.3;
     71        myParams->data.F32[i] = 0.0;
    12372        myParams->data.F32[i] = (float) (5 + i);
    124         myParams->data.F32[i] = 0.0;
    12573    }
    12674
  • trunk/psLib/test/dataManip/tst_psStats00.c

    r3682 r4141  
    33*  @brief Contains tests for psVectorStats with sample mean calculations
    44*
    5 *  @author George Gusciora, MHPCC
     5*  We extensively test the code with data type PS_TYPE_F32.  If these pass, we
     6*  do a much simpler test with data types PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64.
     7*
     8*  If the psStats,c code every changes such that vectors of different type
     9*  are handled by different routines, then these tests must be extended.
     10*
     11*  @author GLG, MHPCC
    612*
    7 *  @version $Revision: 1.17 $  $Name: not supported by cvs2svn $
    8 *  @date $Date: 2005-04-07 20:27:42 $
     13*  @version $Revision: 1.18 $  $Name: not supported by cvs2svn $
     14*  @date $Date: 2005-06-07 23:31:32 $
    915*
    1016*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    5157static psF64 expectedWeightMeanWithMaskRangeF32 =  0.046574;
    5258
     59psF64 rtc(void);
     60psF64 sT, eT;
     61psF64 diff;
     62
     63#include <unistd.h>
    5364psS32 main(psS32 argc, char* argv[] )
    5465{
  • trunk/psLib/test/dataManip/tst_psStats01.c

    r3682 r4141  
    11/** @file  tst_psStats01.c
    22*
    3 *  @brief Contains tests for psVectorStats with max calculations
    4 *
    5 *  @author George Gusciora, MHPCC
    6 *
    7 *  @version $Revision: 1.11 $  $Name: not supported by cvs2svn $
    8 *  @date $Date: 2005-04-07 20:27:42 $
     3*  @brief Contains tests for psVectorStats with max calculations.
     4*
     5*  We extensively test the code with data type PS_TYPE_F32.  If these pass, we
     6*  do a much simpler test with data types PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64.
     7*
     8*  If the psStats,c code every changes such that vectors of different type
     9*  are handled by different routines, then these tests must be extended.
     10*
     11*  @author GLG, MHPCC
     12*
     13*  @version $Revision: 1.12 $  $Name: not supported by cvs2svn $
     14*  @date $Date: 2005-06-07 23:31:32 $
    915*
    1016* Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
  • trunk/psLib/test/dataManip/tst_psStats03.c

    r3682 r4141  
    22    This routine must ensure that PS_STAT_SAMPLE_MEDIAN is correctly computed
    33    by the procedure psVectorStats().
     4 
     5    XXX: Must add tests for various data types, other than psF32.  Copy code
     6    from tst_psStats00.c-tst_psStats02.c.
    47 *****************************************************************************/
    58#include <stdio.h>
  • trunk/psLib/test/dataManip/tst_psStats04.c

    r3682 r4141  
    55    Note: The NVALUES stat was removed from the IfA requirements spec.  So,
    66    this test is no longer in use.
     7 
     8    XXX: Must add tests for various data types, other than psF32.  Copy code
     9    from tst_psStats00.c-tst_psStats02.c.
    710 *****************************************************************************/
    811#include <stdio.h>
  • trunk/psLib/test/dataManip/tst_psStats06.c

    r3682 r4141  
    22    This routine must ensure that PS_STAT_SAMPLE_STDEV is correctly computed
    33    by the procedure psArrayStats().
     4 
     5    XXX: Must add tests for various data types, other than psF32.  Copy code
     6    from tst_psStats00.c-tst_psStats02.c.
    47 *****************************************************************************/
    58#include <stdio.h>
  • trunk/psLib/test/dataManip/tst_psStats07.c

    r3682 r4141  
    22   This routine must ensure that PS_STAT_ROBUST_QUARTILE is correctly computed
    33   by the procedure psArrayStats().
     4 
     5   XXX: Must add tests for various data types, other than psF32.  Copy code
     6   from tst_psStats00.c-tst_psStats02.c.
    47*****************************************************************************/
    58#include <stdio.h>
  • trunk/psLib/test/dataManip/tst_psStats08.c

    r3682 r4141  
    22    This routine must ensure that PS_STAT_SAMPLE_QUARTILE is correctly computed
    33    by the procedure psArrayStats().
     4 
     5    XXX: Must add tests for various data types, other than psF32.  Copy code
     6    from tst_psStats00.c-tst_psStats02.c.
    47 *****************************************************************************/
    58#include <stdio.h>
  • trunk/psLib/test/dataManip/tst_psStats09.c

    r3682 r4141  
    33    PS_STAT_CLIPPED_STDEV is calculate correctly by the procedure
    44    psVectorStats().
     5 
     6    XXX: Must add tests for various data types, other than psF32.  Copy code
     7    from tst_psStats00.c-tst_psStats02.c.
    58 *****************************************************************************/
    69#include <stdio.h>
Note: See TracChangeset for help on using the changeset viewer.