To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _FullBNT / BNT / general / unroll_dbn_topology.m @ 8:b5b38998ef3b

History | View | Annotate | Download (711 Bytes)

1
function M = unroll_dbn_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, intra1 = intra; end
10

    
11
ss = length(intra); % slice size
12
M = sparse(ss*T, ss*T);
13

    
14
b = 1:ss;
15
M(b,b) = intra1;
16
M(b,b+ss) = inter;
17

    
18
for t=2:T-1
19
  b = (1:ss) + (t-1)*ss;
20
  M(b,b) = intra;
21
  M(b,b+ss) = inter;
22
end
23

    
24
t = T;
25
b = (1:ss) + (t-1)*ss;
26
M(b,b) = intra;
27

    
28