Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /src/knn.cc [r78] .. [r79] Maximize Restore

  Switch to side-by-side view

--- a/src/knn.cc
+++ b/src/knn.cc
@@ -148,14 +148,14 @@
 
     mat=read_stats2(opt_args.normfile, b, nvar2, nvar3);
     assert(nvar3==nvar);			//should be true
+    if (nvar2!=nvar1) {
+      fprintf(stderr, "agf: incorrect number of dimensions in test data (%d found, %d expected)\n", nvar1, nvar2);
+      exit(DIMENSION_MISMATCH);
+    }
     for (nel_ta i=0; i<ntest; i++) {
       for (dim_ta j=0; j<nvar2; j++) {
         test[i][j]-=b[j];
       }
-    }
-    if (nvar2!=nvar1) {
-      fprintf(stderr, "agf: incorrect number of dimensions in test data (%d found, %d expected)\n", nvar1, nvar2);
-      exit(DIMENSION_MISMATCH);
     }
     testnew=matrix_mult(test, mat, ntest, nvar1, nvar);
     delete_matrix(test);