|
2 | 2 | // Author: Paul David Harris |
3 | 3 | // Purpose: Header files for H2MM and H2MM Viterbi algorithm |
4 | 4 | // Date Created: 13 Feb 2021 |
5 | | -// Data Modified: 8 June 2021 |
| 5 | +// Data Modified: 18 Sept 2021 |
6 | 6 |
|
7 | 7 | #ifdef _WIN32 |
8 | 8 | #include <windows.h> |
@@ -98,6 +98,14 @@ typedef struct // pwrs is a structure that contains pointers to the A (transmat) |
98 | 98 | double *Rho; // the Rho array, as defined in H2MM |
99 | 99 | } pwrs; |
100 | 100 |
|
| 101 | +typedef struct // pwrs is a structure that contains pointers to the A (transmat) and Rho arrays, plus information on dimensions and which values are to be calculated |
| 102 | +{ |
| 103 | + size_t max_pow; // maximum power, the maximum delta in the data set |
| 104 | + size_t sj; // note that this is also the stride for the delta t in the A array |
| 105 | + size_t sk; // note that this is also the number of states |
| 106 | + double *A; // the A array, contains the powers of the tranistion probability matrix |
| 107 | +} trpow; |
| 108 | + |
101 | 109 | // viterbi.c structures |
102 | 110 |
|
103 | 111 | // structure identifies a burst, and its viterbi values |
@@ -184,3 +192,15 @@ int viterbi(unsigned long num_bursts, unsigned long *burst_sizes, unsigned long |
184 | 192 | temps* burst_read(char *fname, size_t *n); // read burst data from a .txt file |
185 | 193 |
|
186 | 194 | h2mm_mod* h2mm_read(char *fname); // read h2mm model from .txt file |
| 195 | + |
| 196 | +// simulation functions |
| 197 | + |
| 198 | +void cumsum(unsigned long len, double* arr, double* dest); // calculate the cumulative sum of an array |
| 199 | + |
| 200 | +unsigned long randchoice(unsigned long len, double* arr); // select a random set index within range len, based on array arr |
| 201 | + |
| 202 | +int statepath(h2mm_mod* model, unsigned long lent, unsigned long* path, unsigned int seed); // generate random statepath based on model, with equally spaced times |
| 203 | + |
| 204 | +int sparsestatepath(h2mm_mod* model, unsigned long lent, unsigned long long* times, unsigned long* path, unsigned int seed); // generate random statepath of sparsely spaced times |
| 205 | + |
| 206 | +int phpathgen(h2mm_mod* model, unsigned long lent, unsigned long* path, unsigned long* traj, unsigned int seed); // generate random set of detectors based on given statepath |
0 commit comments