49 #ifndef __QR_DISTRIBUTED_H__
50 #define __QR_DISTRIBUTED_H__
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "algorithms/qr/qr_types.h"
56 #include "algorithms/qr/qr_online.h"
81 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
82 class DAAL_EXPORT DistributedContainer
93 template<
typename algorithmFPType, Method method, CpuType cpu>
94 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, method, cpu> :
95 public daal::algorithms::AnalysisContainerIface<distributed>
103 DistributedContainer(daal::services::Environment::env *daalEnv);
105 virtual ~DistributedContainer();
110 virtual services::Status compute() DAAL_C11_OVERRIDE;
115 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
126 template<
typename algorithmFPType, Method method, CpuType cpu>
127 class DAAL_EXPORT DistributedContainer<step3Local, algorithmFPType, method, cpu> :
128 public daal::algorithms::AnalysisContainerIface<distributed>
136 DistributedContainer(daal::services::Environment::env *daalEnv);
138 virtual ~DistributedContainer();
143 virtual services::Status compute() DAAL_C11_OVERRIDE;
148 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
163 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
164 class DAAL_EXPORT Distributed :
public daal::algorithms::Analysis<distributed> {};
177 template<
typename algorithmFPType, Method method>
178 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
181 Distributed() : Online<algorithmFPType, method>() {}
189 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) :
190 Online<algorithmFPType, method>(other)
198 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
200 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
204 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
206 return new Distributed<step1Local, algorithmFPType, method>(*this);
221 template<
typename algorithmFPType, Method method>
222 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public daal::algorithms::Analysis<distributed>
225 typedef DistributedStep2Input Input;
241 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
250 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
256 ResultPtr getResult()
258 return _partialResult->get(finalResultFromStep2Master);
265 DistributedPartialResultPtr getPartialResult()
267 return _partialResult;
274 services::Status setPartialResult(
const DistributedPartialResultPtr& partialRes)
276 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
277 DAAL_CHECK(partialRes->get(finalResultFromStep2Master), services::ErrorNullResult)
278 _partialResult = partialRes;
279 _pres = _partialResult.get();
280 return services::Status();
286 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
290 return _partialResult->check(_par, method);
294 return services::Status(services::ErrorNullResult);
296 return services::Status();
304 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
306 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
310 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
312 return new Distributed<step2Master, algorithmFPType, method>(*this);
315 virtual services::Status allocateResult() DAAL_C11_OVERRIDE {
return services::Status(); }
317 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
319 _partialResult.reset(
new DistributedPartialResult());
320 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
321 _pres = _partialResult.get();
325 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
327 _pres = _partialResult.get();
328 return services::Status();
333 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
339 DistributedPartialResultPtr _partialResult;
353 template<
typename algorithmFPType, Method method>
354 class DAAL_EXPORT Distributed<step3Local, algorithmFPType, method> :
public
355 daal::algorithms::Analysis<distributed>
358 typedef DistributedStep3Input Input;
375 Distributed(
const Distributed<step3Local, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
384 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
390 ResultPtr getResult()
392 return _partialResult->get(finalResultFromStep3);
399 DistributedPartialResultStep3Ptr getPartialResult()
401 return _partialResult;
408 services::Status setPartialResult(
const DistributedPartialResultStep3Ptr& partialRes)
410 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
411 DAAL_CHECK(partialRes->get(finalResultFromStep3), services::ErrorNullResult)
412 _partialResult = partialRes;
413 _pres = _partialResult.get();
414 return services::Status();
421 services::Status setResult(
const ResultPtr& res) {
return services::Status();}
426 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
430 return _partialResult->check(_par, method);
434 return services::Status(services::ErrorNullResult);
436 return services::Status();
444 services::SharedPtr<Distributed<step3Local, algorithmFPType, method> > clone()
const
446 return services::SharedPtr<Distributed<step3Local, algorithmFPType, method> >(cloneImpl());
450 virtual Distributed<step3Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
452 return new Distributed<step3Local, algorithmFPType, method>(*this);
455 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
457 _partialResult.reset(
new DistributedPartialResultStep3());
459 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
462 data_management::DataCollectionPtr qCollection = input.get(inputOfStep3FromStep1);
464 s = _partialResult->setPartialResultStorage<algorithmFPType>(qCollection.get());
466 _pres = _partialResult.get();
470 virtual services::Status allocateResult() DAAL_C11_OVERRIDE {
return services::Status(); }
472 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE {
return services::Status(); }
476 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step3Local, algorithmFPType, method)(&_env);
482 DistributedPartialResultStep3Ptr _partialResult;
486 using interface1::DistributedContainer;
487 using interface1::Distributed;
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultPtr &partialRes)
Definition: qr_distributed.h:274
daal
Definition: algorithm_base_common.h:57
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:79
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getPartialResult
DistributedPartialResultStep3Ptr getPartialResult()
Definition: qr_distributed.h:399
daal::algorithms::qr::interface1::Parameter
Parameters for the QR decomposition compute method.
Definition: qr_types.h:662
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_distributed.h:250
daal::algorithms::qr::finalResultFromStep2Master
Definition: qr_types.h:138
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:131
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_distributed.h:384
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:178
daal::algorithms::qr::inputOfStep3FromStep1
Definition: qr_types.h:169
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::parameter
Parameter parameter
Definition: qr_distributed.h:361
daal::algorithms::qr::interface1::Distributed
Computes the results of the QR decomposition algorithm in the distributed processing mode...
Definition: qr_distributed.h:164
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step3Local, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:444
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step3Local, algorithmFPType, method > &other)
Definition: qr_distributed.h:375
daal::algorithms::qr::interface1::Online
Computes the results of the QR decomposition algorithm in the online processing mode.
Definition: qr_online.h:113
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultStep3Ptr &partialRes)
Definition: qr_distributed.h:408
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
DistributedPartialResultPtr getPartialResult()
Definition: qr_distributed.h:265
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:281
daal::distributed
Definition: daal_defines.h:132
daal::algorithms::qr::interface1::DistributedContainer
Provides methods to run implementations of the QR decomposition algorithm.
Definition: qr_distributed.h:82
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:304
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: qr_distributed.h:286
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:198
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:354
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::input
Input input
Definition: qr_distributed.h:360
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: qr_distributed.h:390
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::input
Input input
Definition: qr_distributed.h:227
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: qr_distributed.h:241
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: qr_distributed.h:189
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: qr_distributed.h:421
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: qr_distributed.h:426
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:81
daal::step1Local
Definition: daal_defines.h:142
daal::step2Master
Definition: daal_defines.h:143
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:222
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::Distributed
Distributed()
Definition: qr_distributed.h:364
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
Parameter parameter
Definition: qr_distributed.h:228
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: qr_distributed.h:256
daal::algorithms::qr::finalResultFromStep3
Definition: qr_types.h:148
daal::step3Local
Definition: daal_defines.h:144
daal::services::ErrorNullResult
Definition: error_indexes.h:122