Changeset 1278
- Timestamp:
- Jul 22, 2004, 1:44:09 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 2 edited
-
dataManip/psStats.c (modified) (4 diffs)
-
math/psMinimize.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psStats.c
r1277 r1278 18 18 #include "psMinimize.h" 19 19 #include "psFunctions.h" 20 ======= 21 22 /*****************************************************************************/ 23 /* DEFINE STATEMENTS */ 24 /*****************************************************************************/ 25 #define DEFAULT_ROBUST_SIZE_THRESHOLD 30000 // Vectors that are large than this 26 // will use robust statistical methods. 27 #define GAUSS_WIDTH 20 // The width of the Gaussian or boxcar smoothing. 28 #define CLIPPED_NUM_ITER_LB 1 29 #define CLIPPED_NUM_ITER_UB 10 30 #define CLIPPED_SIGMA_LB 1.0 31 #define CLIPPED_SIGMA_UB 10.0 32 #define true 1 33 #define false 0 34 #define MYMAXFLOAT HUGE 35 #define MAX_ITERATIONS 20 36 37 #ifndef DOXYGEN 38 void p_psVectorRobustStats(const psVector *restrict myVector, 39 const psVector *restrict maskVector, 40 unsigned int maskVal, 41 psStats *stats); 42 #endif 20 21 /*****************************************************************************/ 22 /* DEFINE STATEMENTS */ 23 /*****************************************************************************/ 24 #define DEFAULT_ROBUST_SIZE_THRESHOLD 30000 // Vectors that are large than this 25 // will use robust statistical methods. 26 #define GAUSS_WIDTH 20 // The width of the Gaussian or boxcar smoothing. 27 #define CLIPPED_NUM_ITER_LB 1 28 #define CLIPPED_NUM_ITER_UB 10 29 #define CLIPPED_SIGMA_LB 1.0 30 #define CLIPPED_SIGMA_UB 10.0 31 #define true 1 32 #define false 0 33 #define MYMAXFLOAT HUGE 34 #define MAX_ITERATIONS 20 35 36 void p_psVectorRobustStats(const psVector *restrict myVector, 37 const psVector *restrict maskVector, 38 unsigned int maskVal, 39 psStats *stats); 43 40 44 41 /** Preprocessor macro to generate error on an incorrect type */ … … 478 475 } 479 476 // Sort the temporary vectors. 480 ps VectorSort(sortedVector, unsortedVector);477 psSort(sortedVector, unsortedVector); 481 478 482 479 // Calculate the median exactly. … … 647 644 648 645 // Sort the temporary vectors. 649 ps VectorSort(sortedVector, unsortedVector);646 psSort(sortedVector, unsortedVector); 650 647 651 648 // Calculate the quartile points exactly. … … 1827 1824 (stats->options & PS_STAT_ROBUST_QUARTILE)) { 1828 1825 p_psVectorRobustStats(in, mask, maskVal, stats); 1829 1830 printf("HMMMM stats->robustMode is %f\n", stats->robustMode);1831 1826 } 1832 1827 -
trunk/psLib/src/math/psMinimize.c
r1233 r1278 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-07- 15 23:52:34$11 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-07-22 23:40:08 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 15 */ 16 16 /*****************************************************************************/ 17 /* INCLUDE FILES */17 /* INCLUDE FILES */ 18 18 /*****************************************************************************/ 19 19 #include <stdlib.h> … … 41 41 #include "psMatrix.h" 42 42 /*****************************************************************************/ 43 /* DEFINE STATEMENTS */43 /* DEFINE STATEMENTS */ 44 44 /*****************************************************************************/ 45 45 #define MAX_LMM_ITERATIONS 100 … … 85 85 86 86 /*****************************************************************************/ 87 /* TYPE DEFINITIONS */87 /* TYPE DEFINITIONS */ 88 88 /*****************************************************************************/ 89 89 typedef struct … … 113 113 114 114 /*****************************************************************************/ 115 /* GLOBAL VARIABLES */115 /* GLOBAL VARIABLES */ 116 116 /*****************************************************************************/ 117 117 … … 119 119 120 120 /*****************************************************************************/ 121 /* FILE STATIC VARIABLES */121 /* FILE STATIC VARIABLES */ 122 122 /*****************************************************************************/ 123 123 … … 125 125 126 126 /*****************************************************************************/ 127 /* FUNCTION IMPLEMENTATION - LOCAL */127 /* FUNCTION IMPLEMENTATION - LOCAL */ 128 128 /*****************************************************************************/ 129 129 … … 558 558 559 559 /*****************************************************************************/ 560 /* FUNCTION IMPLEMENTATION - PUBLIC */560 /* FUNCTION IMPLEMENTATION - PUBLIC */ 561 561 /*****************************************************************************/ 562 562 … … 567 567 568 568 This routine must minimize an arbitrary function; it determines the set of 569 parameters of that function such that the .569 parameters of that function such that the ... 570 570 *****************************************************************************/ 571 571 psVector * … … 681 681 682 682 /****************************************************************************** 683 This routine must minimize an arbitrary function. 683 This routine must determine the parameters of an arbitrary function 684 such that they best fit the supplied data points. 684 685 *****************************************************************************/ 685 686 psVector * … … 795 796 do { 796 797 iter++; 798 for (i=0;i<initialGuess->n;i++) { 799 printf("Iteration %d: parameter %d is %.3f\n", iter, i, gsl_vector_get(s->x, i)); 800 } 797 801 // Perform an iteration of the GSL solver. 798 802 status = gsl_multifit_fdfsolver_iterate(s); 799 // printf ("psMinimize() status = %s\n", gsl_strerror(status)); 803 printf("gsl_multifit_fdfsolver_iterate() status is %s\n", gsl_strerror(status)); 804 for (i=0;i<initialGuess->n;i++) { 805 printf("Iteration %d: parameter %d is %.3f\n", iter, i, gsl_vector_get(s->x, i)); 806 } 807 800 808 // If there was a problem, abort. 801 809 if (status) { 802 psAbort(__func__, "gsl_multifit_fdfsolver_iterate( )\n");810 psAbort(__func__, "gsl_multifit_fdfsolver_iterate(%s)\n", gsl_strerror(status)); 803 811 } 804 812 … … 811 819 // as specified in the ADD. 812 820 *chiSq = gsl_blas_dnrm2(s->f); 821 printf("psMinimize.c: chiSq is %.3f\n", *chiSq); 813 822 if (fabs(*chiSq - chiSqOld) < 1.0) { 814 823 status = GSL_SUCCESS; … … 855 864 This routine must fit a polynomial of degree myPoly to the data points 856 865 (x, y) and return the coefficients of that polynomial, as well as the 857 error for each data poin y(yErr).866 error for each data point (yErr). 858 867 859 868 NOTE: yErr is currently ignored. … … 877 886 psVector *xSums = NULL; 878 887 888 // printf("psGetArrayPolynomial()\n"); 889 // for (i=0;i<x->n;i++) { 890 // printf("(x, y, yErr) is (%f, %f, %f)\n", x->data.F64[i], y->data.F64[i], yErr->data.F64[i]); 891 // } 892 879 893 PS_CHECK_NULL_1DPOLY(myPoly); 880 894 PS_CHECK_NULL_VECTOR(x); … … 929 943 for(k=0;k<(polyOrder);k++) { 930 944 myPoly->coeff[k] = coeffs->data.F64[k]; 931 } 945 // printf("myPoly->coeff[%d] is %f\n", k, myPoly->coeff[k]); 946 } 947 948 949 // for (i=0;i<x->n;i++) { 950 // printf("HMMM: psEvalPolynomial1D(%f) is %f\n", x->data.F64[i], psEvalPolynomial1D(x->data.F64[i], myPoly)); 951 // } 932 952 933 953 psFree(A); … … 939 959 psFree(xSums); 940 960 941 return( NULL);942 } 961 return(myPoly); 962 }
Note:
See TracChangeset
for help on using the changeset viewer.
