SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
eppMatrix.cpp
Go to the documentation of this file.
1 /* This program is free software: you can redistribute it and/or modify
2  * it under the terms of the GNU General Public License as published by
3  * the Free Software Foundation, either version 3 of the License, or
4  * (at your option) any later version.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program. If not, see <http://www.gnu.org/licenses/>.
13  *
14  * Copyright (C) 2009 - 2012 Jun Liu and Jieping Ye
15  */
16 
18 #ifdef USE_GPL_SHOGUN
19 
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <time.h>
23 #include <math.h>
24 
25 void eppMatrix(double *X, double * V, int k, int n, double rho, double p)
26 {
27  int i, j, *iter_step;
28  double *v, *x;
29  double c0, c;
30 
31  v=(double *)malloc(sizeof(double)*n);
32  x=(double *)malloc(sizeof(double)*n);
33  iter_step=(int *)malloc(sizeof(int)*2);
34 
35  /*
36  *X and V are k x n matrices in matlab, stored in column priority manner
37  *x corresponds a row of X
38  */
39 
40 
41  c0=0;
42  for(i=0; i<k; i++){
43 
44  for(j=0; j<n; j++)
45  v[j]=V[i + j*k];
46 
47  epp(x, &c, iter_step, v, n, rho, p, c0);
48  c0=c;
49 
50  for(j=0; j<n; j++)
51  X[i + j*k]=x[j];
52  }
53 
54  free(v);
55  free(x);
56  free(iter_step);
57 };
58 
59 #endif //USE_GPL_SHOGUN

SHOGUN Machine Learning Toolbox - Documentation