How to use the model from Matlab
websave("mex_evoapprox.c","https://ehw.fit.vutbr.cz/evoapproxlib/mex_evoapprox.c");
websave("add16u_0RH.c","https://raw.githubusercontent.com/ehw-fit/approxlib/v1.2022/adders/16_unsigned/pareto_pwr_mre/add16u_0RH.c");
mex mex_evoapprox.c add16u_0RH.c -DEXTFUN=add16u_0RH -output add16u_0RH;
add16u_0RH(123,210)
add16u_0RH([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 = add16u_0RH(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)