Add parameter for providing algorithm and error model parameters

Currently, arguments are taken from global variables. As this is
a library, such an approach is not thread safe. Thus, we remove
the reliance on global variables and replace them by structures
with an API.