Changeset 1903
- Timestamp:
- Sep 25, 2004, 1:05:07 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 7 edited
-
dataManip/psConstants.h (modified) (2 diffs)
-
dataManip/psFunctions.c (modified) (3 diffs)
-
dataManip/psStats.c (modified) (3 diffs)
-
math/psConstants.h (modified) (2 diffs)
-
math/psPolynomial.c (modified) (3 diffs)
-
math/psSpline.c (modified) (3 diffs)
-
math/psStats.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psConstants.h
r1879 r1903 1 // 2 // Source code comments. 3 // 1 /** @file psComments.h 2 * 3 * This file will hold definitions of various constants as well as common 4 * macros used throughout psLib. 5 * 6 * @author GLG, MHPCC 7 * 8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-09-25 23:05:07 $ 10 * 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 12 */ 4 13 5 14 #define DETERMINE_BRACKET_STEP_SIZE 0.10 … … 9 18 #define RIGHT_SPLINE_DERIV 0.0 10 19 20 /** Preprocessor macro to generate error on an incorrect type */ 21 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \ 22 if (NAME->type.type != TYPE) { \ 23 psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \ 24 } 25 26 /** Preprocessor macro to generate error on a NULL vector */ 27 #define PS_CHECK_NULL_VECTOR(NAME) \ 28 if (NAME == NULL || NAME->data.V == NULL) { \ 29 psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \ 30 } 31 32 /** Preprocessor macro to generate error on a NULL poniter */ 33 #define PS_CHECK_NULL_PTR(NAME) \ 34 if (NAME == NULL) { \ 35 psError(__func__,"Invalid operation: %s is NULL.", #NAME); \ 36 } 37 38 /** Preprocessor macro to generate error for zero length vector */ 39 #define PS_CHECK_EMPTY_VECTOR(NAME) \ 40 if (NAME->n < 1) { \ 41 psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \ 42 } 43 44 /** Preprocessor macro to generate error on differing size vectors */ 45 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \ 46 if (VEC1->n != VEC2->n) { \ 47 psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \ 48 } 49 50 #define PS_PRINT_VECTOR(NAME) \ 51 for (int my_i=0;my_i<NAME->n;my_i++) { \ 52 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \ 53 } \ 54 printf("\n"); \ 55 56 #define PS_MAX(A, B) \ 57 (A > B) ? A : B \ 58 59 #define PS_MIN(A, B) \ 60 (A < B) ? A : B \ 61 -
trunk/psLib/src/dataManip/psFunctions.c
r1861 r1903 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-09-2 3 06:12:22$9 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-09-25 23:05:07 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1699 1699 all j>=i). This routine does a binary disection of the vector and returns 1700 1700 "i" such that (v[i] <= x <= v[i+1). If x lies outside the range of v[], 1701 then this routine prints a warning message and returns -1.1701 then this routine prints a warning message and returns (-2 or -1). 1702 1702 1703 1703 XXX: Macro this for a few different types. … … 1716 1716 "---- Calling p_psVectorBinDisectF32(%f)\n", x); 1717 1717 1718 if ((x < bins[0]) || 1719 (x > bins[numBins-1])) { 1718 if (x < bins[0]) { 1719 psLogMsg(__func__, PS_LOG_WARN, 1720 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).", 1721 x, bins[0], bins[numBins-1]); 1722 return(-2); 1723 } 1724 1725 if (x > bins[numBins-1]) { 1720 1726 psLogMsg(__func__, PS_LOG_WARN, 1721 1727 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).", -
trunk/psLib/src/dataManip/psStats.c
r1879 r1903 7 7 * on those data structures. 8 8 * 9 * @author G eorge Gusciora, MHPCC9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-09-2 4 20:08:22$11 * @version $Revision: 1.59 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-09-25 23:05:07 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 #include "psMinimize.h" 35 35 #include "psFunctions.h" 36 #include "psConstants.h" 36 37 37 38 /*****************************************************************************/ … … 51 52 void p_psVectorRobustStats(const psVector* restrict myVector, 52 53 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats); 53 54 /** Preprocessor macro to generate error on an incorrect type */55 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \56 if (NAME->type.type != TYPE) { \57 psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \58 }59 60 /** Preprocessor macro to generate error on a NULL vector */61 #define PS_CHECK_NULL_VECTOR(NAME) \62 if (NAME == NULL || NAME->data.V == NULL) { \63 psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \64 }65 66 /** Preprocessor macro to generate error for zero length vector */67 #define PS_CHECK_EMPTY_VECTOR(NAME) \68 if (NAME->n < 1) { \69 psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \70 }71 72 /** Preprocessor macro to generate error on differing size vectors */73 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \74 if (VEC1->n != VEC2->n) { \75 psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \76 }77 78 #define PS_PRINT_VECTOR(NAME) \79 for (int my_i=0;my_i<NAME->n;my_i++) { \80 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \81 } \82 printf("\n"); \83 54 84 55 -
trunk/psLib/src/math/psConstants.h
r1879 r1903 1 // 2 // Source code comments. 3 // 1 /** @file psComments.h 2 * 3 * This file will hold definitions of various constants as well as common 4 * macros used throughout psLib. 5 * 6 * @author GLG, MHPCC 7 * 8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-09-25 23:05:07 $ 10 * 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 12 */ 4 13 5 14 #define DETERMINE_BRACKET_STEP_SIZE 0.10 … … 9 18 #define RIGHT_SPLINE_DERIV 0.0 10 19 20 /** Preprocessor macro to generate error on an incorrect type */ 21 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \ 22 if (NAME->type.type != TYPE) { \ 23 psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \ 24 } 25 26 /** Preprocessor macro to generate error on a NULL vector */ 27 #define PS_CHECK_NULL_VECTOR(NAME) \ 28 if (NAME == NULL || NAME->data.V == NULL) { \ 29 psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \ 30 } 31 32 /** Preprocessor macro to generate error on a NULL poniter */ 33 #define PS_CHECK_NULL_PTR(NAME) \ 34 if (NAME == NULL) { \ 35 psError(__func__,"Invalid operation: %s is NULL.", #NAME); \ 36 } 37 38 /** Preprocessor macro to generate error for zero length vector */ 39 #define PS_CHECK_EMPTY_VECTOR(NAME) \ 40 if (NAME->n < 1) { \ 41 psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \ 42 } 43 44 /** Preprocessor macro to generate error on differing size vectors */ 45 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \ 46 if (VEC1->n != VEC2->n) { \ 47 psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \ 48 } 49 50 #define PS_PRINT_VECTOR(NAME) \ 51 for (int my_i=0;my_i<NAME->n;my_i++) { \ 52 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \ 53 } \ 54 printf("\n"); \ 55 56 #define PS_MAX(A, B) \ 57 (A > B) ? A : B \ 58 59 #define PS_MIN(A, B) \ 60 (A < B) ? A : B \ 61 -
trunk/psLib/src/math/psPolynomial.c
r1861 r1903 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-09-2 3 06:12:22$9 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-09-25 23:05:07 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1699 1699 all j>=i). This routine does a binary disection of the vector and returns 1700 1700 "i" such that (v[i] <= x <= v[i+1). If x lies outside the range of v[], 1701 then this routine prints a warning message and returns -1.1701 then this routine prints a warning message and returns (-2 or -1). 1702 1702 1703 1703 XXX: Macro this for a few different types. … … 1716 1716 "---- Calling p_psVectorBinDisectF32(%f)\n", x); 1717 1717 1718 if ((x < bins[0]) || 1719 (x > bins[numBins-1])) { 1718 if (x < bins[0]) { 1719 psLogMsg(__func__, PS_LOG_WARN, 1720 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).", 1721 x, bins[0], bins[numBins-1]); 1722 return(-2); 1723 } 1724 1725 if (x > bins[numBins-1]) { 1720 1726 psLogMsg(__func__, PS_LOG_WARN, 1721 1727 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).", -
trunk/psLib/src/math/psSpline.c
r1861 r1903 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-09-2 3 06:12:22$9 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-09-25 23:05:07 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1699 1699 all j>=i). This routine does a binary disection of the vector and returns 1700 1700 "i" such that (v[i] <= x <= v[i+1). If x lies outside the range of v[], 1701 then this routine prints a warning message and returns -1.1701 then this routine prints a warning message and returns (-2 or -1). 1702 1702 1703 1703 XXX: Macro this for a few different types. … … 1716 1716 "---- Calling p_psVectorBinDisectF32(%f)\n", x); 1717 1717 1718 if ((x < bins[0]) || 1719 (x > bins[numBins-1])) { 1718 if (x < bins[0]) { 1719 psLogMsg(__func__, PS_LOG_WARN, 1720 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).", 1721 x, bins[0], bins[numBins-1]); 1722 return(-2); 1723 } 1724 1725 if (x > bins[numBins-1]) { 1720 1726 psLogMsg(__func__, PS_LOG_WARN, 1721 1727 "p_psVectorBinDisectF32(): ordinate %f is outside vector range (%f - %f).", -
trunk/psLib/src/math/psStats.c
r1879 r1903 7 7 * on those data structures. 8 8 * 9 * @author G eorge Gusciora, MHPCC9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-09-2 4 20:08:22$11 * @version $Revision: 1.59 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-09-25 23:05:07 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 #include "psMinimize.h" 35 35 #include "psFunctions.h" 36 #include "psConstants.h" 36 37 37 38 /*****************************************************************************/ … … 51 52 void p_psVectorRobustStats(const psVector* restrict myVector, 52 53 const psVector* restrict maskVector, unsigned int maskVal, psStats* stats); 53 54 /** Preprocessor macro to generate error on an incorrect type */55 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \56 if (NAME->type.type != TYPE) { \57 psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \58 }59 60 /** Preprocessor macro to generate error on a NULL vector */61 #define PS_CHECK_NULL_VECTOR(NAME) \62 if (NAME == NULL || NAME->data.V == NULL) { \63 psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \64 }65 66 /** Preprocessor macro to generate error for zero length vector */67 #define PS_CHECK_EMPTY_VECTOR(NAME) \68 if (NAME->n < 1) { \69 psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \70 }71 72 /** Preprocessor macro to generate error on differing size vectors */73 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \74 if (VEC1->n != VEC2->n) { \75 psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \76 }77 78 #define PS_PRINT_VECTOR(NAME) \79 for (int my_i=0;my_i<NAME->n;my_i++) { \80 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \81 } \82 printf("\n"); \83 54 84 55
Note:
See TracChangeset
for help on using the changeset viewer.
