Legofit
infers population history from nucleotide site patterns.
|
Manage a vector of parameters. More...
#include "parstore.h"
#include "ptrqueue.h"
#include "ptrptrmap.h"
#include "strint.h"
#include "param.h"
#include "tinyexpr.h"
#include "misc.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/errno.h>
#include <stdbool.h>
#include <assert.h>
#include <float.h>
#include <gsl/gsl_rng.h>
Data Structures | |
struct | ParStore |
Macros | |
#define | DUPLICATE_PAR(x) |
Abort with an error message about duplicate parameter definition. More... | |
Functions | |
static int | ParStore_constrain (ParStore *self) |
First check to see that free parameters obey boundary constraints. More... | |
static void | ParStore_chkDependencies (ParStore *self) |
ParStore * | ParStore_new (PtrQueue *fixedQ, PtrQueue *freeQ, PtrQueue *constrQ) |
ParStore * | ParStore_dup (const ParStore *old) |
Duplicate a ParStore. | |
int | ParStore_nPar (ParStore *self) |
Return the number of parameters. | |
double | ParStore_getVal (ParStore *self, int i) |
Param * | ParStore_getParam (ParStore *self, int i) |
int | ParStore_nFree (ParStore *self) |
Return the number of free parameters. | |
int | ParStore_nFixed (ParStore *self) |
Return the number of fixed parameters. | |
int | ParStore_nConstrained (ParStore *self) |
Return the number of constrained parameters. | |
int | ParStore_setFreeParams (ParStore *self, int n, double x[n]) |
Set vector of free parameters, then update constrained parameters. More... | |
void | ParStore_getFreeParams (ParStore *self, int n, double x[n]) |
Get vector of free parameters. | |
void | ParStore_print (ParStore *self, FILE *fp) |
Print a ParStore. | |
void | ParStore_printFree (ParStore *self, FILE *fp) |
Print free parameter values. | |
void | ParStore_printConstrained (ParStore *self, FILE *fp) |
Print constrained parameter values. | |
void | ParStore_free (ParStore *self) |
Destructor. | |
const char * | ParStore_getNameFree (ParStore *self, int i) |
Get name of i'th free parameter. | |
int | ParStore_getIndex (ParStore *self, const char *name) |
Return index of parameter name, or -1 if the name isn't there. | |
void | ParStore_sanityCheck (ParStore *self, const char *file, int line) |
int | ParStore_equals (ParStore *lhs, ParStore *rhs) |
Return 1 if two ParStore objects are equal; 0 otherwise. | |
void | Bounds_sanityCheck (Bounds *self, const char *file, int line) |
Make sure Bounds object is sane. | |
int | Bounds_equals (const Bounds *lhs, const Bounds *rhs) |
Return 1 if two Bounds objects are equal; 0 otherwise. | |
Manage a vector of parameters.
This class solves the following problem. One algorithm requires that parameters be distributed throughout a network of nodes. Another requires that they all be collected into a vector. To accomplish both goals, ParStore maintains a vector of parameter values, together with high and low bounds on those values. When a new parameter is added to the ParStore, a pointer to that value is returned, so that it can be stored in the distributed data structure.
#define DUPLICATE_PAR | ( | x | ) |
Abort with an error message about duplicate parameter definition.
|
static |
First check to see that free parameters obey boundary constraints.
If not, then return 1. Otherwise, set values of all constrained parameters and return 0.
int ParStore_setFreeParams | ( | ParStore * | self, |
int | n, | ||
double | x[n] | ||
) |
Set vector of free parameters, then update constrained parameters.
Return the value returned by ParStore_constrain.
Referenced by GPTree_setParams().