1#ifndef BRANCHTAB_INCLUDED
2# define BRANCHTAB_INCLUDED
18 long double value[n]);
26 long double u,
long nnuc,
long double n);
27long double BranchTab_smplChiSqCost(
const BranchTab *obs,
29 long double u,
long nnuc,
long double n);
33 long double u,
long nnuc,
long double n);
36void BranchTab_sanityCheck(
BranchTab *self,
const char *file,
40void make_rm_map(
size_t n, tipId_t map[n], tipId_t remove);
41tipId_t remap_bits(
size_t n, tipId_t map[n], tipId_t old);
BranchTab * BranchTab_new(unsigned nsamples)
Create a new BranchTab with room for site patterns associated with data in which the number of sample...
Definition: branchtab.c:31
void BranchTab_add(BranchTab *self, tipId_t key, long double value)
Add a value to table.
Definition: branchtab.c:110
int BranchTab_divideBy(BranchTab *self, long double denom)
Divide all values by denom. Return 0 on success, or 1 on failure.
Definition: branchtab.c:142
int BranchTab_hasSingletons(BranchTab *self)
Return 1 if BranchTab includes singleton site patterns.
Definition: branchtab.c:94
long double BranchTab_negLnL(const BranchTab *obs, const BranchTab *expt)
Negative log likelihood.
Definition: branchtab.c:334
int BranchTab_equals(const BranchTab *lhs, const BranchTab *rhs)
Return 1 if two BranchTab objects are equal; 0 otherwise.
Definition: branchtab.c:70
long double BranchTab_KLdiverg(const BranchTab *obs, const BranchTab *expt)
Calculate KL divergence from two BranchTab objects, which should be normalized before entering this f...
Definition: branchtab.c:304
BranchTab * BranchTab_rmPops(BranchTab *old, tipId_t remove)
Return pointer to newly-allocated BranchTab, which is like old, except that it lacks the populations ...
Definition: branchtab.c:215
void BranchTab_print(const BranchTab *self, FILE *fp)
Print a BranchTab to standard output.
Definition: branchtab.c:156
void make_collapse_map(size_t n, tipId_t map[n], tipId_t collapse)
Make map, an array whose i'th entry is an unsigned integer with one bit on and the rest off.
Definition: branchtab.c:368
void BranchTab_minusEquals(BranchTab *lhs, BranchTab *rhs)
Subtract each entry in table rhs from table lhs.
Definition: branchtab.c:170
long double BranchTab_sum(const BranchTab *self)
Return sum of values in BranchTab.
Definition: branchtab.c:236
long double BranchTab_entropy(const BranchTab *self)
Return negative of sum of p*ln(p)
Definition: branchtab.c:246
void BranchTab_free(BranchTab *self)
Destructor for BranchTab.
Definition: branchtab.c:88
void make_rm_map(size_t n, tipId_t map[n], tipId_t remove)
Make map, an array whose i'th entry is an unsigned integer with one bit on and the rest off.
Definition: branchtab.c:401
BranchTab * BranchTab_collapse(BranchTab *old, tipId_t collapse)
Return a pointer to a newly-allocated BranchTab, which is like "old", except that two or more of the ...
Definition: branchtab.c:193
void BranchTab_plusEquals(BranchTab *lhs, BranchTab *rhs)
Add each entry in table rhs to table lhs.
Definition: branchtab.c:162
void BranchTab_toArrays(BranchTab *self, unsigned n, tipId_t key[n], long double value[n])
Fill arrays key and value with values in BranchTab.
Definition: branchtab.c:180
BranchTab * BranchTab_from_StrDblQueue(StrDblQueue *queue, LblNdx *lndx)
Construct a BranchTab from a StrDblQueue.
Definition: branchtab.c:278
unsigned BranchTab_size(BranchTab *self)
Return the number of elements in the BranchTab.
Definition: branchtab.c:125
long double BranchTab_get(BranchTab *self, tipId_t key)
Return value corresponding to key.
Definition: branchtab.c:103
int BranchTab_normalize(BranchTab *self)
Divide all values by their sum.
Definition: branchtab.c:260
Definition: branchtab.c:20
Definition: strdblqueue.h:22