function bool_istransition = func_isTransition(x,m,k)
% Checks if the transition matrix contained in x is indeed a transition
% matrix (all its coefficients should be nonnegative, up to a tolerance margin)
% Used only in "func_CMAES.m"

tolerance_margin = 1e-6;

Atilde = reshape(x,[m+k-1,k]);    
Qtildetemp = (Atilde(m+1:m+k-1,:))';

bool_istransition = ~(numel(find(Qtildetemp < -tolerance_margin)) > 0 || numel(find(sum(Qtildetemp, 2) > 1+tolerance_margin)));
