annotate toolboxes/FullBNT-1.0.7/bnt/general/unroll_dbn_topology.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function M = unroll_dbn_topology(intra, inter, T, intra1)
Daniel@0 2 % UNROLL_DBN_TOPOLOGY Make the block diagonal adjacency matrix for a DBN consisting of T slices
Daniel@0 3 % M = unroll_dbn_topology(intra, inter, T, intra1)
Daniel@0 4 %
Daniel@0 5 % intra is the connectivity within a slice, inter between two slices.
Daniel@0 6 % M will have intra along the diagonal, and inter one above the diagonal.
Daniel@0 7 % intra1 is an optional argumnet, in case the intra is different for the first slice.
Daniel@0 8
Daniel@0 9 if nargin < 4, intra1 = intra; end
Daniel@0 10
Daniel@0 11 ss = length(intra); % slice size
Daniel@0 12 M = sparse(ss*T, ss*T);
Daniel@0 13
Daniel@0 14 b = 1:ss;
Daniel@0 15 M(b,b) = intra1;
Daniel@0 16 M(b,b+ss) = inter;
Daniel@0 17
Daniel@0 18 for t=2:T-1
Daniel@0 19 b = (1:ss) + (t-1)*ss;
Daniel@0 20 M(b,b) = intra;
Daniel@0 21 M(b,b+ss) = inter;
Daniel@0 22 end
Daniel@0 23
Daniel@0 24 t = T;
Daniel@0 25 b = (1:ss) + (t-1)*ss;
Daniel@0 26 M(b,b) = intra;
Daniel@0 27
Daniel@0 28