Mercurial > hg > mauch-mirex-2010
annotate _FullBNT/KPMtools/extend_domain_table.m @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
rev | line source |
---|---|
matthiasm@8 | 1 function B = extend_domain_table(A, smalldom, smallsz, bigdom, bigsz) |
matthiasm@8 | 2 % EXTEND_DOMAIN_TABLE Expand an array so it has the desired size. |
matthiasm@8 | 3 % B = extend_domain_table(A, smalldom, smallsz, bigdom, bigsz) |
matthiasm@8 | 4 % |
matthiasm@8 | 5 % A is the array with domain smalldom and sizes smallsz. |
matthiasm@8 | 6 % bigdom is the desired domain, with sizes bigsz. |
matthiasm@8 | 7 % |
matthiasm@8 | 8 % Example: |
matthiasm@8 | 9 % smalldom = [1 3], smallsz = [2 4], bigdom = [1 2 3 4], bigsz = [2 1 4 5], |
matthiasm@8 | 10 % so B(i,j,k,l) = A(i,k) for i in 1:2, j in 1:1, k in 1:4, l in 1:5 |
matthiasm@8 | 11 |
matthiasm@8 | 12 if isequal(size(A), [1 1]) % a scalar |
matthiasm@8 | 13 B = A; % * myones(bigsz); |
matthiasm@8 | 14 return; |
matthiasm@8 | 15 end |
matthiasm@8 | 16 |
matthiasm@8 | 17 map = find_equiv_posns(smalldom, bigdom); |
matthiasm@8 | 18 sz = ones(1, length(bigdom)); |
matthiasm@8 | 19 sz(map) = smallsz; |
matthiasm@8 | 20 B = myreshape(A, sz); % add dimensions for the stuff not in A |
matthiasm@8 | 21 sz = bigsz; |
matthiasm@8 | 22 sz(map) = 1; % don't replicate along A's dimensions |
matthiasm@8 | 23 B = myrepmat(B, sz(:)'); |
matthiasm@8 | 24 |