Mercurial > hg > mauch-mirex-2010
view _FullBNT/KPMtools/find_equiv_posns.m @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
line wrap: on
line source
function p = find_equiv_posns(vsmall, vlarge) % FIND_EQUIV_POSNS p[i] = the place where vsmall[i] occurs in vlarge. % p = find_equiv_posns(vsmall, vlarge) % THE VECTORS ARE ASSUMED TO BE SORTED. % % e.g., vsmall=[2,8], vlarge=[2,7,8,4], p=[1,3] % % In R/S, this function is called 'match' %if ~mysubset(vsmall, vlarge) % error('small domain must occur in large domain'); %end if isempty(vsmall) | isempty(vlarge) p = []; return; end bitvec = sparse(1, max(vlarge)); %bitvec = zeros(1, max(vlarge)); bitvec(vsmall) = 1; p = find(bitvec(vlarge)); %p = find(ismember(vlarge, vsmall)); % slower