Changeset 4141
- Timestamp:
- Jun 7, 2005, 1:31:32 PM (21 years ago)
- Location:
- trunk/psLib/test/dataManip
- Files:
-
- 9 edited
-
tst_psMinimize06.c (modified) (2 diffs)
-
tst_psStats00.c (modified) (2 diffs)
-
tst_psStats01.c (modified) (1 diff)
-
tst_psStats03.c (modified) (1 diff)
-
tst_psStats04.c (modified) (1 diff)
-
tst_psStats06.c (modified) (1 diff)
-
tst_psStats07.c (modified) (1 diff)
-
tst_psStats08.c (modified) (1 diff)
-
tst_psStats09.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psMinimize06.c
r3987 r4141 15 15 16 16 /***************************************************************************** 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 17 myFunc(): 18 sum = (param[0] * x[0]) + 19 (param[1] * x[1]) + 20 ... 25 21 *****************************************************************************/ 26 ps Vector *myFunc(psImage *myDeriv,27 psVector *myParams,28 psArray *myCoords)22 psF64 myFunc(psVector *deriv, 23 psVector *params, 24 psVector *x) 29 25 { 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"); 38 29 } 39 30 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]; 87 35 } 88 36 … … 121 69 myParams->data.F32[i] = (float) i; 122 70 myParams->data.F32[i] = expectedParm[i] * 1.3; 71 myParams->data.F32[i] = 0.0; 123 72 myParams->data.F32[i] = (float) (5 + i); 124 myParams->data.F32[i] = 0.0;125 73 } 126 74 -
trunk/psLib/test/dataManip/tst_psStats00.c
r3682 r4141 3 3 * @brief Contains tests for psVectorStats with sample mean calculations 4 4 * 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 6 12 * 7 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-0 4-07 20:27:42 $13 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-07 23:31:32 $ 9 15 * 10 16 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii … … 51 57 static psF64 expectedWeightMeanWithMaskRangeF32 = 0.046574; 52 58 59 psF64 rtc(void); 60 psF64 sT, eT; 61 psF64 diff; 62 63 #include <unistd.h> 53 64 psS32 main(psS32 argc, char* argv[] ) 54 65 { -
trunk/psLib/test/dataManip/tst_psStats01.c
r3682 r4141 1 1 /** @file tst_psStats01.c 2 2 * 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 $ 9 15 * 10 16 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii -
trunk/psLib/test/dataManip/tst_psStats03.c
r3682 r4141 2 2 This routine must ensure that PS_STAT_SAMPLE_MEDIAN is correctly computed 3 3 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. 4 7 *****************************************************************************/ 5 8 #include <stdio.h> -
trunk/psLib/test/dataManip/tst_psStats04.c
r3682 r4141 5 5 Note: The NVALUES stat was removed from the IfA requirements spec. So, 6 6 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. 7 10 *****************************************************************************/ 8 11 #include <stdio.h> -
trunk/psLib/test/dataManip/tst_psStats06.c
r3682 r4141 2 2 This routine must ensure that PS_STAT_SAMPLE_STDEV is correctly computed 3 3 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. 4 7 *****************************************************************************/ 5 8 #include <stdio.h> -
trunk/psLib/test/dataManip/tst_psStats07.c
r3682 r4141 2 2 This routine must ensure that PS_STAT_ROBUST_QUARTILE is correctly computed 3 3 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. 4 7 *****************************************************************************/ 5 8 #include <stdio.h> -
trunk/psLib/test/dataManip/tst_psStats08.c
r3682 r4141 2 2 This routine must ensure that PS_STAT_SAMPLE_QUARTILE is correctly computed 3 3 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. 4 7 *****************************************************************************/ 5 8 #include <stdio.h> -
trunk/psLib/test/dataManip/tst_psStats09.c
r3682 r4141 3 3 PS_STAT_CLIPPED_STDEV is calculate correctly by the procedure 4 4 psVectorStats(). 5 6 XXX: Must add tests for various data types, other than psF32. Copy code 7 from tst_psStats00.c-tst_psStats02.c. 5 8 *****************************************************************************/ 6 9 #include <stdio.h>
Note:
See TracChangeset
for help on using the changeset viewer.
