function build_digital_mex(distr, x)
% Build mex version of digital option pricing function to make cpu run faster

% Treat 'distr' and 'x' as compile-time constants
distr_c = coder.Constant(distr);
x_c     = coder.Constant(x);

% Variable-size column vectors (length can vary at runtime)
vec  = coder.typeof(0,[Inf 1],[1 0]);  % variable-length column double

% Scalar doubles
scal = 0;                               % scalar double

codegen -config:mex digital_option_price_cg -args { distr_c, vec, vec, x_c, scal, scal, scal, scal, scal, scal, scal, scal, scal }
end