SHOGUN
v2.0.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Copyright (C) 2012 Soeren Sonnenburg 00008 */ 00009 00010 #ifndef _DIRECTORDOTFEATURES_H___ 00011 #define _DIRECTORDOTFEATURES_H___ 00012 00013 #include <shogun/lib/config.h> 00014 00015 #ifdef USE_SWIG_DIRECTORS 00016 #include <shogun/lib/common.h> 00017 #include <shogun/features/Features.h> 00018 #include <shogun/features/DotFeatures.h> 00019 00020 namespace shogun 00021 { 00024 #define IGNORE_IN_CLASSLIST 00025 IGNORE_IN_CLASSLIST class CDirectorDotFeatures : public CDotFeatures 00026 { 00027 public: 00028 00033 CDirectorDotFeatures(int32_t size=0) : CDotFeatures(size) 00034 { 00035 } 00036 00037 virtual ~CDirectorDotFeatures() { } 00038 00045 virtual int32_t get_num_vectors() const 00046 { 00047 SG_NOTIMPLEMENTED; 00048 return 0; 00049 } 00050 00051 00059 virtual int32_t get_dim_feature_space() const 00060 { 00061 SG_NOTIMPLEMENTED; 00062 return 0; 00063 } 00064 00072 virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df, int32_t vec_idx2) 00073 { 00074 SG_NOTIMPLEMENTED; 00075 return 0; 00076 } 00077 00083 virtual float64_t dense_dot_sgvec(int32_t vec_idx1, const SGVector<float64_t> vec2) 00084 { 00085 SG_NOTIMPLEMENTED; 00086 return 0; 00087 } 00088 00097 virtual void add_to_dense_sgvec(float64_t alpha, int32_t vec_idx1, SGVector<float64_t> vec2, bool abs_val=false) 00098 { 00099 SG_NOTIMPLEMENTED; 00100 } 00101 00108 virtual float64_t dense_dot(int32_t vec_idx1, const float64_t* vec2, int32_t vec2_len) 00109 { 00110 return dense_dot_sgvec(vec_idx1, SGVector<float64_t>((float64_t*) vec2, vec2_len, false)); 00111 } 00112 00121 virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t* vec2, int32_t vec2_len, bool abs_val=false) 00122 { 00123 add_to_dense_sgvec(alpha, vec_idx1, SGVector<float64_t>(vec2, vec2_len, false), abs_val); 00124 } 00125 00139 virtual void dense_dot_range(float64_t* output, int32_t start, int32_t stop, float64_t* alphas, float64_t* vec, int32_t dim, float64_t b) 00140 { 00141 CDotFeatures::dense_dot_range(output, start, stop, alphas, vec, dim, b); 00142 } 00143 00155 virtual void dense_dot_range_subset(int32_t* sub_index, int32_t num, 00156 float64_t* output, float64_t* alphas, float64_t* vec, int32_t dim, float64_t b) 00157 { 00158 CDotFeatures::dense_dot_range_subset(sub_index, num, output, alphas, vec, dim, b); 00159 } 00160 00168 virtual int32_t get_nnz_features_for_vector(int32_t num) 00169 { 00170 SG_NOTIMPLEMENTED; 00171 return 0; 00172 } 00173 00183 virtual void* get_feature_iterator(int32_t vector_index) 00184 { 00185 SG_NOTIMPLEMENTED; 00186 return NULL; 00187 } 00188 00199 virtual bool get_next_feature(int32_t& index, float64_t& value, void* iterator) 00200 { 00201 SG_NOTIMPLEMENTED; 00202 return false; 00203 } 00204 00210 virtual void free_feature_iterator(void* iterator) 00211 { 00212 SG_NOTIMPLEMENTED; 00213 } 00214 00219 virtual SGVector<float64_t> get_mean() 00220 { 00221 return CDotFeatures::get_mean(); 00222 } 00223 00228 virtual SGMatrix<float64_t> get_cov() 00229 { 00230 return CDotFeatures::get_cov(); 00231 } 00232 00239 virtual EFeatureType get_feature_type() const 00240 { 00241 return F_ANY; 00242 } 00243 00250 virtual CFeatures* duplicate() const 00251 { 00252 SG_NOTIMPLEMENTED; 00253 return NULL; 00254 } 00255 00262 virtual EFeatureClass get_feature_class() const 00263 { 00264 return C_DIRECTOR_DOT; 00265 } 00266 00272 virtual int32_t add_preprocessor(CPreprocessor* p) 00273 { 00274 return CFeatures::add_preprocessor(p); 00275 } 00276 00282 virtual CPreprocessor* del_preprocessor(int32_t num) 00283 { 00284 return CFeatures::del_preprocessor(num); 00285 } 00286 00295 virtual bool reshape(int32_t num_features, int32_t num_vectors) 00296 { 00297 SG_NOTIMPLEMENTED; 00298 return false; 00299 } 00300 00307 virtual int32_t get_size() const 00308 { 00309 SG_NOTIMPLEMENTED; 00310 return 0; 00311 } 00312 00317 virtual void load(CFile* loader) 00318 { 00319 CFeatures::load(loader); 00320 } 00321 00326 virtual void save(CFile* writer) 00327 { 00328 CFeatures::save(writer); 00329 } 00330 00336 virtual void add_subset(SGVector<index_t> subset) 00337 { 00338 CFeatures::add_subset(subset); 00339 } 00340 00343 virtual void remove_subset() 00344 { 00345 CFeatures::remove_subset(); 00346 } 00347 00350 virtual void remove_all_subsets() 00351 { 00352 CFeatures::remove_all_subsets(); 00353 } 00354 00356 virtual void subset_changed_post() 00357 { 00358 CFeatures::subset_changed_post(); 00359 } 00360 00370 virtual CFeatures* copy_subset(SGVector<index_t> indices) 00371 { 00372 return CFeatures::copy_subset(indices); 00373 } 00374 00376 inline virtual const char* get_name() const { return "DirectorDotFeatures"; } 00377 }; 00378 } 00379 #endif // USE_SWIG_DIRECTORS 00380 #endif // _DIRECTORDOTFEATURES_H___