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