mex stochastic solver with test added