SHOGUN  v3.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StoreVectorAggregator.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2013 Soumyajit De
8  */
9 
10 #include <shogun/lib/config.h>
11 #include <shogun/lib/SGVector.h>
14 #include <shogun/base/Parameter.h>
15 
16 namespace shogun
17 {
18 template<class T>
21  {
22  init();
23  SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
24  }
25 
26 template<class T>
29  {
30  init();
31 
32  m_aggregate=SGVector<T>(dimension);
33  m_aggregate.set_const(static_cast<T>(0));
34  }
35 
36 template<class T>
38  {
39  SG_ADD(&m_aggregate, "current_aggregate",
40  "Aggregation of computation job results", MS_NOT_AVAILABLE);
41  }
42 
43 template<class T>
45  {
46  }
47 
48 template<class T>
50  {
51  SG_GCDEBUG("Entering\n")
52 
53  // check for proper typecast
54  CVectorResult<T>* new_result=dynamic_cast<CVectorResult<T>*>(result);
55  if (!new_result)
56  SG_ERROR("result is not of CVectorResult type!\n");
57  // aggregate it with previous
58  m_aggregate+=new_result->get_result();
59 
60  SG_GCDEBUG("Leaving\n")
61  }
62 
63 template<>
65  {
67  }
68 
69 template<>
71  {
73  }
74 
75 template class CStoreVectorAggregator<bool>;
76 template class CStoreVectorAggregator<char>;
77 template class CStoreVectorAggregator<int8_t>;
78 template class CStoreVectorAggregator<uint8_t>;
79 template class CStoreVectorAggregator<int16_t>;
81 template class CStoreVectorAggregator<int32_t>;
83 template class CStoreVectorAggregator<int64_t>;
89 }
int32_t index_t
Definition: common.h:60
Abstract template class that aggregates vector job results in each submit_result call, finalize is abstract.
Base class that stores the result of an independent job.
Definition: JobResult.h:20
#define SG_ERROR(...)
Definition: SGIO.h:131
#define SG_NOTIMPLEMENTED
Definition: SGIO.h:141
virtual void submit_result(CJobResult *result)
SGVector< T > get_result() const
Definition: VectorResult.h:59
#define SG_GCDEBUG(...)
Definition: SGIO.h:104
Abstract base class that provides an interface for computing an aggeregation of the job results of in...
Base class that stores the result of an independent job when the result is a vector.
Definition: VectorResult.h:23
virtual const char * get_name() const
#define SG_ADD(...)
Definition: SGObject.h:83

SHOGUN Machine Learning Toolbox - Documentation