Skip to content

Instantly share code, notes, and snippets.

@dansondergaard
Created February 23, 2013 00:33
Show Gist options
  • Select an option

  • Save dansondergaard/5017665 to your computer and use it in GitHub Desktop.

Select an option

Save dansondergaard/5017665 to your computer and use it in GitHub Desktop.
int *translate_observations_to_indexes(struct hmm_t *hmm, const char *observations) {
int *observations_idx = malloc(strlen(observations) * sizeof(int));
for (int i = 0; i < strlen(observations); i++) {
for (int j = 0; j < hmm->observables_size; j++) {
if (observations[i] == hmm->observables[j]) {
observations_idx[i] = j;
}
}
}
return observations_idx;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment