Skip to content
Browse files

fix a liblinear compatibility issue (1.91 uses double for y)

  • Loading branch information...
1 parent 5aed821 commit 5c451c437b19664b01b35081b42e4e2de66b2f52 @liuliu committed Oct 7, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/ccv_dpm.c
View
3 lib/ccv_dpm.c
@@ -441,7 +441,8 @@ static void _ccv_dpm_initialize_root_classifier(gsl_rng* rng, ccv_dpm_root_class
struct problem prob;
prob.n = symmetric ? 31 * cols2c * rows + 1 : 31 * cols * rows + 1;
prob.bias = symmetric ? 0.5 : 1.0; // for symmetric, since we only pass half features in, need to set bias to be half too
- prob.y = (int*)malloc(sizeof(int) * (cnum + negex->rnum) * (!!symmetric + 1));
+ // new version (1.91) of liblinear uses double instead of int (1.8) for prob.y, cannot cast for that.
+ prob.y = malloc(sizeof(prob.y[0]) * (cnum + negex->rnum) * (!!symmetric + 1));
prob.x = (struct feature_node**)malloc(sizeof(struct feature_node*) * (cnum + negex->rnum) * (!!symmetric + 1));
FLUSH(" - converting examples to liblinear format: %d / %d", 0, (cnum + negex->rnum) * (!!symmetric + 1));
l = 0;

0 comments on commit 5c451c4

Please sign in to comment.
Something went wrong with that request. Please try again.