SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LinearOperator.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 
00010 #ifndef LINEAR_OPERATOR_H_
00011 #define LINEAR_OPERATOR_H_
00012 
00013 #include <shogun/lib/config.h>
00014 #include <shogun/base/SGObject.h>
00015 #include <shogun/base/Parameter.h>
00016 
00017 namespace shogun
00018 {
00019 template<class T> class SGVector;
00020 
00024 template<class T> class CLinearOperator : public CSGObject
00025 {
00026 public:
00028     CLinearOperator()
00029     : CSGObject()
00030     {
00031         init();
00032 
00033         SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
00034     }
00035 
00041     CLinearOperator(index_t dimension)
00042     : CSGObject()
00043     {
00044         init();
00045 
00046         m_dimension=dimension;
00047 
00048         SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
00049     }
00050 
00052     virtual ~CLinearOperator()
00053     {
00054         SG_GCDEBUG("%s destroyed (%p)\n", this->get_name(), this)
00055     }
00056 
00058     const index_t get_dimension() const
00059     {
00060         return m_dimension;
00061     }
00062 
00069     virtual SGVector<T> apply(SGVector<T> b) const = 0;
00070 
00072     virtual const char* get_name() const
00073     {
00074         return "LinearOperator";
00075     }
00076 protected:
00078     index_t m_dimension;
00079 
00080 private:
00082     void init()
00083     {
00084         m_dimension=0;
00085 
00086         SG_ADD(&m_dimension, "dimension",
00087             "Dimension of the vector on which linear operator can apply",
00088             MS_NOT_AVAILABLE);
00089     }
00090 
00091 };
00092 }
00093 
00094 #endif // LINEAR_OPERATOR_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation