Mercurial > hg > trimatlab
changeset 9:cc549aca4ea6
Added optional shuffling of Markov chain symbols.
author | samer |
---|---|
date | Mon, 20 Feb 2012 13:39:30 +0000 |
parents | e1534c7329e2 |
children | bce0bd672b47 |
files | mt_get_transmat_at.m mt_get_transmat_near.m mt_init.m |
diffstat | 3 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mt_get_transmat_at.m Mon Feb 13 11:21:15 2012 +0000 +++ b/mt_get_transmat_at.m Mon Feb 20 13:39:30 2012 +0000 @@ -25,6 +25,10 @@ J = M(1+floor(length(M)*rand)); T = tmats(:,:,J); I = info(J,:); + if Sys.shuffle + perm=randperm(K); + T=T(perm,perm); + end mt_show_transmat(Id,T,I); if nargin>1, P=Sys.revmap(I(1:2)'/logK); end end
--- a/mt_get_transmat_near.m Mon Feb 13 11:21:15 2012 +0000 +++ b/mt_get_transmat_near.m Mon Feb 20 13:39:30 2012 +0000 @@ -35,6 +35,10 @@ %Mask=2*int16(Mask); Mask(J)=1; %set(Sys.hScat{K},'CDATA',Mask); % scatc(info,Mask,16); rotate3d on; %figure(50); title(sprintf('pos: %.2f, %.2f',normpos(1), normpos(2))); + if Sys.shuffle + perm=randperm(K); + T=T(perm,perm); + end mt_show_transmat(Id,T,I); if nargin>1, P=Sys.revmap(I(1:2)'/logK); end end
--- a/mt_init.m Mon Feb 13 11:21:15 2012 +0000 +++ b/mt_init.m Mon Feb 20 13:39:30 2012 +0000 @@ -5,7 +5,8 @@ % B0:nonneg ~'parameter for sampling', % A1:nonneg ~'parameter for sampling', % B0:nonneg ~'parameter for sampling', -% L:natural ~'number of transmats to sample' +% L:natural ~'number of transmats to sample', +% Shuffle:book ~'whether or not to shuffle symbols when returning transmat' % -> mt_system. % % Initial system contains no transition matrices - you @@ -17,11 +18,12 @@ % % The figure for scatter plots is fixed to figure 50 for now. -function Sys=mt_init(A0,B0,A1,B1,L) +function Sys=mt_init(A0,B0,A1,B1,L,Shuffle) Sys.sample_transmats = @(k)sample_transmat_hdp(A0,B0,A1,B1,k,L); Sys.transmats = {}; Sys.info = {}; Sys.refpoints = [0,0;1,0;0,1]'; Sys.fig = 50; + Sys.shuffle = Shuffle; Sys = mt_calibrate(Sys); end