]> granicus.if.org Git - liblinear/commitdiff
modify matlab/train.c to check if the label vector is in dense format.
authorTzu-Ming Kuo <b99902073@ntu.edu.tw>
Fri, 6 Jun 2014 15:42:35 +0000 (23:42 +0800)
committerTzu-Ming Kuo <b99902073@ntu.edu.tw>
Fri, 6 Jun 2014 15:42:35 +0000 (23:42 +0800)
matlab/train.c

index 1301ed5bfa86f1086e27e9073e93a3b03f6b3d7e..7c292804ae6f6160779c26203cb24585f3257d4f 100644 (file)
@@ -356,12 +356,20 @@ void mexFunction( int nlhs, mxArray *plhs[],
        {
                int err=0;
 
-               if(!mxIsDouble(prhs[0]) || !mxIsDouble(prhs[1])) {
+               if(!mxIsDouble(prhs[0]) || !mxIsDouble(prhs[1]))
+               {
                        mexPrintf("Error: label vector and instance matrix must be double\n");
                        fake_answer(nlhs, plhs);
                        return;
                }
 
+               if(mxIsSparse(prhs[0]))
+               {
+                       mexPrintf("Error: label vector should not be in sparse format");
+                       fake_answer(nlhs, plhs);
+                       return;
+               }
+
                if(parse_command_line(nrhs, prhs, NULL))
                {
                        exit_with_help();