How to use the model from Matlab
websave("mex_evoapprox.c","https://ehw.fit.vutbr.cz/evoapproxlib/mex_evoapprox.c");
websave("mul11u_00H.c","https://raw.githubusercontent.com/ehw-fit/approxlib/v1.2022/multiplers/11x11_unsigned/pareto_pwr_mae/mul11u_00H.c");
mex mex_evoapprox.c mul11u_00H.c -DEXTFUN=mul11u_00H -output mul11u_00H;
mul11u_00H(123,210)
mul11u_00H([1,2,3,4,5],[10,20,30,40,50])
BW = 11
allcombs = [0:1:2^(BW+BW)-1];
inputs = [floor(allcombs/2^BW); mod(allcombs,2^BW)];
req = inputs(1,:).*inputs(2,:);
res = mul11u_00H(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)