Patterns in static

Apophenia

arms.h

Go to the documentation of this file.
00001 
00002 /* Copyright (c) 2009 by Ben Klemens.  Licensed under the modified GNU GPL v2; see COPYING and COPYING2.  */
00003 #ifndef apop_arms_h
00004 #define apop_arms_h
00005 
00006 #ifdef    __cplusplus
00007 extern "C" {
00008 #endif
00009 
00010 #include "model.h"
00011 #include "settings.h"
00012 
00013 typedef struct point {    /* a point in the x,y plane */
00014   double x,y;             /* x and y coordinates */
00015   double ey;              /* exp(y-ymax+YCEIL) */
00016   double cum;             /* integral up to x of rejection envelope */
00017   int f;                  /* is y an evaluated point of log-density */
00018   struct point *pl,*pr;   /* envelope points to left and right of x */
00019 } POINT;
00020 
00021 /* This includes the envelope info and the metropolis steps. */
00022 typedef struct {  /* attributes of the entire rejection envelope */
00023   int cpoint;              /* number of POINTs in current envelope */
00024   int npoint;              /* max number of POINTs allowed in envelope */
00025   double ymax;             /* the maximum y-value in the current envelope */
00026   POINT *p;                /* start of storage of envelope POINTs */
00027   double *convex;          /* adjustment for convexity */
00028   double metro_xprev;      /* previous Markov chain iterate */
00029   double metro_yprev;      /* current log density at xprev */
00030 } arms_state;
00031 
00033 typedef struct {
00035     double *xinit;
00037     double  xl;
00039     double  xr;
00041     double convex; 
00043     int ninit;
00045     int npoint;
00047    char do_metro;
00049    double xprev;
00051    int neval;
00052     arms_state *state;
00053     apop_model *model;
00054 } apop_arms_settings;
00055 
00056 Apop_settings_declarations(apop_arms)
00057 
00058 
00059 void apop_arms_draw (double *out, gsl_rng *r, apop_model *m);
00060 
00061 #define YCEIL 50.                /* maximum y avoiding overflow in exp(y) */
00062 
00063 #ifdef    __cplusplus
00064 }
00065 #endif
00066 #endif

SourceForge.net Logo

Autogenerated by doxygen on 28 Sep 2009.