25 #ifndef __QR_DISTRIBUTED_H__
26 #define __QR_DISTRIBUTED_H__
28 #include "algorithms/algorithm.h"
29 #include "data_management/data/numeric_table.h"
30 #include "services/daal_defines.h"
31 #include "algorithms/qr/qr_types.h"
32 #include "algorithms/qr/qr_online.h"
57 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
58 class DistributedContainer
69 template<
typename algorithmFPType, Method method, CpuType cpu>
70 class DistributedContainer<step2Master, algorithmFPType, method, cpu> :
71 public daal::algorithms::AnalysisContainerIface<distributed>
79 DistributedContainer(daal::services::Environment::env *daalEnv);
81 virtual ~DistributedContainer();
86 virtual services::Status compute() DAAL_C11_OVERRIDE;
91 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
102 template<
typename algorithmFPType, Method method, CpuType cpu>
103 class DistributedContainer<step3Local, algorithmFPType, method, cpu> :
104 public daal::algorithms::AnalysisContainerIface<distributed>
112 DistributedContainer(daal::services::Environment::env *daalEnv);
114 virtual ~DistributedContainer();
119 virtual services::Status compute() DAAL_C11_OVERRIDE;
124 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
139 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
140 class DAAL_EXPORT Distributed :
public daal::algorithms::Analysis<distributed> {};
153 template<
typename algorithmFPType, Method method>
154 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
157 typedef Online<algorithmFPType, method> super;
159 typedef typename super::InputType InputType;
160 typedef typename super::ParameterType ParameterType;
161 typedef typename super::ResultType ResultType;
162 typedef typename super::PartialResultType PartialResultType;
164 Distributed() : Online<algorithmFPType, method>() {}
172 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) :
173 Online<algorithmFPType, method>(other)
181 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
183 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
187 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
189 return new Distributed<step1Local, algorithmFPType, method>(*this);
204 template<
typename algorithmFPType, Method method>
205 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public daal::algorithms::Analysis<distributed>
208 typedef DistributedStep2Input Input;
210 typedef algorithms::qr::DistributedStep2Input InputType;
211 typedef algorithms::qr::Parameter ParameterType;
212 typedef algorithms::qr::Result ResultType;
213 typedef algorithms::qr::DistributedPartialResult PartialResultType;
216 ParameterType parameter;
229 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
238 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
244 ResultPtr getResult()
246 return _partialResult->get(finalResultFromStep2Master);
253 DistributedPartialResultPtr getPartialResult()
255 return _partialResult;
262 services::Status setPartialResult(
const DistributedPartialResultPtr& partialRes)
264 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
265 DAAL_CHECK(partialRes->get(finalResultFromStep2Master), services::ErrorNullResult)
266 _partialResult = partialRes;
267 _pres = _partialResult.get();
268 return services::Status();
274 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
278 return _partialResult->check(_par, method);
282 return services::Status(services::ErrorNullResult);
284 return services::Status();
292 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
294 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
298 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
300 return new Distributed<step2Master, algorithmFPType, method>(*this);
303 virtual services::Status allocateResult() DAAL_C11_OVERRIDE {
return services::Status(); }
305 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
307 _partialResult.reset(
new PartialResultType());
308 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
309 _pres = _partialResult.get();
313 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
315 _pres = _partialResult.get();
316 return services::Status();
321 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
327 DistributedPartialResultPtr _partialResult;
341 template<
typename algorithmFPType, Method method>
342 class DAAL_EXPORT Distributed<step3Local, algorithmFPType, method> :
public
343 daal::algorithms::Analysis<distributed>
346 typedef DistributedStep3Input Input;
348 typedef algorithms::qr::DistributedStep3Input InputType;
349 typedef algorithms::qr::Parameter ParameterType;
350 typedef algorithms::qr::Result ResultType;
351 typedef algorithms::qr::DistributedPartialResultStep3 PartialResultType;
354 ParameterType parameter;
368 Distributed(
const Distributed<step3Local, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
377 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
383 ResultPtr getResult()
385 return _partialResult->get(finalResultFromStep3);
392 DistributedPartialResultStep3Ptr getPartialResult()
394 return _partialResult;
401 services::Status setPartialResult(
const DistributedPartialResultStep3Ptr& partialRes)
403 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
404 DAAL_CHECK(partialRes->get(finalResultFromStep3), services::ErrorNullResult)
405 _partialResult = partialRes;
406 _pres = _partialResult.get();
407 return services::Status();
414 services::Status setResult(
const ResultPtr& res) {
return services::Status();}
419 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
423 return _partialResult->check(_par, method);
427 return services::Status(services::ErrorNullResult);
429 return services::Status();
437 services::SharedPtr<Distributed<step3Local, algorithmFPType, method> > clone()
const
439 return services::SharedPtr<Distributed<step3Local, algorithmFPType, method> >(cloneImpl());
443 virtual Distributed<step3Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
445 return new Distributed<step3Local, algorithmFPType, method>(*this);
448 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
450 _partialResult.reset(
new PartialResultType());
452 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
455 data_management::DataCollectionPtr qCollection = input.get(inputOfStep3FromStep1);
457 s = _partialResult->setPartialResultStorage<algorithmFPType>(qCollection.get());
459 _pres = _partialResult.get();
463 virtual services::Status allocateResult() DAAL_C11_OVERRIDE {
return services::Status(); }
465 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE {
return services::Status(); }
469 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step3Local, algorithmFPType, method)(&_env);
475 DistributedPartialResultStep3Ptr _partialResult;
479 using interface1::DistributedContainer;
480 using interface1::Distributed;
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: qr_distributed.h:216
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultStep3Ptr &partialRes)
Definition: qr_distributed.h:401
daal::step1Local
Definition: daal_defines.h:123
daal::algorithms::qr::interface1::Distributed
Computes the results of the QR decomposition algorithm in the distributed processing mode...
Definition: qr_distributed.h:140
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >
Computes the results of the QR decomposition algorithm on the third step in the distributed processin...
Definition: qr_distributed.h:342
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_distributed.h:238
daal::algorithms::qr::finalResultFromStep3
Definition: qr_types.h:124
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::parameter
ParameterType parameter
Definition: qr_distributed.h:354
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:292
daal::step2Master
Definition: daal_defines.h:124
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultPtr &partialRes)
Definition: qr_distributed.h:262
daal::algorithms::qr::interface1::DistributedContainer
Provides methods to run implementations of the QR decomposition algorithm.
Definition: qr_distributed.h:58
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::input
InputType input
Definition: qr_distributed.h:215
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: qr_distributed.h:244
daal::algorithms::qr::interface1::DistributedStep2Input
Input objects for the second step of the QR decomposition algorithm in the distributed processing mod...
Definition: qr_types.h:204
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: qr_distributed.h:414
daal::step3Local
Definition: daal_defines.h:125
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: qr_distributed.h:274
daal::algorithms::kmeans::init::interface2::Distributed
class DAAL_EXPORT Distributed
Computes initial clusters for K-Means algorithm in the distributed processing mode.
Definition: kmeans_init_distributed.h:277
daal::algorithms::qr::interface1::DistributedStep3Input
Input objects for the third step of the QR decomposition algorithm in the distributed processing mode...
Definition: qr_types.h:259
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step3Local, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:437
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::Distributed
Distributed()
Definition: qr_distributed.h:357
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: qr_distributed.h:419
daal::algorithms::qr::interface1::Online
Computes the results of the QR decomposition algorithm in the online processing mode.
Definition: qr_online.h:89
daal::algorithms::qr::finalResultFromStep2Master
Definition: qr_types.h:114
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getPartialResult
DistributedPartialResultStep3Ptr getPartialResult()
Definition: qr_distributed.h:392
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:181
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: qr_distributed.h:383
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step3Local, algorithmFPType, method > &other)
Definition: qr_distributed.h:368
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
DistributedPartialResultPtr getPartialResult()
Definition: qr_distributed.h:253
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >
Computes the result of the first step of the QR decomposition algorithm in the distributed processing...
Definition: qr_distributed.h:154
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: qr_distributed.h:229
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: qr_distributed.h:172
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:107
daal::distributed
Definition: daal_defines.h:113
daal::algorithms::qr::inputOfStep3FromStep1
Definition: qr_types.h:145
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >
Computes the results of the QR decomposition algorithm on the second step in the distributed processi...
Definition: qr_distributed.h:205
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_distributed.h:377
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::input
InputType input
Definition: qr_distributed.h:353