Legofit
infers population history from nucleotide site patterns.
idset.h
1#ifndef ARR_IDSET_H
2# define ARR_IDSET_H
3
4# include "typedefs.h"
5# include "eventlst.h"
6# include <stdio.h>
7# include <stdlib.h>
8
9IdSet *IdSet_addSamples(IdSet *old, int nsamples, tipId_t *samples);
10void IdSet_addEvent(IdSet *self, unsigned event, unsigned outcome,
11 long double pr);
12IdSet *IdSet_join(IdSet *left, IdSet *right, int nsamples,
13 tipId_t *samples);
14void IdSet_copyEventLst(IdSet *self, const IdSet *old);
15IdSet *IdSet_dup(const IdSet *old);
16EventLst *IdSet_dupEventLst(const IdSet *self);
17IdSet *IdSet_join(IdSet *left, IdSet *right, int nsamples,
18 tipId_t samples[nsamples]);
19IdSet *IdSet_new(int nIds, const tipId_t *tid, EventLst *evlst);
20IdSet *IdSet_newTip(tipId_t tid);
21void IdSet_print(IdSet *self, FILE *fp);
22void IdSet_sanityCheck(IdSet *self, const char *file, int lineno);
23void IdSet_free(IdSet *self);
24int IdSet_nIds(IdSet *self);
25long double IdSet_prob(IdSet *self);
26int IdSet_cmp(const IdSet *left, const IdSet *right);
27#ifdef __clang__
28uint32_t IdSet_hash(const IdSet *self) __attribute__((no_sanitize("integer")));
29#else
30uint32_t IdSet_hash(const IdSet *self);
31#endif
32tipId_t IdSet_union(IdSet *self, int n, int *ndx);
33void IdSet_partition(IdSet *self, unsigned k, tipId_t part[k],
34 unsigned n, unsigned a[n]);
35IdSet *IdSet_subset(const IdSet *self, int n, int *ndx);
36int IdSet_get(const IdSet *self, int i);
37
38#endif
IdSet * IdSet_newTip(tipId_t tid)
Allocate a new IdSet with a single tipId_t value and probability 1.
Definition: idset.c:244
IdSet * IdSet_addSamples(IdSet *old, int nsamples, tipId_t *samples)
Return pointer to new IdSet and free old one.
Definition: idset.c:225
int IdSet_get(const IdSet *self, int i)
Return i'th tipId_t value.
Definition: idset.c:417
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,...
Definition: idset.c:373
EventLst * IdSet_dupEventLst(const IdSet *self)
Return a duplicate of the EventLst of this IdSet.
Definition: idset.c:387
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 ar...
Definition: idset.c:356
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.
Definition: idset.c:149
IdSet * IdSet_subset(const IdSet *self, int n, int *ndx)
Return a pointer to an IdSet representing a subset of "self".
Definition: idset.c:401
IdSet * IdSet_new(int nIds, const tipId_t *tid, EventLst *evlst)
Allocate a new IdSet object with given values of nIds, tid, and evlst.
Definition: idset.c:104
This structure handles bookkeeping associated with events of two types: (1) partitions of the set of ...
Definition: eventlst.h:33
Definition: idset.c:24