Changeset 1284
- Timestamp:
- Jul 22, 2004, 2:06:40 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 5 edited
-
dataManip/psStats.c (modified) (8 diffs)
-
dataManip/psStats.d (modified) (1 diff)
-
dataManip/psStats.h (modified) (2 diffs)
-
math/psStats.c (modified) (8 diffs)
-
math/psStats.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psStats.c
r1282 r1284 15 15 #include "psAbort.h" 16 16 #include "psStats.h" 17 #include "psVectorSort.h"18 17 #include "psMinimize.h" 19 18 #include "psFunctions.h" … … 40 39 41 40 /** Preprocessor macro to generate error on an incorrect type */ 42 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \43 if (NAME->type.type != TYPE) { \44 psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \41 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \ 42 if (NAME->type.type != TYPE) { \ 43 psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \ 45 44 } 46 45 47 46 /** Preprocessor macro to generate error on a NULL vector */ 48 #define PS_CHECK_NULL_VECTOR(NAME) \49 if (NAME == NULL || NAME->data.V == NULL) { \50 psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \47 #define PS_CHECK_NULL_VECTOR(NAME) \ 48 if (NAME == NULL || NAME->data.V == NULL) { \ 49 psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \ 51 50 } 52 51 53 52 /** Preprocessor macro to generate error for zero length vector */ 54 #define PS_CHECK_EMPTY_VECTOR(NAME) \55 if (NAME->n < 1) { \56 psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \53 #define PS_CHECK_EMPTY_VECTOR(NAME) \ 54 if (NAME->n < 1) { \ 55 psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \ 57 56 } 58 57 59 58 /** Preprocessor macro to generate error on differing size vectors */ 60 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \61 if (VEC1->n != VEC2->n) { \59 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \ 60 if (VEC1->n != VEC2->n) { \ 62 61 psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \ 63 62 } 63 64 #define PS_PRINT_VECTOR(NAME) \ 65 for (int my_i=0;my_i<NAME->n;my_i++) { \ 66 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \ 67 } \ 68 printf("\n"); \ 64 69 65 70 /*****************************************************************************/ … … 653 658 psFree(unsortedVector); 654 659 psFree(sortedVector); 655 // NOTE: This is the656 660 } 657 661 … … 668 672 NULL 669 673 670 NOTE: the mean is always calculated exactly. Robust means are never671 calculated in this routine.672 674 *****************************************************************************/ 673 675 void p_psVectorSampleStdev(const psVector *restrict myVector, … … 1044 1046 } 1045 1047 1046 #define PS_PRINT_VECTOR(NAME) \1047 for (int my_i=0;my_i<NAME->n;my_i++) { \1048 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \1049 } \1050 printf("\n"); \1051 1052 1048 /****************************************************************************** 1053 1049 p_psVectorRobustStats(myVector, maskVector, maskVal, stats): this procedure … … 1059 1055 PS_STAT_ROBUST_QUARTILE 1060 1056 I have included all that computation in a single function, as opposed to 1061 breaking it across several functions for one primary reason: 1057 breaking it across several functions for one primary reason: 1062 1058 they all 1063 1059 require the same basic initial processing steps (calculate the histogram, 1064 etc.) 1060 etc.) 1065 1061 however there is no currently defined means, in the SDRS, to 1066 1062 specify this computation as a separate step. If the above robust stat … … 1611 1607 // NOTE: Verify that this is the correct action. 1612 1608 if (bounds == NULL) { 1613 // psAbort(__func__, "psHistogram requested with NULL bounds");1609 // psAbort(__func__, "psHistogram requested with NULL bounds"); 1614 1610 return(NULL); 1615 1611 } … … 1617 1613 // NOTE: Verify that this is the correct action. 1618 1614 if (bounds->n <= 1) { 1619 // psAbort(__func__, "psHistogram requested with NULL bounds");1615 // psAbort(__func__, "psHistogram requested with NULL bounds"); 1620 1616 return(NULL); 1621 1617 } -
trunk/psLib/src/dataManip/psStats.d
r1233 r1284 1 psStats.o psStats.d : psStats.c ../sysUtils/psMemory.h ../collections/psVector.h \ 2 ../collections/psType.h ../sysUtils/psTrace.h ../sysUtils/psError.h \ 3 ../sysUtils/psAbort.h psStats.h 1 psStats.o psStats.d : psStats.c ../sysUtils/psMemory.h ../image/psImage.h \ 2 ../collections/psType.h ../collections/psVector.h ../sysUtils/psTrace.h \ 3 ../sysUtils/psError.h ../sysUtils/psAbort.h psStats.h psMinimize.h \ 4 psFunctions.h -
trunk/psLib/src/dataManip/psStats.h
r1281 r1284 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-07-2 2 23:44:49$11 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-07-23 00:06:40 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 62 62 double robustUQ; ///< robust upper quartile 63 63 double robustLQ; ///< robust lower quartile 64 double XXX; 64 65 double robustN50; ///< 65 66 double robustNfit; ///< -
trunk/psLib/src/math/psStats.c
r1282 r1284 15 15 #include "psAbort.h" 16 16 #include "psStats.h" 17 #include "psVectorSort.h"18 17 #include "psMinimize.h" 19 18 #include "psFunctions.h" … … 40 39 41 40 /** Preprocessor macro to generate error on an incorrect type */ 42 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \43 if (NAME->type.type != TYPE) { \44 psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \41 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \ 42 if (NAME->type.type != TYPE) { \ 43 psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \ 45 44 } 46 45 47 46 /** Preprocessor macro to generate error on a NULL vector */ 48 #define PS_CHECK_NULL_VECTOR(NAME) \49 if (NAME == NULL || NAME->data.V == NULL) { \50 psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \47 #define PS_CHECK_NULL_VECTOR(NAME) \ 48 if (NAME == NULL || NAME->data.V == NULL) { \ 49 psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \ 51 50 } 52 51 53 52 /** Preprocessor macro to generate error for zero length vector */ 54 #define PS_CHECK_EMPTY_VECTOR(NAME) \55 if (NAME->n < 1) { \56 psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \53 #define PS_CHECK_EMPTY_VECTOR(NAME) \ 54 if (NAME->n < 1) { \ 55 psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \ 57 56 } 58 57 59 58 /** Preprocessor macro to generate error on differing size vectors */ 60 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \61 if (VEC1->n != VEC2->n) { \59 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \ 60 if (VEC1->n != VEC2->n) { \ 62 61 psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \ 63 62 } 63 64 #define PS_PRINT_VECTOR(NAME) \ 65 for (int my_i=0;my_i<NAME->n;my_i++) { \ 66 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \ 67 } \ 68 printf("\n"); \ 64 69 65 70 /*****************************************************************************/ … … 653 658 psFree(unsortedVector); 654 659 psFree(sortedVector); 655 // NOTE: This is the656 660 } 657 661 … … 668 672 NULL 669 673 670 NOTE: the mean is always calculated exactly. Robust means are never671 calculated in this routine.672 674 *****************************************************************************/ 673 675 void p_psVectorSampleStdev(const psVector *restrict myVector, … … 1044 1046 } 1045 1047 1046 #define PS_PRINT_VECTOR(NAME) \1047 for (int my_i=0;my_i<NAME->n;my_i++) { \1048 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \1049 } \1050 printf("\n"); \1051 1052 1048 /****************************************************************************** 1053 1049 p_psVectorRobustStats(myVector, maskVector, maskVal, stats): this procedure … … 1059 1055 PS_STAT_ROBUST_QUARTILE 1060 1056 I have included all that computation in a single function, as opposed to 1061 breaking it across several functions for one primary reason: 1057 breaking it across several functions for one primary reason: 1062 1058 they all 1063 1059 require the same basic initial processing steps (calculate the histogram, 1064 etc.) 1060 etc.) 1065 1061 however there is no currently defined means, in the SDRS, to 1066 1062 specify this computation as a separate step. If the above robust stat … … 1611 1607 // NOTE: Verify that this is the correct action. 1612 1608 if (bounds == NULL) { 1613 // psAbort(__func__, "psHistogram requested with NULL bounds");1609 // psAbort(__func__, "psHistogram requested with NULL bounds"); 1614 1610 return(NULL); 1615 1611 } … … 1617 1613 // NOTE: Verify that this is the correct action. 1618 1614 if (bounds->n <= 1) { 1619 // psAbort(__func__, "psHistogram requested with NULL bounds");1615 // psAbort(__func__, "psHistogram requested with NULL bounds"); 1620 1616 return(NULL); 1621 1617 } -
trunk/psLib/src/math/psStats.h
r1281 r1284 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-07-2 2 23:44:49$11 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-07-23 00:06:40 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 62 62 double robustUQ; ///< robust upper quartile 63 63 double robustLQ; ///< robust lower quartile 64 double XXX; 64 65 double robustN50; ///< 65 66 double robustNfit; ///<
Note:
See TracChangeset
for help on using the changeset viewer.
