Legofit
infers population history from nucleotide site patterns.
|
A set of tipID_t values. More...
#include "idset.h"
#include "misc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Data Structures | |
struct | IdSet |
Functions | |
static void | merge (int nz, tipId_t *z, int nx, tipId_t *x, int ny, tipId_t *y) |
static void | merge3 (int nw, tipId_t *w, int nz, tipId_t *z, int nx, tipId_t *x, int ny, tipId_t *y) |
static IdSet * | IdSet_new_noEventLst (int nIds, const tipId_t *tid) |
Allocate a new IdSet object with given values of nIds and tid. More... | |
void | IdSet_sanityCheck (IdSet *self, const char *file, int lineno) |
void | IdSet_print (IdSet *self, FILE *fp) |
IdSet * | IdSet_new (int nIds, const tipId_t *tid, EventLst *evlst) |
Allocate a new IdSet object with given values of nIds, tid, and evlst. | |
IdSet * | IdSet_dup (const IdSet *old) |
void | IdSet_copyEventLst (IdSet *self, const IdSet *old) |
IdSet * | IdSet_join (IdSet *left, IdSet *right, int nsamples, tipId_t *samples) |
Join two IdSet objects, left and right, along with all the tipId_t values in the "samples" array. More... | |
void | IdSet_addEvent (IdSet *self, unsigned event, unsigned outcome, long double pr) |
IdSet * | IdSet_addSamples (IdSet *old, int nsamples, tipId_t *samples) |
Return pointer to new IdSet and free old one. | |
IdSet * | IdSet_newTip (tipId_t tid) |
Allocate a new IdSet with a single tipId_t value and probability 1. | |
int | IdSet_cmp (const IdSet *left, const IdSet *right) |
uint32_t | IdSet_hash (const IdSet *self) |
void | IdSet_free (IdSet *self) |
long double | IdSet_prob (IdSet *self) |
int | IdSet_nIds (IdSet *self) |
tipId_t | IdSet_union (IdSet *self, int n, int *ndx) |
Return a tipId_t value representing the union of the values within this IdSet object whose indices are given in ndx, an array of length n. | |
void | IdSet_partition (IdSet *self, unsigned k, tipId_t part[k], unsigned n, unsigned a[n]) |
On entry, k is the number of parts into which this IdSet will be subdivided, n must equal self->nIds, and a[j] is the index of the part into which the j'th tipId_t value will be assigned. More... | |
EventLst * | IdSet_dupEventLst (const IdSet *self) |
Return a duplicate of the EventLst of this IdSet. | |
IdSet * | IdSet_subset (const IdSet *self, int n, int *ndx) |
Return a pointer to an IdSet representing a subset of "self". More... | |
int | IdSet_get (const IdSet *self, int i) |
Return i'th tipId_t value. | |
Variables | |
long double | improbable = 0.0L |
long double | pr_ignored = 0.0L |
A set of tipID_t values.
|
static |
Allocate a new IdSet object with given values of nIds and tid.
Leave evlst and pr unset. This function is used only within the current file, and in each case, pr and evlst are then set by the calling function.
Referenced by IdSet_new().
void IdSet_partition | ( | IdSet * | self, |
unsigned | k, | ||
tipId_t | part[k], | ||
unsigned | n, | ||
unsigned | a[n] | ||
) |
On entry, k is the number of parts into which this IdSet will be subdivided, n must equal self->nIds, and a[j] is the index of the part into which the j'th tipId_t value will be assigned.
On return, partition[i] is the union of the tipId_t values in self which belong to the i'th part.