48 #ifndef __SVD_DISTRIBUTED_H__
49 #define __SVD_DISTRIBUTED_H__
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/numeric_table.h"
53 #include "services/daal_defines.h"
54 #include "algorithms/svd/svd_types.h"
55 #include "algorithms/svd/svd_online.h"
80 template<ComputeStep step,
typename algorithmFPType, Method method, CpuType cpu>
81 class DAAL_EXPORT DistributedContainer
92 template<
typename algorithmFPType, Method method, CpuType cpu>
93 class DAAL_EXPORT DistributedContainer<step1Local, algorithmFPType, method, cpu> :
public
94 OnlineContainer<algorithmFPType, method, cpu>
98 DistributedContainer(daal::services::Environment::env *daalEnv) : OnlineContainer<algorithmFPType, method, cpu>(daalEnv) {}
100 virtual ~DistributedContainer() {}
111 template<
typename algorithmFPType, Method method, CpuType cpu>
112 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, method, cpu> :
113 public daal::algorithms::AnalysisContainerIface<distributed>
121 DistributedContainer(daal::services::Environment::env *daalEnv);
123 virtual ~DistributedContainer();
128 virtual services::Status compute() DAAL_C11_OVERRIDE;
133 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
144 template<
typename algorithmFPType, Method method, CpuType cpu>
145 class DAAL_EXPORT DistributedContainer<step3Local, algorithmFPType, method, cpu> :
146 public daal::algorithms::AnalysisContainerIface<distributed>
154 DistributedContainer(daal::services::Environment::env *daalEnv);
156 virtual ~DistributedContainer();
161 virtual services::Status compute() DAAL_C11_OVERRIDE;
166 virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
181 template<ComputeStep step,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
182 class DAAL_EXPORT Distributed :
public daal::algorithms::Analysis<distributed> {};
195 template<
typename algorithmFPType, Method method>
196 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
199 Distributed() : Online<algorithmFPType, method>() {}
207 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) :
208 Online<algorithmFPType, method>(other)
216 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
218 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
222 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
224 return new Distributed<step1Local, algorithmFPType, method>(*this);
239 template<
typename algorithmFPType, Method method>
240 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method> :
public daal::algorithms::Analysis<distributed>
243 DistributedStep2Input input;
257 Distributed(
const Distributed<step2Master, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
266 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
272 ResultPtr getResult()
274 return _partialResult->get(finalResultFromStep2Master);
281 DistributedPartialResultPtr getPartialResult()
283 return _partialResult;
289 services::Status setPartialResult(
const DistributedPartialResultPtr& partialRes)
291 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
292 DAAL_CHECK(partialRes->get(finalResultFromStep2Master), services::ErrorNullResult)
293 _partialResult = partialRes;
294 _pres = _partialResult.get();
295 return services::Status();
301 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
304 return services::Status(services::ErrorNullResult);
305 return _partialResult->check(_par, method);
313 services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone()
const
315 return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
319 virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
321 return new Distributed<step2Master, algorithmFPType, method>(*this);
324 virtual services::Status allocateResult() DAAL_C11_OVERRIDE{
return services::Status(); }
326 virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
328 _partialResult.reset(
new DistributedPartialResult());
329 services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
330 _pres = _partialResult.get();
334 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
336 _pres = _partialResult.get();
337 return services::Status();
342 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
348 DistributedPartialResultPtr _partialResult;
362 template<
typename algorithmFPType, Method method>
363 class DAAL_EXPORT Distributed<step3Local, algorithmFPType, method> :
public
364 daal::algorithms::Analysis<distributed>
367 DistributedStep3Input input;
381 Distributed(
const Distributed<step3Local, algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
390 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
396 ResultPtr getResult()
398 return _partialResult->get(finalResultFromStep3);
405 DistributedPartialResultStep3Ptr getPartialResult()
407 return _partialResult;
414 services::Status setPartialResult(
const DistributedPartialResultStep3Ptr& partialRes)
416 DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
417 DAAL_CHECK(partialRes->get(finalResultFromStep3), services::ErrorNullResult)
418 _partialResult = partialRes;
419 _pres = _partialResult.get();
420 return services::Status();
427 services::Status setResult(
const ResultPtr& res) {
return services::Status(); }
432 services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
435 return services::Status(services::ErrorNullResult);
436 return _partialResult->check(_par, method);
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);
463 data_management::DataCollectionPtr qCollection = input.get(inputOfStep3FromStep1);
465 s = _partialResult->setPartialResultStorage<algorithmFPType>(qCollection.get());
467 _pres = _partialResult.get();
471 virtual services::Status allocateResult() DAAL_C11_OVERRIDE{
return services::Status(); }
473 virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE{
return services::Status(); }
477 Analysis<distributed>::_ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step3Local, algorithmFPType, method)(&_env);
483 DistributedPartialResultStep3Ptr _partialResult;
487 using interface1::DistributedContainer;
488 using interface1::Distributed;
daal::algorithms::svd::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: svd_distributed.h:216
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::parameter
Parameter parameter
Definition: svd_distributed.h:368
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &res)
Definition: svd_distributed.h:427
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step3Local, algorithmFPType, method > > clone() const
Definition: svd_distributed.h:444
daal::algorithms::svd::interface1::Distributed< step1Local, algorithmFPType, method >
Runs the first step of the SVD algorithm in the distributed processing mode.
Definition: svd_distributed.h:196
daal::algorithms::svd::interface1::Parameter
Parameters for the computation method of the SVD algorithm.
Definition: svd_types.h:187
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::svd::interface1::Online
Computes results of the SVD algorithm in the online processing mode.
Definition: svd_online.h:114
daal::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: svd_distributed.h:313
daal::algorithms::svd::inputOfStep3FromStep1
Definition: svd_types.h:173
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:131
daal::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultPtr &partialRes)
Definition: svd_distributed.h:289
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >
Runs the third step of the SVD algorithm in the distributed processing mode.
Definition: svd_distributed.h:363
daal::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >
Runs the second step of the SVD algorithm in the distributed processing mode.
Definition: svd_distributed.h:240
daal::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: svd_distributed.h:301
daal::algorithms::svd::interface1::DistributedContainer
Provides methods to run implementations of the SVD algorithm.
Definition: svd_distributed.h:81
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::svd::interface1::Distributed< step2Master, algorithmFPType, method >::input
DistributedStep2Input input
Definition: svd_distributed.h:243
daal::algorithms::svd::interface1::DistributedContainer< step1Local, algorithmFPType, method, cpu >::~DistributedContainer
virtual ~DistributedContainer()
Definition: svd_distributed.h:100
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::getPartialResult
DistributedPartialResultStep3Ptr getPartialResult()
Definition: svd_distributed.h:405
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::input
DistributedStep3Input input
Definition: svd_distributed.h:367
daal::algorithms::svd::finalResultFromStep2Master
Definition: svd_types.h:142
daal::algorithms::svd::interface1::DistributedContainer< step1Local, algorithmFPType, method, cpu >::DistributedContainer
DistributedContainer(daal::services::Environment::env *daalEnv)
Definition: svd_distributed.h:98
daal::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: svd_distributed.h:272
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: svd_distributed.h:390
daal::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >::getPartialResult
DistributedPartialResultPtr getPartialResult()
Definition: svd_distributed.h:281
daal::algorithms::svd::interface1::OnlineContainer
Provides methods to run implementations of the SVD algorithm in the online processing mode...
Definition: svd_online.h:79
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedPartialResultStep3Ptr &partialRes)
Definition: svd_distributed.h:414
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: svd_distributed.h:396
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step3Local, algorithmFPType, method > &other)
Definition: svd_distributed.h:381
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::algorithms::svd::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: svd_distributed.h:207
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::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >::parameter
Parameter parameter
Definition: svd_distributed.h:244
daal::step1Local
Definition: daal_defines.h:142
daal::algorithms::svd::finalResultFromStep3
Definition: svd_types.h:153
daal::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: svd_distributed.h:266
daal::algorithms::svd::interface1::Distributed< step3Local, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: svd_distributed.h:432
daal::step2Master
Definition: daal_defines.h:143
daal::algorithms::svd::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, method > &other)
Definition: svd_distributed.h:257
daal::step3Local
Definition: daal_defines.h:144
daal::algorithms::svd::interface1::Distributed
Computes results of the SVD algorithm in the distributed processing mode.
Definition: svd_distributed.h:182
daal::services::ErrorNullResult
Definition: error_indexes.h:122