IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1278


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

...

Location:
trunk/psLib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psStats.c

    r1277 r1278  
    1818#include "psMinimize.h"
    1919#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
     36void p_psVectorRobustStats(const psVector *restrict myVector,
     37                           const psVector *restrict maskVector,
     38                           unsigned int maskVal,
     39                           psStats *stats);
    4340
    4441/** Preprocessor macro to generate error on an incorrect type */
     
    478475    }
    479476    // Sort the temporary vectors.
    480     psVectorSort(sortedVector, unsortedVector);
     477    psSort(sortedVector, unsortedVector);
    481478
    482479    // Calculate the median exactly.
     
    647644
    648645    // Sort the temporary vectors.
    649     psVectorSort(sortedVector, unsortedVector);
     646    psSort(sortedVector, unsortedVector);
    650647
    651648    // Calculate the quartile points exactly.
     
    18271824            (stats->options & PS_STAT_ROBUST_QUARTILE)) {
    18281825        p_psVectorRobustStats(in, mask, maskVal, stats);
    1829 
    1830         printf("HMMMM stats->robustMode is %f\n", stats->robustMode);
    18311826    }
    18321827
  • 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.