Added source Matlab code for reference
This commit is contained in:
parent
b8af977117
commit
b5d99903d2
186 changed files with 61405 additions and 1 deletions
37
matlab/spatial/private/updateLogmlTable.m
Normal file
37
matlab/spatial/private/updateLogmlTable.m
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
function updateLogmlTable(pops)
|
||||
% Updates global variables LOGML_TABLE, npops*1 array, logml values for
|
||||
% each population given in "pops"
|
||||
% After the updates, the values are based on the current values of the
|
||||
% global variables CQ_COUNTS, SUM_CQ_COUNTS, SP_COUNTS, SUM_SP_COUNTS
|
||||
% Lu Cheng, 25.05.2011
|
||||
|
||||
global CQ_COUNTS; global SUM_CQ_COUNTS;
|
||||
global SP_COUNTS; global SUM_SP_COUNTS;
|
||||
global CQ_PRIOR; global SP_PRIOR;
|
||||
|
||||
global LOGML_TABLE;
|
||||
|
||||
tmpN = length(pops);
|
||||
tmpCqPrior = repmat(CQ_PRIOR,[1 1 tmpN]);
|
||||
tmpSpPrior = repmat(SP_PRIOR,[1 1 tmpN]);
|
||||
|
||||
term1 = 0-gammaln(1+SUM_CQ_COUNTS(:,pops));
|
||||
term2 = sum(gammaln(tmpCqPrior+CQ_COUNTS(:,:,pops))-gammaln(tmpCqPrior) , 1);
|
||||
if length(pops) > 1
|
||||
term2 = squeeze(term2);
|
||||
else
|
||||
term2 = term2';
|
||||
end
|
||||
|
||||
term3 = 0-gammaln(1+SUM_SP_COUNTS(:,pops));
|
||||
term4 = sum(gammaln(tmpSpPrior+SP_COUNTS(:,:,pops))-gammaln(tmpSpPrior) , 1);
|
||||
|
||||
if length(pops) > 1
|
||||
term4 = squeeze(term4);
|
||||
else
|
||||
term4 = term4';
|
||||
end
|
||||
|
||||
LOGML_TABLE(pops) = sum(term1+term2) - sum(term3+term4);
|
||||
|
||||
%----------------------------------------------------------------------
|
||||
Loading…
Add table
Add a link
Reference in a new issue