SHOGUN  3.2.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/SGVector.h>
14 
15 namespace shogun
16 {
17 template<class T>
20  {
21  init();
22  SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
23  }
24 
25 template<class T>
28  {
29  init();
30 
31  m_aggregate=SGVector<T>(dimension);
32  m_aggregate.set_const(static_cast<T>(0));
33  }
34 
35 template<class T>
37  {
38  SG_ADD(&m_aggregate, "current_aggregate",
39  "Aggregation of computation job results", MS_NOT_AVAILABLE);
40  }
41 
42 template<class T>
44  {
45  }
46 
47 template<class T>
49  {
50  SG_GCDEBUG("Entering\n")
51 
52  // check for proper typecast
53  CVectorResult<T>* new_result=dynamic_cast<CVectorResult<T>*>(result);
54  if (!new_result)
55  SG_ERROR("result is not of CVectorResult type!\n");
56  // aggregate it with previous
57  m_aggregate+=new_result->get_result();
58 
59  SG_GCDEBUG("Leaving\n")
60  }
61 
62 template<>
64  {
66  }
67 
68 template<>
70  {
72  }
73 
74 template class CStoreVectorAggregator<bool>;
75 template class CStoreVectorAggregator<char>;
76 template class CStoreVectorAggregator<int8_t>;
77 template class CStoreVectorAggregator<uint8_t>;
78 template class CStoreVectorAggregator<int16_t>;
80 template class CStoreVectorAggregator<int32_t>;
82 template class CStoreVectorAggregator<int64_t>;
88 }

SHOGUN Machine Learning Toolbox - Documentation