The function returns the following error codes:
0 ... everything is OK -1 ... the dimensions of the two vectors do not match