SHOGUN
v3.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
lib
computation
aggregator
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
>
12
#include <
shogun/lib/computation/jobresult/VectorResult.h
>
13
#include <
shogun/lib/computation/aggregator/StoreVectorAggregator.h
>
14
#include <
shogun/base/Parameter.h
>
15
16
namespace
shogun
17
{
18
template
<
class
T>
19
CStoreVectorAggregator<T>::CStoreVectorAggregator
()
20
:
CJobResultAggregator
()
21
{
22
init();
23
SG_GCDEBUG
(
"%s created (%p)\n"
, this->
get_name
(),
this
)
24
}
25
26
template
<
class
T>
27
CStoreVectorAggregator<T>::CStoreVectorAggregator
(
index_t
dimension)
28
:
CJobResultAggregator
()
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>
37
void
CStoreVectorAggregator<T>::init
()
38
{
39
SG_ADD
(&m_aggregate,
"current_aggregate"
,
40
"Aggregation of computation job results"
,
MS_NOT_AVAILABLE
);
41
}
42
43
template
<
class
T>
44
CStoreVectorAggregator<T>::~CStoreVectorAggregator
()
45
{
46
}
47
48
template
<
class
T>
49
void
CStoreVectorAggregator<T>::submit_result
(
CJobResult
* result)
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
<>
64
void
CStoreVectorAggregator<bool>::submit_result
(
CJobResult
* result)
65
{
66
SG_NOTIMPLEMENTED
67
}
68
69
template
<>
70
void
CStoreVectorAggregator<char>::submit_result
(
CJobResult
* result)
71
{
72
SG_NOTIMPLEMENTED
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>
;
80
template
class
CStoreVectorAggregator<uint16_t>
;
81
template
class
CStoreVectorAggregator<int32_t>
;
82
template
class
CStoreVectorAggregator<uint32_t>
;
83
template
class
CStoreVectorAggregator<int64_t>
;
84
template
class
CStoreVectorAggregator<uint64_t>
;
85
template
class
CStoreVectorAggregator<float32_t>
;
86
template
class
CStoreVectorAggregator<float64_t>
;
87
template
class
CStoreVectorAggregator<floatmax_t>
;
88
template
class
CStoreVectorAggregator<complex128_t>
;
89
}
SHOGUN
Machine Learning Toolbox - Documentation