Mercurial > hg > camir-aes2014
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function M = unroll_higher_order_topology(intra, inter, T, intra1) | |
2 % UNROLL_DBN_TOPOLOGY Make the block diagonal adjacency matrix for a DBN consisting of T slices | |
3 % M = unroll_dbn_topology(intra, inter, T, intra1) | |
4 % | |
5 % intra is the connectivity within a slice, inter between two slices. | |
6 % M will have intra along the diagonal, and inter one above the diagonal. | |
7 % intra1 is an optional argumnet, in case the intra is different for the first slice. | |
8 | |
9 if nargin < 4 | |
10 intra1 = intra; | |
11 end; | |
12 | |
13 | |
14 ss = length(intra); % slice size | |
15 M = sparse(ss*T, ss*T); | |
16 [rows,columns,order] = size(inter); | |
17 for t1 = 1:T | |
18 b = 1 + (t1 - 1)*ss : t1*ss; | |
19 if t1 == 1 | |
20 M(b,b) = intra1; | |
21 else | |
22 M(b,b) = intra; | |
23 end | |
24 for t2 = 1:order | |
25 if t1 + t2 <= T | |
26 M(b,b+t2*ss) = inter(:,:,t2); | |
27 end | |
28 end | |
29 end | |
30 |