23 #ifndef __LOW_ORDER_MOMENTS_DISTRIBUTED_H__
24 #define __LOW_ORDER_MOMENTS_DISTRIBUTED_H__
26 #include "algorithms/algorithm.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/moments/low_order_moments_types.h"
34 namespace low_order_moments
54 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
55 class DAAL_EXPORT DistributedContainer
67 template<
typename algorithmFPType, Method method, CpuType cpu>
68 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, method, cpu> :
69 public daal::algorithms::AnalysisContainerIface<distributed>
77 DistributedContainer(daal::services::Environment::env *daalEnv);
79 virtual ~DistributedContainer();
84 virtual services::Status compute() DAAL_C11_OVERRIDE;
89 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
112 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
113 class DAAL_EXPORT Distributed{};
130 template<
typename algorithmFPType, Method method>
131 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
134 typedef Online<algorithmFPType, method> super;
136 typedef typename super::InputType InputType;
137 typedef typename super::ParameterType ParameterType;
138 typedef typename super::ResultType ResultType;
139 typedef typename super::PartialResultType PartialResultType;
151 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) : Online<algorithmFPType, method>(other)
159 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
161 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
165 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
167 return new Distributed<step1Local, algorithmFPType, method>(*this);
186 template<
typename algorithmFPType, Method method>
187 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public daal::algorithms::Analysis<distributed>
190 typedef algorithms::low_order_moments::DistributedInput<step2Master> InputType;
191 typedef algorithms::low_order_moments::Parameter ParameterType;
192 typedef algorithms::low_order_moments::Result ResultType;
193 typedef algorithms::low_order_moments::PartialResult PartialResultType;
195 DistributedInput<step2Master> input;
196 ParameterType parameter;
210 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
219 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
225 ResultPtr getResult()
234 services::Status setResult(
const ResultPtr &result)
236 DAAL_CHECK(result, services::ErrorNullResult)
238 _res = _result.get();
239 return services::Status();
246 PartialResultPtr getPartialResult()
248 return _partialResult;
256 services::Status setPartialResult(
const PartialResultPtr &partialResult,
bool initFlag =
false)
258 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
259 _partialResult = partialResult;
260 _pres = _partialResult.get();
261 setInitFlag(initFlag);
262 return services::Status();
270 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
272 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
276 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
278 return new Distributed<step2Master, algorithmFPType, method>(*this);
281 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
283 services::Status s = _result->allocate<algorithmFPType>(_pres, 0, 0);
284 _res = _result.get();
288 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
290 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
291 _pres = _partialResult.get();
295 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
297 return services::Status();
302 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
305 _result.reset(
new ResultType());
306 _partialResult.reset(
new PartialResultType());
310 PartialResultPtr _partialResult;
315 using interface1::DistributedInput;
316 using interface1::DistributedContainer;
317 using interface1::Distributed;
daal
Definition: algorithm_base_common.h:31
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: low_order_moments_distributed.h:196
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >
Computes the result of the second step of the moments of low order algorithm in the distributed proce...
Definition: low_order_moments_distributed.h:187
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: low_order_moments_distributed.h:270
daal::algorithms::low_order_moments::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: low_order_moments_distributed.h:151
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:105
daal::algorithms::low_order_moments::interface1::Online
Computes moments of low order in the online processing mode.
Definition: low_order_moments_online.h:92
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: low_order_moments_distributed.h:219
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &result)
Definition: low_order_moments_distributed.h:234
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed()
Definition: low_order_moments_distributed.h:199
daal::algorithms::kmeans::init::interface1::Distributed
class DAAL_EXPORT Distributed
Computes initial clusters for the K-Means algorithm in the distributed processing mode...
Definition: kmeans_init_distributed.h:255
daal::distributed
Definition: daal_defines.h:107
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::input
DistributedInput< step2Master > input
Definition: low_order_moments_distributed.h:195
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: low_order_moments_distributed.h:246
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: low_order_moments_distributed.h:210
daal::algorithms::low_order_moments::interface1::DistributedContainer
Provides methods to run implementations of the low order moments algorithm in the distributed process...
Definition: low_order_moments_distributed.h:55
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: low_order_moments_distributed.h:225
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::low_order_moments::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: low_order_moments_distributed.h:159
daal::algorithms::low_order_moments::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag=false)
Definition: low_order_moments_distributed.h:256
daal::algorithms::kmeans::interface1::DistributedContainer
class DAAL_EXPORT DistributedContainer
Provides methods to run implementations of the K-Means algorithm. This class is associated with the d...
Definition: kmeans_distributed.h:55
daal::step1Local
Definition: daal_defines.h:117
daal::algorithms::low_order_moments::interface1::Distributed
Computes moments of low order in the distributed processing mode.
Definition: low_order_moments_distributed.h:113
daal::step2Master
Definition: daal_defines.h:118
daal::algorithms::low_order_moments::interface1::Distributed< step1Local, algorithmFPType, method >
Computes the result of the first step of the moments of low order algorithm in the distributed proces...
Definition: low_order_moments_distributed.h:131
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::low_order_moments::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed()
Definition: low_order_moments_distributed.h:142