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