completion of raw svm function