Skip to content

Commit

Permalink
Use new T[] instead of SG_MALLOC.
Browse files Browse the repository at this point in the history
  • Loading branch information
pl8787 committed Mar 10, 2014
1 parent 04b626d commit 8e99789
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/shogun/classifier/svm/LibLinear.cpp
Expand Up @@ -124,13 +124,9 @@ bool CLibLinear::train_machine(CFeatures* data)
if (use_bias)
{
if(liblinear_solver_type!=L2R_LR_DUAL)
{
prob.n=w.vlen+1;
}
else
{
prob.n=w.vlen;
}
memset(w.vector, 0, sizeof(float64_t)*(w.vlen+1));
}
else
Expand Down Expand Up @@ -1179,11 +1175,11 @@ void CLibLinear::solve_l2r_lr_dual(const liblinear_problem *prob, double eps, do
int l = prob->l;
int w_size = prob->n;
int i, s, iter = 0;
double *xTx = SG_MALLOC(double, l);
double *xTx = new double[l];
int max_iter = 1000;
int *index = SG_MALLOC(int, l);
double *alpha = SG_MALLOC(double, 2*l); // store alpha and C - alpha
int32_t *y = SG_MALLOC(int32_t, l);
int *index = new int[l];
double *alpha = new double[2*l]; // store alpha and C - alpha
int32_t *y = new int32_t[l];
int max_inner_iter = 100; // for inner Newton
double innereps = 1e-2;
double innereps_min = CMath::min(1e-8, eps);
Expand Down

0 comments on commit 8e99789

Please sign in to comment.