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 typedef Online<algorithmFPType, method> super;
183 typedef typename super::InputType InputType;
184 typedef typename super::ParameterType ParameterType;
185 typedef typename super::ResultType ResultType;
186 typedef typename super::PartialResultType PartialResultType;
188 Distributed() : Online<algorithmFPType, method>() {}
196 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) :
197 Online<algorithmFPType, method>(other)
205 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const 207 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
211 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl()
const DAAL_C11_OVERRIDE
213 return new Distributed<step1Local, algorithmFPType, method>(*this);
228 template<
typename algorithmFPType, Method method>
229 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public daal::algorithms::Analysis<distributed>
232 typedef DistributedStep2Input Input;
234 typedef algorithms::qr::DistributedStep2Input InputType;
235 typedef algorithms::qr::Parameter ParameterType;
236 typedef algorithms::qr::Result ResultType;
237 typedef algorithms::qr::DistributedPartialResult PartialResultType;
240 ParameterType parameter;
253 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
262 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
268 ResultPtr getResult()
270 return _partialResult->get(finalResultFromStep2Master);
277 DistributedPartialResultPtr getPartialResult()
279 return _partialResult;
286 services::Status setPartialResult(
const DistributedPartialResultPtr& partialRes)
288 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
289 DAAL_CHECK(partialRes->get(finalResultFromStep2Master), services::ErrorNullResult)
290 _partialResult = partialRes;
291 _pres = _partialResult.get();
292 return services::Status();
298 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
302 return _partialResult->check(_par, method);
306 return services::Status(services::ErrorNullResult);
308 return services::Status();
316 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const 318 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
322 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl()
const DAAL_C11_OVERRIDE
324 return new Distributed<step2Master, algorithmFPType, method>(*this);
327 virtual services::Status allocateResult() DAAL_C11_OVERRIDE {
return services::Status(); }
329 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
331 _partialResult.reset(
new PartialResultType());
332 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
333 _pres = _partialResult.get();
337 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
339 _pres = _partialResult.get();
340 return services::Status();
345 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
351 DistributedPartialResultPtr _partialResult;
365 template<
typename algorithmFPType, Method method>
366 class DAAL_EXPORT Distributed<step3Local, algorithmFPType, method> :
public 367 daal::algorithms::Analysis<distributed>
370 typedef DistributedStep3Input Input;
372 typedef algorithms::qr::DistributedStep3Input InputType;
373 typedef algorithms::qr::Parameter ParameterType;
374 typedef algorithms::qr::Result ResultType;
375 typedef algorithms::qr::DistributedPartialResultStep3 PartialResultType;
378 ParameterType parameter;
392 Distributed(
const Distributed<step3Local, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
401 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
407 ResultPtr getResult()
409 return _partialResult->get(finalResultFromStep3);
416 DistributedPartialResultStep3Ptr getPartialResult()
418 return _partialResult;
425 services::Status setPartialResult(
const DistributedPartialResultStep3Ptr& partialRes)
427 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
428 DAAL_CHECK(partialRes->get(finalResultFromStep3), services::ErrorNullResult)
429 _partialResult = partialRes;
430 _pres = _partialResult.get();
431 return services::Status();
438 services::Status setResult(
const ResultPtr& res) {
return services::Status();}
443 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
447 return _partialResult->check(_par, method);
451 return services::Status(services::ErrorNullResult);
453 return services::Status();
461 services::SharedPtr<Distributed<step3Local, algorithmFPType, method> > clone()
const 463 return services::SharedPtr<Distributed<step3Local, algorithmFPType, method> >(cloneImpl());
467 virtual Distributed<step3Local, algorithmFPType, method> * cloneImpl()
const DAAL_C11_OVERRIDE
469 return new Distributed<step3Local, algorithmFPType, method>(*this);
472 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
474 _partialResult.reset(
new PartialResultType());
476 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
479 data_management::DataCollectionPtr qCollection = input.get(inputOfStep3FromStep1);
481 s = _partialResult->setPartialResultStorage<algorithmFPType>(qCollection.get());
483 _pres = _partialResult.get();
487 virtual services::Status allocateResult() DAAL_C11_OVERRIDE {
return services::Status(); }
489 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE {
return services::Status(); }
493 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step3Local, algorithmFPType, method)(&_env);
499 DistributedPartialResultStep3Ptr _partialResult;
503 using interface1::DistributedContainer;
504 using interface1::Distributed;
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:316
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultPtr &partialRes)
Definition: qr_distributed.h:286
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::input
InputType input
Definition: qr_distributed.h:377
daal::algorithms::qr::interface1::OnlinePartialResult
Provides methods to access partial results obtained with the compute() method of the QR decomposition...
Definition: qr_types.h:321
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:95
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
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:416
daal::algorithms::qr::interface1::Parameter
Parameters for the QR decomposition compute method.
Definition: qr_types.h:662
daal::algorithms::qr::interface1::Result
Provides methods to access final results obtained with the compute() method of the QR decomposition a...
Definition: qr_types.h:418
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_distributed.h:262
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:401
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::interface1::Distributed< step2Master, algorithmFPType, method >::input
InputType input
Definition: qr_distributed.h:239
daal::algorithms::qr::inputOfStep3FromStep1
Definition: qr_types.h:169
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 >::Distributed
Distributed(const Distributed< step3Local, algorithmFPType, method > &other)
Definition: qr_distributed.h:392
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:425
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
DistributedPartialResultPtr getPartialResult()
Definition: qr_distributed.h:277
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
ParameterType parameter
Definition: qr_distributed.h:240
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:133
daal::algorithms::qr::interface1::DistributedContainer
Provides methods to run implementations of the QR decomposition algorithm.
Definition: qr_distributed.h:82
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::services::interface1::SharedPtr::get
T * get() const
Definition: daal_shared_ptr.h:332
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: qr_distributed.h:298
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:366
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: qr_distributed.h:407
daal::algorithms::qr::interface1::DistributedPartialResult
Provides methods to access partial results obtained with the compute() method of the second step of t...
Definition: qr_types.h:499
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: qr_distributed.h:253
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: qr_distributed.h:196
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: qr_distributed.h:438
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:443
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:143
daal::step2Master
Definition: daal_defines.h:144
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:229
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::Distributed
Distributed()
Definition: qr_distributed.h:381
daal::algorithms::qr::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: qr_distributed.h:268
daal::algorithms::qr::finalResultFromStep3
Definition: qr_types.h:148
daal::step3Local
Definition: daal_defines.h:145
daal::algorithms::qr::interface1::DistributedPartialResultStep3
Provides methods to access partial results obtained with the compute() method of the third step of th...
Definition: qr_types.h:591
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step3Local, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:461
daal::algorithms::qr::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: qr_distributed.h:205
daal::services::ErrorNullResult
Definition: error_indexes.h:122
daal::algorithms::qr::interface1::Distributed< step3Local, algorithmFPType, method >::parameter
ParameterType parameter
Definition: qr_distributed.h:378