function q=opt1(t,lam)

% optimal joint prob. matrix, given time matrix and lam parameter

% inflate the zero time matrix elements to exclude them:

z=find(t==0);
eps=zeros(size(t));
eps(z)=10^10;

q=exp(lam*(t+eps)-ones(size(t)));
