Slightly modified sources of from libsvm-2.83.