SHOGUN
v1.1.0
|
00001 /*----------------------------------------------------------------------- 00002 * 00003 * This program is free software; you can redistribute it and/or modify 00004 * it under the terms of the GNU General Public License as published by 00005 * the Free Software Foundation; either version 3 of the License, or 00006 * (at your option) any later version. 00007 * 00008 * Library of solvers for Generalized Nearest Point Problem (GNPP). 00009 * 00010 * Written (W) 1999-2008 Vojtech Franc, xfrancv@cmp.felk.cvut.cz 00011 * Copyright (C) 1999-2008 Center for Machine Perception, CTU FEL Prague 00012 * 00013 -------------------------------------------------------------------- */ 00014 00015 #ifndef GMNPLIB_H__ 00016 #define GMNPLIB_H__ 00017 00018 #include <math.h> 00019 #include <limits.h> 00020 00021 #include <shogun/base/SGObject.h> 00022 #include <shogun/io/SGIO.h> 00023 #include <shogun/lib/common.h> 00024 #include <shogun/kernel/Kernel.h> 00025 00026 namespace shogun 00027 { 00066 class CGMNPLib: public CSGObject 00067 { 00068 public: 00070 CGMNPLib(); 00071 00081 CGMNPLib( 00082 float64_t* vector_y, CKernel* kernel, int32_t num_data, 00083 int32_t num_virtual_data, int32_t num_classes, float64_t reg_const); 00084 00085 virtual ~CGMNPLib(); 00086 00096 int8_t gmnp_imdm(float64_t *vector_c, 00097 int32_t dim, 00098 int32_t tmax, 00099 float64_t tolabs, 00100 float64_t tolrel, 00101 float64_t th, 00102 float64_t *alpha, 00103 int32_t *ptr_t, 00104 float64_t **ptr_History, 00105 int32_t verb); 00106 00113 void get_indices2( int32_t *index, int32_t *c, int32_t i ); 00114 00115 protected: 00121 float64_t *get_kernel_col( int32_t a ); 00122 00129 float64_t* get_col( int32_t a, int32_t b ); 00130 00137 float64_t kernel_fce( int32_t a, int32_t b ); 00138 00140 inline virtual const char* get_name() const { return "GMNPLib"; } 00141 00142 protected: 00144 float64_t* diag_H; 00146 float64_t** kernel_columns; 00148 float64_t* cache_index; 00150 int32_t first_kernel_inx; 00152 int64_t Cache_Size; 00154 int32_t m_num_data; 00156 float64_t m_reg_const; 00158 float64_t* m_vector_y; 00160 CKernel* m_kernel; 00161 00163 int32_t first_virt_inx; 00165 float64_t *virt_columns[3]; 00167 int32_t m_num_virt_data; 00169 int32_t m_num_classes; 00170 }; 00171 } 00172 #endif //GMNPLIB_H__