IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 22, 2004, 1:44:09 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psMinimize.c

    r1233 r1278  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.23 $ $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 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1515 */
    1616/*****************************************************************************/
    17 /* INCLUDE FILES            */
     17/* INCLUDE FILES                                                             */
    1818/*****************************************************************************/
    1919#include <stdlib.h>
     
    4141#include "psMatrix.h"
    4242/*****************************************************************************/
    43 /* DEFINE STATEMENTS           */
     43/* DEFINE STATEMENTS                                                         */
    4444/*****************************************************************************/
    4545#define MAX_LMM_ITERATIONS 100
     
    8585
    8686/*****************************************************************************/
    87 /* TYPE DEFINITIONS           */
     87/* TYPE DEFINITIONS                                                          */
    8888/*****************************************************************************/
    8989typedef struct
     
    113113
    114114/*****************************************************************************/
    115 /* GLOBAL VARIABLES           */
     115/* GLOBAL VARIABLES                                                          */
    116116/*****************************************************************************/
    117117
     
    119119
    120120/*****************************************************************************/
    121 /* FILE STATIC VARIABLES           */
     121/* FILE STATIC VARIABLES                                                     */
    122122/*****************************************************************************/
    123123
     
    125125
    126126/*****************************************************************************/
    127 /* FUNCTION IMPLEMENTATION - LOCAL          */
     127/* FUNCTION IMPLEMENTATION - LOCAL                                           */
    128128/*****************************************************************************/
    129129
     
    558558
    559559/*****************************************************************************/
    560 /* FUNCTION IMPLEMENTATION - PUBLIC         */
     560/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    561561/*****************************************************************************/
    562562
     
    567567 
    568568This routine must minimize an arbitrary function; it determines the set of
    569 parameters of that function such that the.
     569parameters of that function such that the ...
    570570 *****************************************************************************/
    571571psVector *
     
    681681
    682682/******************************************************************************
    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.
    684685 *****************************************************************************/
    685686psVector *
     
    795796    do {
    796797        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        }
    797801        // Perform an iteration of the GSL solver.
    798802        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
    800808        // If there was a problem, abort.
    801809        if (status) {
    802             psAbort(__func__, "gsl_multifit_fdfsolver_iterate()\n");
     810            psAbort(__func__, "gsl_multifit_fdfsolver_iterate(%s)\n", gsl_strerror(status));
    803811        }
    804812
     
    811819        // as specified in the ADD.
    812820        *chiSq = gsl_blas_dnrm2(s->f);
     821        printf("psMinimize.c: chiSq is %.3f\n", *chiSq);
    813822        if (fabs(*chiSq - chiSqOld) < 1.0) {
    814823            status = GSL_SUCCESS;
     
    855864    This routine must fit a polynomial of degree myPoly to the data points
    856865    (x, y) and return the coefficients of that polynomial, as well as the
    857     error for each data poiny (yErr).
     866    error for each data point (yErr).
    858867 
    859868NOTE: yErr is currently ignored.
     
    877886    psVector *xSums = NULL;
    878887
     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
    879893    PS_CHECK_NULL_1DPOLY(myPoly);
    880894    PS_CHECK_NULL_VECTOR(x);
     
    929943    for(k=0;k<(polyOrder);k++) {
    930944        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    //    }
    932952
    933953    psFree(A);
     
    939959    psFree(xSums);
    940960
    941     return(NULL);
    942 }
     961    return(myPoly);
     962}
Note: See TracChangeset for help on using the changeset viewer.