forked from ilya-shmulevich/pbn-matlab-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDistortionVectors.m
37 lines (34 loc) · 1.24 KB
/
DistortionVectors.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function D = DistortionVectors(d,e,i,D,c,emax)
% D = DistortionVectors(d,e,i,D,c,emax) - Returns proper distortion vectors
%
% DistortionVectors -function returns proper distortion vectors in D (or their
% permutations) such that together with the optimal function, or its truth
% table, they define the set of functions {f : e(f)<=emax} that have error
% size smaller than equal to (ref. Best-Fit Extension Problem) emax. See a
% paper for details.
%
% Input variables:
% d - a (current permuted) distortion vector
% e - a (current) error size
% i - index of the right most bit that is set in the previous (upper) level
% the recursive algorithm
% D - set of proper (permuted) distortion vector. Each row of D corresponds
% to a single distortion vector.
% c - (permuted) "weight" vector
% emax - maximum error size
%
% Output variables:
% D - set of proper (permuted) distortion vector. See above for details.
%
% Functions used:
% 08.04.2002 by Harri Lähdesmäki
% Modified:
j = i + 1;
stop = length(d); % = 2^k
while j<=stop & (e+c(j))<=emax
d(j) = 1;
D = [D;d];
D = DistortionVectors(d,e+c(j),j,D,c,emax);
d(j) = 0;
j = j+1;
end % while j<=stop & (e+c(j))<=emax