SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
lib
slep
q1
eppVector.h
浏览该文件的文档.
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
17
#ifndef EPPVECTOR_SLEP
18
#define EPPVECTOR_SLEP
19
20
#include <stdlib.h>
21
#include <stdio.h>
22
#include <time.h>
23
#include <math.h>
24
#include <
shogun/lib/slep/q1/epph.h
>
/* This is the head file that contains the implementation of the used functions*/
25
26
27
/*
28
Lp Norm Regularized Euclidean Projection
29
30
min 1/2 ||x- v||_2^2 + rho * ||x||_p
31
32
Usage (in Matlab):
33
[x, c, iter_step]=epp(v, n, rho, p, c0);
34
35
Usage in C:
36
epp(x, c, iter_step, v, n, rho, p, c0);
37
38
The function epp implements the following three functions
39
epp1(x, v, n, rho) for p=1
40
epp2(x, v, n, rho) for p=2
41
eppInf(x, c, iter_step, v, n, rho, c0) for p=inf
42
eppO(x, c, iter_step, v, n, rho, p) for other p
43
44
------------------------------------------------------------
45
46
Here, the input and output are of Vector form.
47
48
49
Written by Jun Liu, May 18th, 2009
50
For any problem, please contact: j.liu@asu.edu
51
52
*/
53
54
void
eppVector
(
double
*x,
double
* v,
int
* ind,
int
k,
int
n,
double
* rho,
double
rho_multiplier,
double
p){
55
int
i, *iter_step;
56
double
c0, c;
57
double
*px, *pv;
58
59
iter_step=(
int
*)malloc(
sizeof
(
int
)*2);
60
61
c0=0;
62
for
(i=0; i<k; i++)
63
{
64
px=x+(int)ind[i];
65
pv=v+(int)ind[i];
66
67
epp
(px, &c, iter_step, pv, (
int
)(ind[i+1]-ind[i]), rho[i]*rho_multiplier, p, c0);
68
}
69
70
free(iter_step);
71
}
72
#endif
/* ----- #ifndef EPPVECTOR_SLEP ----- */
73
SHOGUN
机器学习工具包 - 项目文档