]> granicus.if.org Git - liblinear/commitdiff
Remove mxIsSparse(prhs[1]) in do_predict(...) in matlab/predict.c. Sparse format...
authorpopo <popo@16e7d947-dcc2-db11-b54a-0017319806e7>
Sun, 10 Apr 2011 14:57:03 +0000 (14:57 +0000)
committerpopo <popo@16e7d947-dcc2-db11-b54a-0017319806e7>
Sun, 10 Apr 2011 14:57:03 +0000 (14:57 +0000)
matlab/predict.c
matlab/train.c

index 66c03be09db9927a46890dd56215ad6ba289ed9f..2704d36c5c042bc05f9accf4c913c12104ab60f2 100644 (file)
@@ -102,26 +102,19 @@ void do_predict(mxArray *plhs[], const mxArray *prhs[], struct model *model_, co
        ptr_label    = mxGetPr(prhs[0]);
 
        // transpose instance matrix
-       if(mxIsSparse(prhs[1]))
+       if(col_format_flag)
+               pplhs[0] = (mxArray *)prhs[1];
+       else
        {
-               if(col_format_flag)
-               {
-                       pplhs[0] = (mxArray *)prhs[1];
-               }
-               else
+               mxArray *pprhs[1];
+               pprhs[0] = mxDuplicateArray(prhs[1]);
+               if(mexCallMATLAB(1, pplhs, 1, pprhs, "transpose"))
                {
-                       mxArray *pprhs[1];
-                       pprhs[0] = mxDuplicateArray(prhs[1]);
-                       if(mexCallMATLAB(1, pplhs, 1, pprhs, "transpose"))
-                       {
-                               mexPrintf("Error: cannot transpose testing instance matrix\n");
-                               fake_answer(plhs);
-                               return;
-                       }
+                       mexPrintf("Error: cannot transpose testing instance matrix\n");
+                       fake_answer(plhs);
+                       return;
                }
        }
-       else
-               mexPrintf("Testing_instance_matrix must be sparse\n");
 
 
        prob_estimates = Malloc(double, nr_class);
@@ -283,7 +276,8 @@ void mexFunction( int nlhs, mxArray *plhs[],
                        do_predict(plhs, prhs, model_, prob_estimate_flag);
                else
                {
-                       mexPrintf("Testing_instance_matrix must be sparse\n");
+                       mexPrintf("Testing_instance_matrix must be sparse; "
+                               "use sparse(Testing_instance_matrix) first\n");
                        fake_answer(plhs);
                }
 
index cad8a9aa430fc2088ab5c164968469aee8165798..b0b2b522cf148831c709463df9c4b9c4c2259adc 100644 (file)
@@ -304,7 +304,8 @@ void mexFunction( int nlhs, mxArray *plhs[],
                        err = read_problem_sparse(prhs[0], prhs[1]);
                else
                {
-                       mexPrintf("Training_instance_matrix must be sparse\n");
+                       mexPrintf("Training_instance_matrix must be sparse; "
+                               "use sparse(Training_instance_matrix) first\n");
                        destroy_param(&param);
                        fake_answer(plhs);
                        return;