annotate toolboxes/FullBNT-1.0.7/KPMtools/partition_matrix_vec.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 [m1, m2, K11, K12, K21, K22] = partition_matrix_vec(m, K, n1, n2, bs)
|
Daniel@0
|
2 % PARTITION_MATRIX_VEC Partition a vector and matrix into blocks.
|
Daniel@0
|
3 % [m1, m2, K11, K12, K21, K22] = partition_matrix_vec(m, K, blocks1, blocks2, bs)
|
Daniel@0
|
4 %
|
Daniel@0
|
5 % bs(i) = block size of i'th node
|
Daniel@0
|
6 %
|
Daniel@0
|
7 % Example:
|
Daniel@0
|
8 % n1 = [6 8], n2 = [5], bs = [- - - - 2 1 - 2], where - = don't care
|
Daniel@0
|
9 % m = [0.1 0.2 0.3 0.4 0.5], K = some 5*5 matrix,
|
Daniel@0
|
10 % So E[X5] = [0.1 0.2], E[X6] = [0.3], E[X8] = [0.4 0.5]
|
Daniel@0
|
11 % m1 = [0.3 0.4 0.5], m2 = [0.1 0.2];
|
Daniel@0
|
12
|
Daniel@0
|
13 dom = myunion(n1, n2);
|
Daniel@0
|
14 n1i = block(find_equiv_posns(n1, dom), bs(dom));
|
Daniel@0
|
15 n2i = block(find_equiv_posns(n2, dom), bs(dom));
|
Daniel@0
|
16 m1 = m(n1i);
|
Daniel@0
|
17 m2 = m(n2i);
|
Daniel@0
|
18 K11 = K(n1i, n1i);
|
Daniel@0
|
19 K12 = K(n1i, n2i);
|
Daniel@0
|
20 K21 = K(n2i, n1i);
|
Daniel@0
|
21 K22 = K(n2i, n2i);
|