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