% example probability matrix setup from
% "A Fast Method for Finding the Exact N-best
% Hypotheses for Multitarget Tracking",
% R. Danchick and G. E. Newnam,
% IEEE Trans. on Aerospace and Electronic Systems,
% Vol. 29, No. 2, April 1993, pp. 555-560
%

P = [	0.40	0.00	0.36	0.00	0.39	0.00	0.42
	0.00	0.41	0.06	0.38	0.00	0.43	0.05
	0.15	0.27	0.17	0.11	0.29	0.09	0.21
	0.28	0.13	0.26	0.18	0.10	0.20	0.22
	0.14	0.16	0.12	0.30	0.19	0.25	0.07
];

P1 = P(:);

P10 = find(P1==0);

P1(P10) = 1e-99;	% avoid -log(0)

W1 = -log(P1);

W1(P10) = HUGE_VAL;

W = reshape( W1, size(P));
