-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile_hmmmix_soft.m
63 lines (51 loc) · 2.65 KB
/
compile_hmmmix_soft.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
% Written by Guillaume Alain, summer of 2009.
%
% I usually compile everything by going into the appropriate directory and
% then running all these commands in succession. There are a few commands
% in the last portion that compile functions that are not really necessary
% unless we want to use the hack that overrides some of Sohrab Shah's
% functions from "CNAhmmer".
%
% No harm is done if we don't add the optional_kmedoids_wrapper directory
% to the Matlab path.
% This is the forwards-backwards algorithm, working with logarithms for all
% the quantities. The "fwd_back_MatlabC" file provides a way to call
% fwd_back directly from Matlab if we want. Otherwise, the fwd_back code is
% linked later on with the hmmmix_frugal_hM_KTg_MatlabC code.
mex -c fwd_back.c
mex -c fwd_back_MatlabC.c
mex fwd_back_MatlabC.o fwd_back.o
% Provides a few interesting functions for many of the other C files that
% want to evaluate things like the log-likelihood of the observations.
mex -c hmmmix_common.c
% This is the "frugal" version of the code that computes the updates for
% the hM quantities. The "non-frugal" version computed loglikelihoods by
% itself but that turned out to be a bad way to factor the code. I also
% realized after some time that it was better to separate out the groups
% and not process them all at once. The value of T is so large that we
% don't get penalized for that in terms of speed.
mex -c hmmmix_frugal_hM_KTg_MatlabC.c
mex hmmmix_frugal_hM_KTg_MatlabC.o hmmmix_common.o fwd_back.o
% These two functions are used to generate artificial data faster. There
% were a few problems with non-vectorizable code so these were written.
mex hmmmix_generateData_hiddenChains_helper_MatlabC.c
mex hmmmix_generateData_hiddenPatients_helper_MatlabC.c
mex viterbi_path_MatlabC.c
mex -c hmmmix_compute_rho_KTP_nopdf_MatlabC.c
mex hmmmix_compute_rho_KTP_nopdf_MatlabC.o hmmmix_common.o
% The function repmatC is used by the 'normalize' function, which comes
% from Kevin Murphy's BNT toolkit. repmatC itself comes from Tom Minka's
% lightspeed toolkit, but I never really benchmarked the thing myself.
mex -c mexutil.c
mex -c repmatC.c
mex repmatC.o mexutil.o
fprintf('Now we''re compiling functions that are not really necessary unless we want to use the code for kmedoids.\n')
% Functions used for the kmedoids hack with Sohrab Shah's code. These are
% used to speed up the functions that couldn't be vectorized. Since I've
% used many versions of the fwd_back.c code, I had to include here the
% "old" version that behaved exactly like Sohrab's matlab version of the
% 'fwd_back' function. Same for viterbi_path_SSC.
cd optional_kmedoids_wrapper
mex fwd_back.c
mex viterbi_path_SSC.c
cd ..