Changeset 1278 for trunk/psLib/src/math/psMinimize.c
- Timestamp:
- Jul 22, 2004, 1:44:09 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psMinimize.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
