SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TraceSampler.h
Go to the documentation of this file.
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  * Written (W) 2013 Soumyajit De
00008  */
00009 #ifndef TRACE_SAMPLER_H_
00010 #define TRACE_SAMPLER_H_
00011 
00012 #include <shogun/lib/config.h>
00013 #include <shogun/base/SGObject.h>
00014 #include <shogun/base/Parameter.h>
00015 
00016 namespace shogun
00017 {
00018 template<class T> class SGVector;
00019 
00023 class CTraceSampler : public CSGObject
00024 {
00025 public:
00027     CTraceSampler()
00028     : CSGObject()
00029     {
00030         init();
00031 
00032         SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
00033     }
00034 
00040     CTraceSampler(index_t dimension)
00041     : CSGObject()
00042     {
00043         init();
00044 
00045         m_dimension=dimension;
00046 
00047         SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
00048     }
00049 
00051     virtual ~CTraceSampler()
00052     {
00053         SG_GCDEBUG("%s destroyed (%p)\n", this->get_name(), this)
00054     }
00055 
00062     virtual SGVector<float64_t> sample(index_t idx) const = 0;
00063 
00068     virtual void precompute() = 0;
00069 
00071     virtual const index_t get_num_samples() const
00072     {
00073         return m_num_samples;
00074     }
00075 
00077     virtual const index_t get_dimension() const
00078     {
00079         return m_dimension;
00080     }
00081 
00083     virtual const char* get_name() const
00084     {
00085         return "TraceSampler";
00086     }
00087 
00088 protected:
00090     index_t m_dimension;
00091 
00093     index_t m_num_samples;
00094 
00095 private:
00097     void init()
00098     {
00099         m_num_samples=0;
00100         m_dimension=0;
00101 
00102         SG_ADD(&m_num_samples, "num_samples",
00103             "Number of samples this sampler can generate", MS_NOT_AVAILABLE);
00104 
00105         SG_ADD(&m_dimension, "sample_dimension",
00106             "Dimension of samples this sampler can generate", MS_NOT_AVAILABLE);
00107     }
00108 };
00109 
00110 }
00111 
00112 #endif // TRACE_SAMPLER_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation