How to use the model from Matlab
websave("mex_evoapprox.c","https://ehw.fit.vutbr.cz/evoapproxlib/mex_evoapprox.c");
websave("mul16u_2KD.c","https://raw.githubusercontent.com/ehw-fit/approxlib/v1.2022/multiplers/16x16_unsigned/pareto_pwr_mae/mul16u_2KD.c");
mex mex_evoapprox.c mul16u_2KD.c -DEXTFUN=mul16u_2KD -output mul16u_2KD;
mul16u_2KD(123,210)
mul16u_2KD([1,2,3,4,5],[10,20,30,40,50])
BW = 16
SAMPLES = 10000000
inputs = floor((2^BW-1).*rand(2,SAMPLES));
req = inputs(1,:).*inputs(2,:);
res = mul16u_2KD(inputs(1,:),inputs(2,:));
ED = req - res;
ep=sum(ED~=0)/length(ED)
wce=max(abs(ED))
nwce=max(abs(ED))/(2^(BW+BW))
nwce=max(abs(ED))/(2^(BW+1))
mae=mean(abs(ED))
mse=mean(ED.^2)