Skip to content

Commit

Permalink
Further generalization of SLEP based logistic regression solver
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jul 3, 2012
1 parent 725d6ad commit 7447322
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 116 deletions.
70 changes: 35 additions & 35 deletions src/shogun/lib/slep/q1/eppVector.h
Expand Up @@ -25,50 +25,50 @@


/*
Lp Norm Regularized Euclidean Projection
min 1/2 ||x- v||_2^2 + rho * ||x||_p
Usage (in Matlab):
[x, c, iter_step]=epp(v, n, rho, p, c0);
Lp Norm Regularized Euclidean Projection
Usage in C:
epp(x, c, iter_step, v, n, rho, p, c0);
min 1/2 ||x- v||_2^2 + rho * ||x||_p
The function epp implements the following three functions
epp1(x, v, n, rho) for p=1
epp2(x, v, n, rho) for p=2
eppInf(x, c, iter_step, v, n, rho, c0) for p=inf
eppO(x, c, iter_step, v, n, rho, p) for other p
Usage (in Matlab):
[x, c, iter_step]=epp(v, n, rho, p, c0);
------------------------------------------------------------
Usage in C:
epp(x, c, iter_step, v, n, rho, p, c0);
Here, the input and output are of Vector form.
The function epp implements the following three functions
epp1(x, v, n, rho) for p=1
epp2(x, v, n, rho) for p=2
eppInf(x, c, iter_step, v, n, rho, c0) for p=inf
eppO(x, c, iter_step, v, n, rho, p) for other p
------------------------------------------------------------
Written by Jun Liu, May 18th, 2009
For any problem, please contact: j.liu@asu.edu
*/
Here, the input and output are of Vector form.
Written by Jun Liu, May 18th, 2009
For any problem, please contact: j.liu@asu.edu
void eppVector(double *x, double * v, double * ind, int k, int n, double * rho, double p){
int i, *iter_step;
double c0, c;
*/

void eppVector(double *x, double * v, int* ind, int k, int n, double * rho, double rho_multiplier, double p){
int i, *iter_step;
double c0, c;
double *px, *pv;
iter_step=(int *)malloc(sizeof(int)*2);
c0=0;
for(i=0; i<k; i++){
px=x+(int)ind[i];

iter_step=(int *)malloc(sizeof(int)*2);

c0=0;
for(i=0; i<k; i++){

px=x+(int)ind[i];
pv=v+(int)ind[i];
epp(px, &c, iter_step, pv, (int)(ind[i+1]-ind[i]), rho[i], p, c0);
}
free(iter_step);

epp(px, &c, iter_step, pv, (int)(ind[i+1]-ind[i]), rho[i]*rho_multiplier, p, c0);

}

free(iter_step);
}
#endif /* ----- #ifndef EPPVECTOR_SLEP ----- */

0 comments on commit 7447322

Please sign in to comment.