Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/general/unroll_higher_order_topology.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function M = unroll_higher_order_topology(intra, inter, T, intra1) |
wolffd@0 | 2 % UNROLL_DBN_TOPOLOGY Make the block diagonal adjacency matrix for a DBN consisting of T slices |
wolffd@0 | 3 % M = unroll_dbn_topology(intra, inter, T, intra1) |
wolffd@0 | 4 % |
wolffd@0 | 5 % intra is the connectivity within a slice, inter between two slices. |
wolffd@0 | 6 % M will have intra along the diagonal, and inter one above the diagonal. |
wolffd@0 | 7 % intra1 is an optional argumnet, in case the intra is different for the first slice. |
wolffd@0 | 8 |
wolffd@0 | 9 if nargin < 4 |
wolffd@0 | 10 intra1 = intra; |
wolffd@0 | 11 end; |
wolffd@0 | 12 |
wolffd@0 | 13 |
wolffd@0 | 14 ss = length(intra); % slice size |
wolffd@0 | 15 M = sparse(ss*T, ss*T); |
wolffd@0 | 16 [rows,columns,order] = size(inter); |
wolffd@0 | 17 for t1 = 1:T |
wolffd@0 | 18 b = 1 + (t1 - 1)*ss : t1*ss; |
wolffd@0 | 19 if t1 == 1 |
wolffd@0 | 20 M(b,b) = intra1; |
wolffd@0 | 21 else |
wolffd@0 | 22 M(b,b) = intra; |
wolffd@0 | 23 end |
wolffd@0 | 24 for t2 = 1:order |
wolffd@0 | 25 if t1 + t2 <= T |
wolffd@0 | 26 M(b,b+t2*ss) = inter(:,:,t2); |
wolffd@0 | 27 end |
wolffd@0 | 28 end |
wolffd@0 | 29 end |
wolffd@0 | 30 |