23 #ifndef __QR_DISTRIBUTED_H__
24 #define __QR_DISTRIBUTED_H__
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/qr/qr_types.h"
30 #include "algorithms/qr/qr_online.h"
55 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
56 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;
100 template<
typename algorithmFPType, Method method, CpuType cpu>
101 class DAAL_EXPORT DistributedContainer<step3Local, algorithmFPType, method, cpu> :
102 public daal::algorithms::AnalysisContainerIface<distributed>
110 DistributedContainer(daal::services::Environment::env *daalEnv);
112 virtual ~DistributedContainer();
117 virtual services::Status compute() DAAL_C11_OVERRIDE;
122 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
137 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
138 class DAAL_EXPORT Distributed :
public daal::algorithms::Analysis<distributed> {};
151 template<
typename algorithmFPType, Method method>
152 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
155 typedef Online<algorithmFPType, method> super;
157 typedef typename super::InputType InputType;
158 typedef typename super::ParameterType ParameterType;
159 typedef typename super::ResultType ResultType;
160 typedef typename super::PartialResultType PartialResultType;
162 Distributed() : Online<algorithmFPType, method>() {}
170 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) :
171 Online<algorithmFPType, method>(other)
179 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
181 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
185 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
187 return new Distributed<step1Local, algorithmFPType, method>(*this);
202 template<
typename algorithmFPType, Method method>
203 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public daal::algorithms::Analysis<distributed>
206 typedef DistributedStep2Input Input;
208 typedef algorithms::qr::DistributedStep2Input InputType;
209 typedef algorithms::qr::Parameter ParameterType;
210 typedef algorithms::qr::Result ResultType;
211 typedef algorithms::qr::DistributedPartialResult PartialResultType;
214 ParameterType parameter;
227 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
236 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
242 ResultPtr getResult()
244 return _partialResult->get(finalResultFromStep2Master);
251 DistributedPartialResultPtr getPartialResult()
253 return _partialResult;
260 services::Status setPartialResult(
const DistributedPartialResultPtr& partialRes)
262 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
263 DAAL_CHECK(partialRes->get(finalResultFromStep2Master), services::ErrorNullResult)
264 _partialResult = partialRes;
265 _pres = _partialResult.get();
266 return services::Status();
272 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
276 return _partialResult->check(_par, method);
280 return services::Status(services::ErrorNullResult);
282 return services::Status();
290 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
292 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
296 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
298 return new Distributed<step2Master, algorithmFPType, method>(*this);
301 virtual services::Status allocateResult() DAAL_C11_OVERRIDE {
return services::Status(); }
303 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
305 _partialResult.reset(
new PartialResultType());
306 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
307 _pres = _partialResult.get();
311 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
313 _pres = _partialResult.get();
314 return services::Status();
319 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
325 DistributedPartialResultPtr _partialResult;
339 template<
typename algorithmFPType, Method method>
340 class DAAL_EXPORT Distributed<step3Local, algorithmFPType, method> :
public
341 daal::algorithms::Analysis<distributed>
344 typedef DistributedStep3Input Input;
346 typedef algorithms::qr::DistributedStep3Input InputType;
347 typedef algorithms::qr::Parameter ParameterType;
348 typedef algorithms::qr::Result ResultType;
349 typedef algorithms::qr::DistributedPartialResultStep3 PartialResultType;
352 ParameterType parameter;
366 Distributed(
const Distributed<step3Local, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
375 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
381 ResultPtr getResult()
383 return _partialResult->get(finalResultFromStep3);
390 DistributedPartialResultStep3Ptr getPartialResult()
392 return _partialResult;
399 services::Status setPartialResult(
const DistributedPartialResultStep3Ptr& partialRes)
401 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
402 DAAL_CHECK(partialRes->get(finalResultFromStep3), services::ErrorNullResult)
403 _partialResult = partialRes;
404 _pres = _partialResult.get();
405 return services::Status();
412 services::Status setResult(
const ResultPtr& res) {
return services::Status();}
417 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
421 return _partialResult->check(_par, method);
425 return services::Status(services::ErrorNullResult);
427 return services::Status();
435 services::SharedPtr<Distributed<step3Local, algorithmFPType, method> > clone()
const
437 return services::SharedPtr<Distributed<step3Local, algorithmFPType, method> >(cloneImpl());
441 virtual Distributed<step3Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
443 return new Distributed<step3Local, algorithmFPType, method>(*this);
446 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
448 _partialResult.reset(
new PartialResultType());
450 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
453 data_management::DataCollectionPtr qCollection = input.get(inputOfStep3FromStep1);
455 s = _partialResult->setPartialResultStorage<algorithmFPType>(qCollection.get());
457 _pres = _partialResult.get();
461 virtual services::Status allocateResult() DAAL_C11_OVERRIDE {
return services::Status(); }
463 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE {
return services::Status(); }
467 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step3Local, algorithmFPType, method)(&_env);
473 DistributedPartialResultStep3Ptr _partialResult;
477 using interface1::DistributedContainer;
478 using interface1::Distributed;
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultPtr &partialRes)
Definition: qr_distributed.h:260
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::input
InputType input
Definition: qr_distributed.h:351
daal
Definition: algorithm_base_common.h:31
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getPartialResult
DistributedPartialResultStep3Ptr getPartialResult()
Definition: qr_distributed.h:390
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_distributed.h:236
daal::algorithms::qr::finalResultFromStep2Master
Definition: qr_types.h:112
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:105
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_distributed.h:375
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:152
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::input
InputType input
Definition: qr_distributed.h:213
daal::algorithms::qr::inputOfStep3FromStep1
Definition: qr_types.h:143
daal::algorithms::qr::interface1::Distributed
Computes the results of the QR decomposition algorithm in the distributed processing mode...
Definition: qr_distributed.h:138
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step3Local, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:435
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step3Local, algorithmFPType, method > &other)
Definition: qr_distributed.h:366
daal::algorithms::qr::interface1::Online
Computes the results of the QR decomposition algorithm in the online processing mode.
Definition: qr_online.h:87
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultStep3Ptr &partialRes)
Definition: qr_distributed.h:399
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
DistributedPartialResultPtr getPartialResult()
Definition: qr_distributed.h:251
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: qr_distributed.h:214
daal::algorithms::kmeans::init::interface2::Distributed
class DAAL_EXPORT Distributed
Computes initial clusters for the K-Means algorithm in the distributed processing mode...
Definition: kmeans_init_distributed.h:275
daal::distributed
Definition: daal_defines.h:111
daal::algorithms::qr::interface1::DistributedContainer
Provides methods to run implementations of the QR decomposition algorithm.
Definition: qr_distributed.h:56
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:290
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: qr_distributed.h:272
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:179
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:340
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: qr_distributed.h:381
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: qr_distributed.h:227
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: qr_distributed.h:170
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: qr_distributed.h:412
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: qr_distributed.h:417
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:121
daal::step2Master
Definition: daal_defines.h:122
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:203
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::Distributed
Distributed()
Definition: qr_distributed.h:355
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: qr_distributed.h:242
daal::algorithms::qr::finalResultFromStep3
Definition: qr_types.h:122
daal::step3Local
Definition: daal_defines.h:123
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::parameter
ParameterType parameter
Definition: qr_distributed.h:352