Skip to content

Commit

Permalink
Merge branch 'slep' of git://github.com/lisitsyn/shogun
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jun 25, 2012
2 parents 0587779 + 1381692 commit 43fe9aa
Show file tree
Hide file tree
Showing 10 changed files with 1,351 additions and 784 deletions.
2 changes: 2 additions & 0 deletions src/interfaces/modular/Transfer.i
Expand Up @@ -20,6 +20,7 @@
%rename(TaskGroup) CTaskGroup;
%rename(TaskTree) CTaskTree;
%rename(MultitaskLSRegression) CMultitaskLSRegression;
%rename(MultitaskLogisticRegression) CMultitaskLogisticRegression;

%rename(LibLinearMTL) CLibLinearMTL;

Expand All @@ -43,6 +44,7 @@
%include <shogun/transfer/multitask/TaskGroup.h>
%include <shogun/transfer/multitask/TaskTree.h>
%include <shogun/transfer/multitask/MultitaskLSRegression.h>
%include <shogun/transfer/multitask/MultitaskLogisticRegression.h>

%include <shogun/transfer/multitask/LibLinearMTL.h>

Expand Down
1 change: 1 addition & 0 deletions src/interfaces/modular/Transfer_includes.i
Expand Up @@ -13,6 +13,7 @@
#include <shogun/transfer/multitask/TaskGroup.h>
#include <shogun/transfer/multitask/TaskTree.h>
#include <shogun/transfer/multitask/MultitaskLSRegression.h>
#include <shogun/transfer/multitask/MultitaskLogisticRegression.h>

#ifdef USE_SVMLIGHT
#include <shogun/transfer/domain_adaptation/DomainAdaptationSVM.h>
Expand Down
55 changes: 55 additions & 0 deletions src/shogun/lib/slep/q1/eppMatrix.cpp
@@ -0,0 +1,55 @@
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2009 - 2012 Jun Liu and Jieping Ye
*/

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <shogun/lib/slep/q1/eppMatrix.h>

void eppMatrix(double *X, double * V, int k, int n, double rho, double p)
{
int i, j, *iter_step;
double *v, *x;
double c0, c;

v=(double *)malloc(sizeof(double)*n);
x=(double *)malloc(sizeof(double)*n);
iter_step=(int *)malloc(sizeof(int)*2);

/*
*X and V are k x n matrices in matlab, stored in column priority manner
*x corresponds a row of X
*/


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

for(j=0; j<n; j++)
v[j]=V[i + j*k];

epp(x, &c, iter_step, v, n, rho, p, c0);
c0=c;

for(j=0; j<n; j++)
X[i + j*k]=x[j];
}

free(v);
free(x);
free(iter_step);
};
45 changes: 4 additions & 41 deletions src/shogun/lib/slep/q1/eppMatrix.h
Expand Up @@ -14,16 +14,11 @@
* Copyright (C) 2009 - 2012 Jun Liu and Jieping Ye
*/

#ifndef EPPMATRIX_SLEP
#define EPPMATRIX_SLEP
#ifndef EPPMATRIXQ1_SLEP
#define EPPMATRIXQ1_SLEP

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <shogun/lib/slep/q1/epph.h> /* This is the head file that contains the implementation of the used functions*/


/*
Lp Norm Regularized Euclidean Projection
Expand All @@ -50,38 +45,6 @@
For any problem, please contact: j.liu@asu.edu
*/

void eppMatrix(double *X, double * V, int k, int n, double rho, double p){
int i, j, *iter_step;
double *v, *x;
double c0, c;

v=(double *)malloc(sizeof(double)*n);
x=(double *)malloc(sizeof(double)*n);
iter_step=(int *)malloc(sizeof(int)*2);

/*
*X and V are k x n matrices in matlab, stored in column priority manner
*x corresponds a row of X
*/


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

for(j=0; j<n; j++)
v[j]=V[i + j*k];

epp(x, &c, iter_step, v, n, rho, p, c0);
c0=c;

for(j=0; j<n; j++)
X[i + j*k]=x[j];
}

free(v);
free(x);
free(iter_step);
}
#endif /* ----- #ifndef EPPMATRIX_SLEP ----- */
void eppMatrix(double *X, double * V, int k, int n, double rho, double p);
#endif /* ----- #ifndef EPPMATRIXQ1_SLEP ----- */

0 comments on commit 43fe9aa

Please sign in to comment.