eppMatrix.cpp

Go to the documentation of this file.
00001 /*   This program is free software: you can redistribute it and/or modify
00002  *   it under the terms of the GNU General Public License as published by
00003  *   the Free Software Foundation, either version 3 of the License, or
00004  *   (at your option) any later version.
00005  *
00006  *   This program is distributed in the hope that it will be useful,
00007  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00008  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009  *   GNU General Public License for more details.
00010  *
00011  *   You should have received a copy of the GNU General Public License
00012  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00013  *
00014  *   Copyright (C) 2009 - 2012 Jun Liu and Jieping Ye 
00015  */
00016 
00017 #include <stdlib.h>
00018 #include <stdio.h>
00019 #include <time.h>
00020 #include <math.h>
00021 #include <shogun/lib/slep/q1/eppMatrix.h>
00022 
00023 void eppMatrix(double *X, double * V, int k, int n, double rho, double p)
00024 {
00025     int i, j, *iter_step;
00026     double *v, *x;
00027     double c0, c;
00028     
00029     v=(double *)malloc(sizeof(double)*n);
00030     x=(double *)malloc(sizeof(double)*n);
00031     iter_step=(int *)malloc(sizeof(int)*2);
00032     
00033     /*
00034      *X and V are k x n matrices in matlab, stored in column priority manner
00035      *x corresponds a row of X
00036      */
00037     
00038             
00039     c0=0;
00040     for(i=0; i<k; i++){
00041        
00042         for(j=0; j<n; j++)
00043             v[j]=V[i + j*k];
00044         
00045         epp(x, &c, iter_step, v, n, rho, p, c0);
00046         c0=c;
00047     
00048         for(j=0; j<n; j++)
00049             X[i + j*k]=x[j];
00050     }
00051     
00052     free(v);
00053     free(x);
00054     free(iter_step);    
00055 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation