SHOGUN
v3.2.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 00271 virtual void add_preprocessor(CPreprocessor* p) 00272 { 00273 CFeatures::add_preprocessor(p); 00274 } 00275 00281 virtual void del_preprocessor(int32_t num) 00282 { 00283 CFeatures::del_preprocessor(num); 00284 } 00285 00294 virtual bool reshape(int32_t num_features, int32_t num_vectors) 00295 { 00296 SG_NOTIMPLEMENTED 00297 return false; 00298 } 00299 00304 virtual void load(CFile* loader) 00305 { 00306 CFeatures::load(loader); 00307 } 00308 00313 virtual void save(CFile* writer) 00314 { 00315 CFeatures::save(writer); 00316 } 00317 00323 virtual void add_subset(SGVector<index_t> subset) 00324 { 00325 CFeatures::add_subset(subset); 00326 } 00327 00330 virtual void remove_subset() 00331 { 00332 CFeatures::remove_subset(); 00333 } 00334 00337 virtual void remove_all_subsets() 00338 { 00339 CFeatures::remove_all_subsets(); 00340 } 00341 00343 virtual void subset_changed_post() 00344 { 00345 CFeatures::subset_changed_post(); 00346 } 00347 00357 virtual CFeatures* copy_subset(SGVector<index_t> indices) 00358 { 00359 return CFeatures::copy_subset(indices); 00360 } 00361 00363 virtual const char* get_name() const { return "DirectorDotFeatures"; } 00364 }; 00365 } 00366 #endif // USE_SWIG_DIRECTORS 00367 #endif // _DIRECTORDOTFEATURES_H___