How to use the model from Python

#Make sure that cython extension is installed
#> pip install --user cython

# The source code of the add9se_0AZ extension needs to be downloaded first
> curl -s "https://ehw.fit.vutbr.cz/evoapproxlib/v1.2022?folder=adders/9_signed_extended/pareto_pwr_ep&file=add9se_0AZ.c&pyx=bash" | bash

#Finally, the extension can be used in a Python script as follows
> python
import pyximport; pyximport.install()
import add9se_0AZ

def u2s(v): # 10b unsigned to 10b signed
    if v & 512:
	return v - 1024
    return v

wce = e = 0
for i in range(-2**8,2**8):
    for j in range(-2**8,2**8):
        diff = abs(u2s(add9se_0AZ.add(i,j)) - (i+j))
        if diff > wce: wce = diff
        e += diff

print('average error magnitude (mae)',e/(2.0**(10)))
print('worst-case error magnitude (wce)',wce)