SHOGUN  v3.0.0
 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 }

SHOGUN Machine Learning Toolbox - Documentation