-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
GNPPLib.h
122 lines (108 loc) · 3.62 KB
/
GNPPLib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*-----------------------------------------------------------------------
*
* 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.
*
* Library of solvers for Generalized Nearest Point Problem (GNPP).
*
* Written (W) 1999-2008 Vojtech Franc, xfrancv@cmp.felk.cvut.cz
* Copyright (C) 1999-2008 Center for Machine Perception, CTU FEL Prague
*
-------------------------------------------------------------------- */
#ifndef GNPPLIB_H__
#define GNPPLIB_H__
#include <shogun/lib/config.h>
#include <math.h>
#include <limits.h>
#include <shogun/base/SGObject.h>
#include <shogun/io/SGIO.h>
#include <shogun/lib/common.h>
#include <shogun/kernel/Kernel.h>
namespace shogun
{
/** @brief class GNPPLib, a Library of solvers for Generalized Nearest Point
* Problem (GNPP).
*/
class CGNPPLib: public CSGObject
{
public:
/** default constructor */
CGNPPLib();
/** constructor
*
* @param vector_y vector y
* @param kernel kernel
* @param num_data number of data
* @param reg_const reg const
*/
CGNPPLib(float64_t* vector_y, CKernel* kernel, int32_t num_data, float64_t reg_const);
virtual ~CGNPPLib();
/** --------------------------------------------------------------
QP solver based on MDM algorithm.
Usage: exitflag = gnpp_mdm(diag_H, vector_c, vector_y,
dim, tmax, tolabs, tolrel, th, &alpha, &t, &aHa11, &aHa22, &History );
-------------------------------------------------------------- */
int8_t gnpp_mdm(float64_t *diag_H,
float64_t *vector_c,
float64_t *vector_y,
int32_t dim,
int32_t tmax,
float64_t tolabs,
float64_t tolrel,
float64_t th,
float64_t *alpha,
int32_t *ptr_t,
float64_t *ptr_aHa11,
float64_t *ptr_aHa22,
float64_t **ptr_History,
int32_t verb);
/** --------------------------------------------------------------
QP solver based on improved MDM algorithm (u fixed v optimized)
Usage: exitflag = gnpp_imdm( diag_H, vector_c, vector_y,
dim, tmax, tolabs, tolrel, th, &alpha, &t, &aHa11, &aHa22, &History );
-------------------------------------------------------------- */
int8_t gnpp_imdm(float64_t *diag_H,
float64_t *vector_c,
float64_t *vector_y,
int32_t dim,
int32_t tmax,
float64_t tolabs,
float64_t tolrel,
float64_t th,
float64_t *alpha,
int32_t *ptr_t,
float64_t *ptr_aHa11,
float64_t *ptr_aHa22,
float64_t **ptr_History,
int32_t verb);
/** @return object name */
virtual const char* get_name() const { return "GNPPLib"; }
protected:
/** get col
*
* @param a a
* @param b b
* @return something floaty
*/
float64_t* get_col(int64_t a, int64_t b);
/** kernel columns */
float64_t** kernel_columns;
/** cache index */
float64_t* cache_index;
/** first kernel inx */
int32_t first_kernel_inx;
/** cache size */
int64_t Cache_Size;
/** num data */
int32_t m_num_data;
/** reg const */
float64_t m_reg_const;
/** vector y */
float64_t* m_vector_y;
/** kernel */
CKernel* m_kernel;
};
}
#endif // GNPPLIB_H__