The ChemGPS Library - About


The libchemgps library is a generic library for making predictions using SIMCA-QP. Use this library to write standalone and client/server applications for SIMCA-QP. The chemgps-sqp2 package contains both a fully functional standalone application as well as an client/server solution.

You need a separate license from Umetrics ( to using this library.

The idea behind the library

The idea behind this library is to enable loading the project once and making multiple predictions against it (the client/server model), thus reducing the waste of time loading the project over and over (a time consuming task).

Loading data

Loading data for predictions requires a user supplied callback function. That's a design decision that enables loading of data for prediction from a number of different data sources (like databases, files/pipes or over the network) while providing a clean library API.

The library implements on demand loading of quantitative, qualitative, parents lagged and qualitative lagged data.

Getting the result

The result from a prediction is retreived by calling cgps_result() with a FILE * argument (the out argument). This makes it easy to send the result to i.e stdout, a TCP or UNIX socket or memory opened by calling fmemopen(3).


See the manual page and the chemgps-sqp2 package for example code.

The usage pattern is to initilize an cgps_options struct (common options) and using it when calling cgps_project_load(). The same options struct can be used to load multiple projects.

Once the project is loaded, call cgps_predict() and cgps_result() on one or more models in the project. Call cgps_project_close() when done to close and unload the project.